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 |
|---|---|---|---|---|---|---|
Used when additional reference numbers specific to the claim in the CLP segment are provided to identify information used in the process of adjudicating this claim
|
def other_claim_related_id
if @eob.insurance_policy_number.present?
elem = ['REF','IG', @eob.insurance_policy_number].trim_segment.join(@element_seperator)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def other_claim_related_id\n elem = []\n if !eob.insurance_policy_number.blank?\n elem << 'REF'\n elem << 'IG'\n elem << eob.insurance_policy_number\n elem = Output835.trim_segment(elem)\n elem.join(@element_seperator)\n end\n end",
"def other_claim_related_id\n end",
"def reference_credit_note\n object.credit_note_ref.to_s\n end",
"def references; end",
"def references; end",
"def reassociation_trace\n simple_client_array_for_1000000009 = [\"NAVICURE\", \"ASCEND CLINICAL LLC\"]\n trn_elements = ['TRN', '1', ref_number]\n if simple_client_array_for_1000000009.include? (@client_name)\n trn_elements << '1000000009'\n elsif @check_amount.to_f > 0 && @check.payment_method == \"EFT\"\n trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?\n else\n trn_elements << '1999999999'\n end\n trn_elements.trim_segment.join(@element_seperator)\n end",
"def health_remark_code_segments\n @eob = service.insurance_payment_eob\n facility = @eob.check_information.job.batch.facility\n health_remark_code_segments = []\n health_remark_code_segments << compute_lq(\"in\")\n health_remark_code_segments << compute_lq(\"out\") \n if facility.details[:interest_in_service_line] && service.interest_service_line?\n health_remark_code_segments << lq_rx_segments(\"109975\") if @eob.claim_interest.to_f > 0.0 \n end \n health_remark_code_segments << lq_rx_segments(\"109702\") if @eob.hcra.to_f > 0.0\n health_remark_code_segments.compact!\n health_remark_code_segments.flatten\n end",
"def show\n\n @internal_ref = (@health_case.id)+(123565)\n @health_case.internal_reference = @internal_ref\n @health_case.save\n end",
"def reference_number_prefix\n nil\n end",
"def reference\n @data['reference']\n end",
"def ref_seq\n\n if _ref_seq\n _ref_seq\n else\n seq = Reference.ref_seq(chromosome, start, stop, strand)\n update_attributes(:_ref_seq => seq)\n seq\n end\n\n end",
"def ref_id\n 300_000_000 + data[0].to_i\n end",
"def set_ref_seq\n\n seq = segments.map(&:ref_seq).reduce(:+)\n update_attributes(:_ref_seq => seq)\n\n seq\n\n end",
"def second_reference_id\n nil\n end",
"def refs_at; end",
"def dump_reference_info reference\n if reference.journal_id.nil?\n puts \"Reference has no journal id: \" + reference.id.to_s\n else\n ref_journal_name = Journal.find(reference.journal_id).name\n puts (\" ref journal: \" + ref_journal_name)\n end\n\n matched_hol_journal_name = Journal.find(@antcat_journal_id).name\n puts (\" matched antcat journal name: \" + matched_hol_journal_name)\n\n original_hol_journal_name = @journal_matcher.get_original_hol_journal matched_hol_journal_name\n\n\n if original_hol_journal_name.nil?\n puts (\" original hol journal name (perfect match): \" + matched_hol_journal_name)\n else\n # if this is nil, it's because we have a 1:1 string mapping between antcat and hol's understanging of the journal name\n puts (\" original hol journal name: \" + original_hol_journal_name)\n end\n end",
"def add_reference(post, identification)\n auth, trans_id = identification.split(';')\n post[:authnum] = auth\n post[:transid] = trans_id\n end",
"def verify_reference_nbr(test_data)\n verify_values_match(test_data[UseOfCollections::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end",
"def enter_conservation_ref_num(data_set)\n cons_ref_num = data_set[CoreConservationData::CONS_REF_NUM.name]\n logger.debug \"Entering condition ref number '#{cons_ref_num}'\"\n wait_for_element_and_type(cons_ref_num_input_locator(0), cons_ref_num) if cons_ref_num\n end",
"def ref(logical_id)\n {\"Ref\" => xref(logical_id)}\n end",
"def reassociation_trace\n trn_elements = ['TRN', '1', ref_number]\n if @check_amount.to_f > 0 && @check.payment_method == \"EFT\"\n trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?\n else\n trn_elements << '1999999999'\n end\n trn_elements.join(@element_seperator)\n end",
"def ref\n @references += 1\n end",
"def xref() @x end",
"def get_refering_provider(patient)\n # if there is an NPI for the refering, then fill in the boxes\n # otherwise the refering person is not a physician\n # box 17\n if patient.referred_from_npi\n text_box patient.referred_from, :at => [5, 347]\n text_box patient.referred_from_npi, :at => [225, 344]\n end\n end",
"def verify_reference_nbr(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end",
"def reference\n data['caseReference']\n end",
"def enter_acquisition_ref_num(data_set)\n acquis_ref_num = data_set[CoreAcquisitionData::ACQUIS_REF_NUM.name]\n logger.debug \"Entering reference number '#{acquis_ref_num}'\"\n ref_num_options_locator = input_options_locator([], CoreAcquisitionData::ACQUIS_REF_NUM.name)\n wait_for_options_and_type(ref_num_input_locator, ref_num_options_locator, acquis_ref_num)\n end",
"def refseq_sequence\n \"NC_0000\" + chrom.sub(/X/, \"23\").sub(/Y/, \"24\")\n end",
"def parse_reference_ids full_document\n full_document.gsub(/%r(\\d+)/) do\n if Reference.exists? $1\n reference = Reference.find($1)\n reference.decorate.to_link\n else\n broken_markdown_link \"reference\", $1\n end\n end\n end",
"def non_ref_count\n read_bases = self.read_bases\n if read_bases =~ /\\+/\n non_ref_count = indel_non_ref_count('+')\n elsif read_bases =~ /-/\n non_ref_count = indel_non_ref_count('-')\n else\n non_ref_count = read_bases.count('atgcATGC')\n end\n non_ref_count\n end",
"def reference\n @refs ||= strip(:reference)\n end",
"def claim_payment_information\n clp_elements = []\n clp_elements << 'CLP'\n clp_elements << patient_account_number\n clp_elements << claim_type_weight\n clp_elements << eob.amount('total_submitted_charge_for_claim')\n clp_elements << eob.payment_amount_for_output(facility, facility_output_config)\n clp_elements << (clp_elements[2] == 22 ? \"\" : eob.patient_responsibility_amount)\n clp_elements << plan_type\n clp_elements << claim_number\n clp_elements << facility_type_code\n clp_elements << claim_freq_indicator\n clp_elements << nil\n clp_elements << eob.drg_code unless eob.drg_code.blank?\n clp_elements = Output835.trim_segment(clp_elements)\n clp_elements.join(@element_seperator)\n end",
"def handle_references_label(vals)\n @references_collection << vals.last\n @references = vals.last if matches_mdes_version(vals)\n end",
"def add_customer_ref_num(params, customer_ref_num)\n params[:customer_ref_num] = customer_ref_num\n end",
"def referenced; end",
"def reference\n value_for('reference')\n end",
"def resolve_reference; end",
"def ref_xy(); @ref_xy; end",
"def enter_ref_num(data_set)\n ref_num = data_set[Acquisition::ACQUIS_REF_NUM.name]\n wait_for_element_and_type(acquis_ref_num_input(0), ref_num) if ref_num\n end",
"def ref_number\n batch = check.batch\n facility_name = facility.name.upcase\n if (facility_name == 'AHN' || facility_name == 'SUBURBAN HEALTH' ||\n facility_name == 'UWL' || facility_name == 'ANTHEM')\n file_number = batch.file_name.split('_')[0][3..-1] rescue \"0\"\n date = batch.date.strftime(\"%Y%m%d\")\n \"#{date}_#{file_number}\"\n else\n (batch.batchid.include?(\"AH\") ? batch.batchid : batch.date.strftime(\"%Y%m%d\"))\n end\n end",
"def reference\n @reference\n end",
"def claim_number\n str = eob.check_information.check_number.to_s if eob.check_information\n (str += '_' + eob.claim_number) if !eob.claim_number.blank?\n str\n end",
"def idref\n \"c#{rank}\"\n end",
"def claim_existing_references(references)\n references.each do |ref_string|\n indirect_vm_ref = update_context.resolve_reference(ref_string, blame_reference).viewmodel_reference\n claim_existing_member(indirect_vm_ref, ref_string)\n end\n end",
"def refer(code_array)\n if @resolved_addr\n code_array.push(@resolved_addr)\n else\n offset = code_array.size\n code_array.push(nil) # Dummy\n @unresolved_refs.push([code_array, offset])\n end\n end",
"def on_reference(name)\n end",
"def component_reference\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n begin\n # at line 38:5: '-' IDENT NL\n match( T__41, TOKENS_FOLLOWING_T__41_IN_component_reference_237 )\n match( IDENT, TOKENS_FOLLOWING_IDENT_IN_component_reference_239 )\n match( NL, TOKENS_FOLLOWING_NL_IN_component_reference_241 )\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__, 6 )\n\n\n end\n\n return \n end",
"def references\n details.map { |detail| detail[:recurring_detail_reference] }\n end",
"def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end",
"def enter_reference_nbr(test_data)\n hide_notifications_bar\n logger.info \"Entering reference number '#{test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name]}'\"\n wait_for_options_and_type(reference_nbr_input, reference_nbr_options, test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name])\n end",
"def locate_internal_refs1(refs, identifier, ident)\n #file, _filename = targetfile(filedesc, read: true)\n file, _filename = @files.targetfile_id(ident, read: true)\n xml = Nokogiri::XML(file) { |config| config.huge }\n t = xml.xpath(\"//*/@id\").each_with_object({}) { |i, x| x[i.text] = true }\n refs.each do |schema, ids|\n ids.keys.select { |id| t[id] }.each do |id|\n n = xml.at(\"//*[@id = '#{id}']\") and\n n.at(\"./ancestor-or-self::*[@type = '#{schema}']\") and\n refs[schema][id] = identifier\n end\n end\n end",
"def absorption_references\n @references.inject([]) do |array, ref|\n array << ref\n # puts \"Column #{name} spans #{ref}, #{ref.is_absorbing ? \"\" : \"not \"} absorbing (#{ref.to.name} absorbs via #{ref.to.absorbed_via.inspect})\"\n break array unless ref.is_absorbing\n array\n end\n end",
"def full_ref # rubocop:disable Metrics/AbcSize\n @full_ref ||= begin\n ref = \"#{refparts[:perfix]}#{refparts[:series]} #{refparts[:code]}\"\n ref += \"pt#{refparts[:prt]}\" if refparts[:prt] # long_to_short(refparts, \"prt\").to_s\n ref += \"ver#{refparts[:ver]}\" if refparts[:ver] # long_to_short(refparts, \"vol\").to_s\n ref += \"v#{refparts[:vol]}\" if refparts[:vol]\n ref\n end\n end",
"def count_debate_references\n extr = FileLinesExtractor.new\n mp_refs = {} # cia bus sumesti visi SN vardai i kuriuos buvo kreiptasi\n count do |mp, sten|\n puts \"#{mp}\"\n extr.extract(sten).each do |line|\n line.scan(/( \\D\\.(\\D\\.)?\\w{4,})/).each do |ref|\n puts \"\\t#{ref}\"\n (mp_refs[mp] ||= []) << ref[0].strip if ref[0].strip.size > 4\n end\n end\n end\n \n #TODO sitas turetu eiti i kita vieta (t.y. i lrs moduli), bet kolkas nera architekturos kaip tvarkyti stenogramas\n DebateReference.delete_all\n mp_refs.each{|p,ref|\n author = Politician.find_by_id_in_lrs(p)\n ref.each{|ref|\n name = ref.gsub(/(ai|as|ą|čiui|čio|is|io|į|iuj|iu|iaus|iui|ius|ių|iumi|os|iaus|o|u|ui|ys)$/, '').gsub(/(|ė|ės|ei|e|ę|a)$/, '')\n \n first_name_initials = name.split('.').first\n last_name = name.split('.').last\n reference_sql=<<-SQL\n select * from politicians\n where\n last_name like '#{last_name + '%'}' and\n (substring(first_name, 1,1) = '#{first_name_initials}' or substring(second_name, 1,1) = '#{first_name_initials}')\n SQL\n ref_mp = Politician.find_by_sql(reference_sql).first \n author.debate_references << \n author.debate_references.new(:name_reference_id => ref_mp.id, :sitting_id=>nil) if ref_mp\n }\n }\nend",
"def reference\n [ type, identifier ]\n end",
"def cd_in_reference?(id)\n @cd_ref_id.include? id\n end",
"def number_for_citation_node(xref_node)\n refid = xref_node['rid']\n ref = reference_by_id(refid)\n ref && ref[:number]\n end",
"def claim_payment_information\n claim_weight = claim_type_weight\n ['CLP', captured_or_blank_patient_account_number(@eob.patient_account_number), claim_weight, @eob.amount('total_submitted_charge_for_claim'),\n @eob.payment_amount_for_output(@facility, @facility_output_config),\n ( claim_weight == 22 ? \"\" : @eob.patient_responsibility_amount),\n \"13\", @eob.claim_number ].trim_segment.join(@element_seperator)\n end",
"def applicant_reference_params\n params.require(:applicant_reference).permit(:Contact_Number, :Reference_Name, :Email_address, :Relationship, :applicant_id)\n end",
"def enter_reference_nbr(test_data)\n hide_notifications_bar\n wait_for_options_and_type(reference_nbr_input, reference_nbr_options, test_data[UseOfCollections::REFERENCE_NBR.name])\n end",
"def acknowledgement_reference_id\r\n\t\tacknowledgement_message.split(\":\")[1].gsub(/\\s/,\"\")\r\n\tend",
"def reassociation_trace\n trn_elements = []\n trn_elements << 'TRN'\n trn_elements << '1'\n check_num = \"#{check.check_number.to_i}\"\n job = check.job\n if payer\n if job.payer_group == \"PatPay\"\n # checking whether the check_number is duplicated\n # in the whole check number array\n if Output835.element_duplicates?(check_num, @check_nums)\n # get all indexes at which duplicate elements are present\n # then check at what position the current element resides\n # that gives the duplication index as one moves from first to last elem of the array\n # For Ex : array = [a, b, c, c, d, e, f, e, g]\n # all_indices for 'c' would return [2, 3]\n # comparing the current element's index with that, we would get either '0' or '1' depending on\n # whether we're dealing with 'c' in 2nd place or at 3rd place, couting starts from 0th place\n # all_indices for 'e' would return [5, 7]\n counter = Output835.all_indices(check_num, @check_nums).index(index)\n # since counter starts from zero, adding 1 to get the correct count\n end\n check_num << \"#{check.batch.date.strftime(\"%m%d%y\")}\" unless check_num.blank?\n check_num << \"#{counter+1}\" if counter\n end\n end\n trn_elements << (check_num.blank? ? \"0\" : check_num)\n if @check_amount.to_f > 0 && check.payment_method == \"EFT\"\n unless facility.facility_tin.blank?\n trn_elements << '1' + facility.facility_tin\n end\n else\n trn_elements << '1999999999'\n end\n trn_elements = Output835.trim_segment(trn_elements)\n trn_elements.join(@element_seperator)\n end",
"def ref; end",
"def raw_to_reference( line )\n a = line.split(', ')\n\n if a[-1] == 'Unpublished observations.'\n title = a.pop.chop\n pages = volume = year = journal = ''\n else\n title = ''\n\n pages_or_volume = a.pop.chop\n if pages_or_volume =~ %r{pp\\.\\s}\n pages = pages_or_volume\n pages.gsub!('pp. ', '')\n volume = a.pop\n else\n pages = ''\n volume = pages_or_volume\n end\n\n volume.gsub!('vol. ', '')\n\n year_and_journal = a.pop\n year_and_journal =~ %r{\\((\\d+)\\)\\s(.+)}\n year = $1\n journal = $2\n end\n\n authors = []\n\n last_name = nil\n a.each do |e|\n if last_name\n authors << \"#{last_name}, #{e}\"\n last_name = nil\n else\n last_name = e\n end\n end\n\n ref = {\n 'title' => title,\n 'pages' => pages,\n 'volume' => volume,\n 'year' => year,\n 'journal' => journal,\n 'authors' => authors,\n }\n\n Bio::Reference.new(ref)\n end",
"def historic_refinancing_params\n params.require(:historic_refinancing).permit(:authorization_origin_id, :refinancing_id, :authorization_new_id)\n end",
"def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end",
"def ref\n @messaging['optin']['ref']\n end",
"def references_provider\n attributes.fetch(:referencesProvider)\n end",
"def is_ref? ; !!metadata[:ref] ; end",
"def ref_attrs\n docidentifier.detect(&:primary)&.tap do |di|\n return { anchor: di.id.gsub(\" \", \".\").squeeze(\".\") }\n end\n end",
"def referencing_link_name\n error(\"referencing_link_name on #{name} is invalid as #{characteristic_container.characteristic_kind} is not a reference\") unless reference?\n \"#{name}#{referenced_entity.primary_key.name}\"\n end",
"def correct_standards_pointed_to_missing_ref_ids(element)\n ref_id_map = {\n 'B1AC98EADE4145689E70EEEBD9B8CC19' => patch_duplicated_parent_ref_ids(element,'B1AC98EADE4145689E70EEEBD9B8CC18'),\n '834B17E279C64263AA83F7625F5D2994' => patch_duplicated_parent_ref_ids(element,'834B17E279C64263AA83F7625F5D2993'),\n '91FABAB899814C55851003A0EE98F8FC' => patch_duplicated_parent_ref_ids(element,'91FABAB899814C55851003A0EE98F8FB')\n }\n return unless (element.is_a?(Standard) and ref_id_map.keys.include?(element.parent_ref_id))\n element.instance_variable_set(:@parent_ref_id,ref_id_map[element.parent_ref_id])\n end",
"def claim_payment_information\n claim_weight = claim_type_weight\n clp_elements = ['CLP', captured_or_blank_patient_account_number(@eob.patient_account_number), claim_weight,\n @eob.amount('total_submitted_charge_for_claim'), @eob.payment_amount_for_output(@facility, @facility_output_config),\n ( claim_weight == 22 ? \"\" : @eob.patient_responsibility_amount), plan_type, claim_number, eob_facility_type_code, claim_freq_indicator, nil,\n (@eob.drg_code if @eob.drg_code.present?)].trim_segment.join(@element_seperator)\n end",
"def ref_number\n if ['AHN', 'SUBURBAN HEALTH', 'UWL', 'ANTHEM'].include?(@facility_name)\n file_number = @batch.file_name.split('_')[0][3..-1] rescue \"0\"\n date = @batch.date.strftime(\"%Y%m%d\")\n \"#{date}_#{file_number}\"\n else\n (@batch.batchid.include?(\"AH\") ? @batch.batchid : @batch.date.strftime(\"%Y%m%d\"))\n end\n end",
"def referenced?; end",
"def crossref_query\n CrossrefQuery.generate_query_from_text( ref_apa_6 )\n end",
"def known_invalid_idref(mapkey, oldid)\n\treturn false;\n\t# \treturn ( ((mapkey==:version or mapkey==:fixfor) and oldid==21907 or oldid==21881 or oldid==21743) or\n\t# \t\t\t(mapkey==:version and (oldid==21240 or oldid==21743)) or \n\t# \t\t\t(mapkey==:issuestatus and (oldid==2 or oldid==-3)) or\n\t# \t\t\t(mapkey==:resolution and oldid==6)\n\t# \t )\nend",
"def reference_custom_fields\n reference_custom_field_ids.collect{|cf_id| CustomFields::Reference.find(cf_id) }\n end",
"def reference_data\n @reference_data ||= KeyValues.new(@from_profile, @source).format_data\n end",
"def claim_number\n @eob.claim_number.to_s\n end",
"def macro\n :references_one\n end",
"def updateReference\n return @references\n end",
"def validate_references\n if datasets.count == 1\n []\n else\n x = datasets.reduce([]) { |a, e| e.anchor? ? a << [e.name, e.anchor[:name]] : a }\n refs = datasets.reduce([]) do |a, e|\n a.concat(e.references)\n end\n refs.reduce([]) do |a, e|\n x.include?([e[:dataset], e[:reference]]) ? a : a.concat([e])\n end\n end\n end",
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def claim_payment_loop\n claim_payment_segments = []\n service_eob = nil\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n eob.service_payment_eobs.collect{|service| service_eob=service if service.adjustment_line_is?}\n if !service_eob.blank?\n cas_segments, @clp_pr_amount = Output835.cas_adjustment_segments(service_eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << claim_interest_information_bac # _bac methods are used for dynamic output section it will be bypassed for non_banks\n if claim_level_eob?\n cas_segments, @clp_05_amount = Output835.cas_adjustment_segments(eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end \n claim_payment_segments << patient_name\n claim_payment_segments << reference_identification_qualifier_bac\n claim_payment_segments << reference_identification_bac if !@reason_codes.blank?\n unless eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier_bac\n claim_payment_segments << reference_id_bac\n claim_payment_segments << image_page_name_bac\n claim_payment_segments << other_claim_related_id\n claim_payment_segments = claim_payment_segments.compact\n claim_payment_segments unless claim_payment_segments.blank?\n end",
"def comment\n @references.map do |ref|\n ref.verbalised_path\n end.compact * \" and \"\n end",
"def references_to\n # REVISIT: If some other object has a Mapping to us, that should be in this list\n @mapping.all_member.select do |m|\n m.is_a?(MM::Absorption) and\n f = m.forward_mapping and # This Absorption has a forward counterpart, so must be reverse\n f.parent_role.is_unique\n end\n end",
"def legal_forward_references(identification_phrases)\n identification_phrases.map do |phrase|\n phrase.is_a?(NounPhrase) ? phrase.term : nil\n end.compact.uniq\n end",
"def claim_payment_loop\n claim_payment_segments = []\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n service_eob = @services.detect{|service| service.adjustment_line_is? }\n if service_eob\n cas_segments, @clp_pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(service_eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n if @is_claim_eob\n cas_segments, @clp_05_amount, crosswalked_codes = Output835.cas_adjustment_segments(@eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << patient_name\n unless @eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier\n if @is_claim_eob\n claim_payment_segments << Output835.claim_level_remark_code_segments(@eob, @element_seperator, crosswalked_codes)\n end\n claim_payment_segments << image_page_name\n claim_payment_segments << medical_record_number\n claim_payment_segments << claim_uid if @client_name == \"QUADAX\"\n claim_payment_segments << other_claim_related_id\n claim_payment_segments.compact\n end",
"def reference_params\n \t\tparams.require(:reference).permit(:description, :book_id, :book_id_secondary)\n \tend",
"def offense_to_diagnostic(off); end",
"def can_add_reference?\n true\n end",
"def parts_of_reference (docset, ref_str)\n\tref = ref_str.split\n\tif ref.length != 2\n\t\tTextMate.exit_show_tool_tip \"Cannot parse reference: #{str}\"\n\tend\n\n\tlanguage, type, klass, thing = ref[0].split('/')\n\tRef.new(docset, language, type, klass, thing, ref[1])\nend",
"def references\n @references ||= []\n end",
"def __drbref\n @ref\n end",
"def process_claim\n clm = ClaimInformation.new\n \n # Row, column index reduced to match user specification\n @cnf['CLAIM'].each { |k, v| clm[k] = @cntnt[v[0]-1][v[1]-1, v[2]].strip }\n @cnf['CLAIM_DATES'].each { |k, v| clm[k] = frame_date(@cntnt[v[0]-1][v[1]-1, v[2]].strip) }\n \n @clm_fl_info.total_claim_count += 1\n process_claim_services(clm)\n refine_claim(clm)\n # if clm.save!\n @clm_fl_info.loaded_claim_count += 1\n @clm_fl_info.loaded_svcline_count += 1\n # end\n p clm\n return clm\n end",
"def xref\n unless @xref\n @xref = []\n @event.xpath(\"xref\").each do |xref|\n @xref << xref.inner_text\n end\n end\n @xref\n end",
"def to_reference\n \"#{@sender},#{@identifier},#{RCAP.to_s_for_cap(@sent)}\"\n end",
"def set_reference\n extract_reference_data\n values = reference_data.split\n @reference = Reference.new(thermometer: Float(values[1]), humidity: Float(values[2]))\n end",
"def target_id; genomic.entry_id; end"
] |
[
"0.6337421",
"0.6014893",
"0.5780814",
"0.57280505",
"0.57280505",
"0.5722685",
"0.5638677",
"0.56098926",
"0.5599693",
"0.5578289",
"0.5568588",
"0.5564096",
"0.5562551",
"0.55386055",
"0.55197716",
"0.5482172",
"0.54294103",
"0.54200155",
"0.5399013",
"0.5376572",
"0.5361615",
"0.53598154",
"0.53577805",
"0.534972",
"0.5347584",
"0.5322402",
"0.53068596",
"0.53038913",
"0.5285219",
"0.5276287",
"0.52577996",
"0.5245537",
"0.52431107",
"0.524019",
"0.5226099",
"0.52061033",
"0.51963943",
"0.51861405",
"0.5177312",
"0.5176079",
"0.5175894",
"0.5175275",
"0.516871",
"0.5153285",
"0.51466143",
"0.5144182",
"0.51428306",
"0.51380986",
"0.51345444",
"0.51187074",
"0.5115412",
"0.51129895",
"0.5106623",
"0.5104583",
"0.5099753",
"0.5059704",
"0.5057286",
"0.5055513",
"0.5046414",
"0.5038532",
"0.5029358",
"0.50290614",
"0.50276893",
"0.50271666",
"0.5017715",
"0.50156283",
"0.5003996",
"0.49974486",
"0.49894324",
"0.49837327",
"0.4982731",
"0.49772072",
"0.49771327",
"0.4974585",
"0.4972838",
"0.49715522",
"0.49671388",
"0.49665287",
"0.49660063",
"0.49583665",
"0.49546567",
"0.4946187",
"0.49419567",
"0.49339095",
"0.49300942",
"0.49255666",
"0.49220496",
"0.4920242",
"0.4918934",
"0.49184912",
"0.49064368",
"0.4904526",
"0.49032992",
"0.49022183",
"0.49007556",
"0.48901713",
"0.4882574",
"0.48773256",
"0.4875693",
"0.48749784"
] |
0.62510943
|
1
|
Specifies pertinent dates and times of the claim
|
def statement_from_date
claim_date = claim_start_date
if claim_date && can_print_service_date(claim_date.strftime("%Y%m%d"))
['DTM', '232', claim_date.strftime("%Y%m%d")].join(@element_seperator)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def acquired_date_time=(value)\n @acquired_date_time = value\n end",
"def set_starts_at_time_and_date\n self.starts_at_time = starts_at.strftime(\"%H:%M\")\n self.starts_at_date = starts_at.strftime(\"%Y-%m-%d\")\n end",
"def claimed_at\n params['claimed_at']\n end",
"def fulfilled_date_time=(value)\n @fulfilled_date_time = value\n end",
"def invite_date_time=(value)\n @invite_date_time = value\n end",
"def time_params\n {\n membership_start_time: membership_start_time,\n membership_end_time: membership_end_time,\n start_time: reservations_start_time,\n end_time: reservations_end_time\n }\n end",
"def claim\n if expiration_time\n CLAIM_EXPIRATION_TIME\n elsif not_before_time\n CLAIM_NOT_BEFORE_TIME\n end\n end",
"def claim_datum_params\n params.require(:claim_datum).permit(:provider_full_name, :provider_id, :date_of_service, :client_full_name, :service, :duration)\n end",
"def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend",
"def set_date\n gon.time_period = @verdict.time_period.strftime('%m/%d/%Y %H:%M') if !@verdict.time_period.nil?\n end",
"def viewing_params\n datetime = [params[:date], params[:time]].join(' ')\n params.merge({ when: datetime }).permit(:house_id, :user_id, :when)\n end",
"def spent_on=(date)\n super\n if spent_on.is_a?(Time)\n self.spent_on = spent_on.to_date\n end\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end",
"def set_date_time=(date_time)\n\t\t@date_time=DateTime.now\n\tend",
"def date=(time)\n delete('Date')\n add('Date', time.rfc2822)\n end",
"def start_time\n begin_date\n end",
"def submitted_date_time=(value)\n @submitted_date_time = value\n end",
"def submitted_date_time=(value)\n @submitted_date_time = value\n end",
"def date_claim(label, value)\n text_claim(label, value)\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? spent_on.cweek : nil\n end",
"def assigned_date_time=(value)\n @assigned_date_time = value\n end",
"def attributes(*args)\n attrib = super(*args)\n attrib[:register_date] = object.register_date.to_time.iso8601 unless object.register_date.blank?\n attrib\n end",
"def initialize data\n super\n self['date'] = Time.at date / 1_000\n end",
"def start_time\n self.date\n end",
"def requested_at=(val)\n @requested_at = TicketSharing::Time.new(val)\n end",
"def completion_date_time=(value)\n @completion_date_time = value\n end",
"def completion_date_time=(value)\n @completion_date_time = value\n end",
"def set_start_end_dates\n if new_record?\n self.start_time ||= '12:00 PM'\n self.end_time ||= '01:00 PM'\n parse_start_end\n elsif has_attribute?(:start_at) # this if is to allow custom selects on the Event module\n self.start_date = start_at.to_s(:slashes) unless start_at.blank?\n self.start_time = start_at.to_s(:time_only).strip unless start_at.blank?\n self.end_date = end_at.to_s(:slashes) unless end_at.blank?\n self.end_time = end_at.to_s(:time_only).strip unless end_at.blank?\n end\n end",
"def registered_date_time=(value)\n @registered_date_time = value\n end",
"def set_values(times)\n @values[:start_time] = times[:actual]\n @values[:end_time] = times[:next]\n end",
"def shared_date_time=(value)\n @shared_date_time = value\n end",
"def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def unsubmitted_date_time=(value)\n @unsubmitted_date_time = value\n end",
"def initialize(cult, follower)\n @cult = cult\n @follower = follower\n\n #calculate time into right format _YYYY-MM-DD_\n # time_str = \"\"\n # time_str = Time.now.to_s\n time_str = Time.now.to_s.split(\" \")[0]\n\n\n @initiation_date = \"_#{time_str}_\"\n\n @@all << self\n end",
"def issue_date= datetime\n write_attribute(:issue_date, User.current.system_time(datetime))\n end",
"def date_payroll\n\t\treturn created_at,init_date,end_date,fortnight\n\tend",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders in form. They will be removed from table\n #+ definition.\n # Database migration and rake task is there to change field type for\n #+ start/end date. Now storing time and date in same fields.\n if self.category.eql?(\"appointment\")\n self.start_date = self.start_date_appointment unless self.start_date_appointment.blank?\n self.end_date = self.end_date_appointment unless self.end_date_appointment.blank? \n=begin\n if false && start_date && end_date\n sd = start_date.utc\n ed = end_date.utc\n st = start_time #.in_time_zone\n et = end_time \n p sd, ed, st, et\n self.start_date = DateTime.new(sd.year, sd.month, sd.day, st.hour, st.min, st.sec).utc\n self.end_date = DateTime.new(ed.year, ed.month, ed.day, et.hour, et.min, et.sec) \n p start_date\n p end_date\n end\n=end\n else\n #self.start_date = self.end_date_todo unless self.end_date_todo.blank? #self.start_date_todo unless self.start_date_todo.blank?\n self.start_date = self.start_date_todo unless self.start_date_todo.blank?\n self.end_date = self.end_date_todo unless self.end_date_todo.blank?\n end\n end",
"def reminder_date_time=(value)\n @reminder_date_time = value\n end",
"def start_time\n by_date\n end",
"def acquired_date_time\n return @acquired_date_time\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_attributes_with_time(attributes)\n default_attributes.merge(attributes).each do |k,v|\n instance_variable_set \"@#{k.to_s}\", to_time(v)\n end\n end",
"def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_to_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def trip_time\n # puts scheduled_date.ai\n # puts scheduled_time.ai\n # DateTime.new(scheduled_date.year, scheduled_date.month, scheduled_date.day,\n # scheduled_time.hour, scheduled_time.min, 0, scheduled_time.offset)\n scheduled_time\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_from_date = \"00000000\"\n else\n claim_from_date = eob.claim_from_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim From Date:#{claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_from_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_expires_at\n self[:expires_at] = case self.expiry_option \n when :in then Time.now.utc + (self.expiry_days || DEFAULT_EXPIRY_DAYS).days\n when :on then self[:expires_at]\n else self[:expires_at]\n end\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def launch_date_time=(value)\n @launch_date_time = value\n end",
"def set_expires_at\n self[:expires_at] = case self.expiry_option \n when :in then Time.now.utc + (self.expiry_days || 3).days\n when :on then self[:expires_at]\n else self[:expires_at]\n end\n end",
"def expires_at=(time)\n self.expiry_option = :on\n self[:expires_at] = time\n end",
"def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def initialize(date)\n\t\t@now = date\n\t\t@decision_body = \"961\"\n\t\t@ids = meeting_ids\n\tend",
"def reassigned_date_time=(value)\n @reassigned_date_time = value\n end",
"def reviewed_date_time=(value)\n @reviewed_date_time = value\n end",
"def cooking_time\n end",
"def starts_at=(date)\n super(date)\n set_ends_at\n end",
"def time_signature(numer, denom, clocks, qnotes)\n @numer = numer\n @denom = denom\n @clocks = clocks\n @qnotes = qnotes\n end",
"def meta\n {\n exp: 1.day.from_now.to_i,\n iss: 'issuser_name',\n aud: 'client'\n }\n end",
"def expiration_date\n end",
"def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def set_for_time timestamp\n return nil unless @date\n case timestamp[0,2]\n when \"00\"\n @datetime.hour == 23 ? @date_add_1_hr : @date\n when \"23\"\n @datetime.hour == 00 ? @date_1_hr_ago : @date\n else\n @date\n end\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def set_dates_and_duration\n if start_date && end_date && !duration\n self.duration = (end_date - start_date).to_i + 1 # if it's same date, duration should be 1\n elsif start_date && !end_date && duration\n self.end_date = start_date + (duration - 1).days\n elsif !start_date && end_date && duration\n self.start_date = end_date - (duration - 1).days\n end\n end",
"def dfp_date_time_used()\n @credential_handler.include_in_user_agent(\"DfpDateTime\")\n end",
"def upload_date_time=(value)\n @upload_date_time = value\n end",
"def date() self[:date]; end",
"def time_only(person_or_type = nil)\n time_detail(:time_only => true, :audience => person_or_type)\n end",
"def due_date_time=(value)\n @due_date_time = value\n end",
"def due_date_time=(value)\n @due_date_time = value\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def set_termination_date\n if effective_date and approved_details.try(:duration) and (effective_date_changed? or approved_details_id_changed?)\n self.termination_date = Date.new(\n effective_date.year + approved_details.duration,\n effective_date.month,\n effective_date.day )\n end\n end",
"def returned_date_time=(value)\n @returned_date_time = value\n end",
"def accepted_date_time=(value)\n @accepted_date_time = value\n end",
"def propagate_start_and_end_times\n if @start_time && @start_time != shift.start_time\n self.starts_at = twenty_four_hour_time(@start_time)\n else\n self.starts_at = nil\n end\n if @end_time && @end_time != shift.end_time\n self.ends_at = twenty_four_hour_time(@end_time)\n else\n self.ends_at = nil\n end\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def event_date_time=(value)\n @event_date_time = value\n end",
"def start_time\n date.to_time + kickoff_time.hour.hours\n end",
"def timeRecordsForDate(brick, date)\n end",
"def align_times\n # if booking the same day, then starts_at is in one minute from now.\n earliest_possible_starts_at = ( self.starts_at.to_date == Date.today ) ? ( DateTime.now + 1.minute ) : self.starts_at.beginning_of_day\n self.attributes = {\n starts_at: earliest_possible_starts_at,\n ends_at: self.ends_at.end_of_day\n }\n end",
"def internal_due_date_time=(value)\n @internal_due_date_time = value\n end"
] |
[
"0.639774",
"0.6387715",
"0.6031999",
"0.59773725",
"0.59708434",
"0.59489584",
"0.59467953",
"0.5913828",
"0.58895594",
"0.5829928",
"0.5810156",
"0.58087486",
"0.57840437",
"0.5775544",
"0.57466674",
"0.5738322",
"0.5725611",
"0.5725611",
"0.5718948",
"0.5704946",
"0.5703718",
"0.5703493",
"0.56832844",
"0.5667271",
"0.56539994",
"0.56456",
"0.56456",
"0.5628649",
"0.56282264",
"0.5617453",
"0.56155044",
"0.5584829",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55802524",
"0.55708337",
"0.5556643",
"0.5550657",
"0.5549714",
"0.55493844",
"0.5533435",
"0.5527544",
"0.5521503",
"0.55187196",
"0.5517834",
"0.550708",
"0.5505683",
"0.5488274",
"0.547795",
"0.54768246",
"0.5475868",
"0.5473259",
"0.54673755",
"0.546272",
"0.5459438",
"0.54523045",
"0.5446306",
"0.54444104",
"0.5438011",
"0.54377717",
"0.54337054",
"0.5430585",
"0.54169005",
"0.5413726",
"0.54108155",
"0.5403571",
"0.54000396",
"0.539138",
"0.537739",
"0.5373792",
"0.53711116",
"0.5370054",
"0.5370054",
"0.53698033",
"0.53698033",
"0.53698033",
"0.53698033",
"0.5365356",
"0.5359565",
"0.5356586",
"0.53548354",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5350948",
"0.5350917",
"0.5350247",
"0.53482866",
"0.5347044"
] |
0.5409202
|
69
|
Specifies pertinent dates and times of the claim
|
def statement_to_date
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def acquired_date_time=(value)\n @acquired_date_time = value\n end",
"def set_starts_at_time_and_date\n self.starts_at_time = starts_at.strftime(\"%H:%M\")\n self.starts_at_date = starts_at.strftime(\"%Y-%m-%d\")\n end",
"def claimed_at\n params['claimed_at']\n end",
"def fulfilled_date_time=(value)\n @fulfilled_date_time = value\n end",
"def invite_date_time=(value)\n @invite_date_time = value\n end",
"def time_params\n {\n membership_start_time: membership_start_time,\n membership_end_time: membership_end_time,\n start_time: reservations_start_time,\n end_time: reservations_end_time\n }\n end",
"def claim\n if expiration_time\n CLAIM_EXPIRATION_TIME\n elsif not_before_time\n CLAIM_NOT_BEFORE_TIME\n end\n end",
"def claim_datum_params\n params.require(:claim_datum).permit(:provider_full_name, :provider_id, :date_of_service, :client_full_name, :service, :duration)\n end",
"def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend",
"def set_date\n gon.time_period = @verdict.time_period.strftime('%m/%d/%Y %H:%M') if !@verdict.time_period.nil?\n end",
"def viewing_params\n datetime = [params[:date], params[:time]].join(' ')\n params.merge({ when: datetime }).permit(:house_id, :user_id, :when)\n end",
"def spent_on=(date)\n super\n if spent_on.is_a?(Time)\n self.spent_on = spent_on.to_date\n end\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end",
"def set_date_time=(date_time)\n\t\t@date_time=DateTime.now\n\tend",
"def date=(time)\n delete('Date')\n add('Date', time.rfc2822)\n end",
"def start_time\n begin_date\n end",
"def submitted_date_time=(value)\n @submitted_date_time = value\n end",
"def submitted_date_time=(value)\n @submitted_date_time = value\n end",
"def date_claim(label, value)\n text_claim(label, value)\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? spent_on.cweek : nil\n end",
"def assigned_date_time=(value)\n @assigned_date_time = value\n end",
"def attributes(*args)\n attrib = super(*args)\n attrib[:register_date] = object.register_date.to_time.iso8601 unless object.register_date.blank?\n attrib\n end",
"def initialize data\n super\n self['date'] = Time.at date / 1_000\n end",
"def start_time\n self.date\n end",
"def requested_at=(val)\n @requested_at = TicketSharing::Time.new(val)\n end",
"def completion_date_time=(value)\n @completion_date_time = value\n end",
"def completion_date_time=(value)\n @completion_date_time = value\n end",
"def set_start_end_dates\n if new_record?\n self.start_time ||= '12:00 PM'\n self.end_time ||= '01:00 PM'\n parse_start_end\n elsif has_attribute?(:start_at) # this if is to allow custom selects on the Event module\n self.start_date = start_at.to_s(:slashes) unless start_at.blank?\n self.start_time = start_at.to_s(:time_only).strip unless start_at.blank?\n self.end_date = end_at.to_s(:slashes) unless end_at.blank?\n self.end_time = end_at.to_s(:time_only).strip unless end_at.blank?\n end\n end",
"def registered_date_time=(value)\n @registered_date_time = value\n end",
"def set_values(times)\n @values[:start_time] = times[:actual]\n @values[:end_time] = times[:next]\n end",
"def shared_date_time=(value)\n @shared_date_time = value\n end",
"def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def expiration_date_time=(value)\n @expiration_date_time = value\n end",
"def unsubmitted_date_time=(value)\n @unsubmitted_date_time = value\n end",
"def initialize(cult, follower)\n @cult = cult\n @follower = follower\n\n #calculate time into right format _YYYY-MM-DD_\n # time_str = \"\"\n # time_str = Time.now.to_s\n time_str = Time.now.to_s.split(\" \")[0]\n\n\n @initiation_date = \"_#{time_str}_\"\n\n @@all << self\n end",
"def issue_date= datetime\n write_attribute(:issue_date, User.current.system_time(datetime))\n end",
"def date_payroll\n\t\treturn created_at,init_date,end_date,fortnight\n\tend",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders in form. They will be removed from table\n #+ definition.\n # Database migration and rake task is there to change field type for\n #+ start/end date. Now storing time and date in same fields.\n if self.category.eql?(\"appointment\")\n self.start_date = self.start_date_appointment unless self.start_date_appointment.blank?\n self.end_date = self.end_date_appointment unless self.end_date_appointment.blank? \n=begin\n if false && start_date && end_date\n sd = start_date.utc\n ed = end_date.utc\n st = start_time #.in_time_zone\n et = end_time \n p sd, ed, st, et\n self.start_date = DateTime.new(sd.year, sd.month, sd.day, st.hour, st.min, st.sec).utc\n self.end_date = DateTime.new(ed.year, ed.month, ed.day, et.hour, et.min, et.sec) \n p start_date\n p end_date\n end\n=end\n else\n #self.start_date = self.end_date_todo unless self.end_date_todo.blank? #self.start_date_todo unless self.start_date_todo.blank?\n self.start_date = self.start_date_todo unless self.start_date_todo.blank?\n self.end_date = self.end_date_todo unless self.end_date_todo.blank?\n end\n end",
"def reminder_date_time=(value)\n @reminder_date_time = value\n end",
"def start_time\n by_date\n end",
"def acquired_date_time\n return @acquired_date_time\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_attributes_with_time(attributes)\n default_attributes.merge(attributes).each do |k,v|\n instance_variable_set \"@#{k.to_s}\", to_time(v)\n end\n end",
"def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_to_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def trip_time\n # puts scheduled_date.ai\n # puts scheduled_time.ai\n # DateTime.new(scheduled_date.year, scheduled_date.month, scheduled_date.day,\n # scheduled_time.hour, scheduled_time.min, 0, scheduled_time.offset)\n scheduled_time\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_from_date = \"00000000\"\n else\n claim_from_date = eob.claim_from_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim From Date:#{claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_from_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def set_expires_at\n self[:expires_at] = case self.expiry_option \n when :in then Time.now.utc + (self.expiry_days || DEFAULT_EXPIRY_DAYS).days\n when :on then self[:expires_at]\n else self[:expires_at]\n end\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def launch_date_time=(value)\n @launch_date_time = value\n end",
"def set_expires_at\n self[:expires_at] = case self.expiry_option \n when :in then Time.now.utc + (self.expiry_days || 3).days\n when :on then self[:expires_at]\n else self[:expires_at]\n end\n end",
"def expires_at=(time)\n self.expiry_option = :on\n self[:expires_at] = time\n end",
"def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def initialize(date)\n\t\t@now = date\n\t\t@decision_body = \"961\"\n\t\t@ids = meeting_ids\n\tend",
"def reassigned_date_time=(value)\n @reassigned_date_time = value\n end",
"def reviewed_date_time=(value)\n @reviewed_date_time = value\n end",
"def cooking_time\n end",
"def starts_at=(date)\n super(date)\n set_ends_at\n end",
"def time_signature(numer, denom, clocks, qnotes)\n @numer = numer\n @denom = denom\n @clocks = clocks\n @qnotes = qnotes\n end",
"def meta\n {\n exp: 1.day.from_now.to_i,\n iss: 'issuser_name',\n aud: 'client'\n }\n end",
"def expiration_date\n end",
"def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def set_for_time timestamp\n return nil unless @date\n case timestamp[0,2]\n when \"00\"\n @datetime.hour == 23 ? @date_add_1_hr : @date\n when \"23\"\n @datetime.hour == 00 ? @date_1_hr_ago : @date\n else\n @date\n end\n end",
"def statement_from_date\n claim_date = claim_start_date\n if claim_date && can_print_service_date(claim_date.strftime(\"%Y%m%d\"))\n ['DTM', '232', claim_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end",
"def set_dates_and_duration\n if start_date && end_date && !duration\n self.duration = (end_date - start_date).to_i + 1 # if it's same date, duration should be 1\n elsif start_date && !end_date && duration\n self.end_date = start_date + (duration - 1).days\n elsif !start_date && end_date && duration\n self.start_date = end_date - (duration - 1).days\n end\n end",
"def dfp_date_time_used()\n @credential_handler.include_in_user_agent(\"DfpDateTime\")\n end",
"def upload_date_time=(value)\n @upload_date_time = value\n end",
"def date() self[:date]; end",
"def time_only(person_or_type = nil)\n time_detail(:time_only => true, :audience => person_or_type)\n end",
"def due_date_time=(value)\n @due_date_time = value\n end",
"def due_date_time=(value)\n @due_date_time = value\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def set_termination_date\n if effective_date and approved_details.try(:duration) and (effective_date_changed? or approved_details_id_changed?)\n self.termination_date = Date.new(\n effective_date.year + approved_details.duration,\n effective_date.month,\n effective_date.day )\n end\n end",
"def returned_date_time=(value)\n @returned_date_time = value\n end",
"def accepted_date_time=(value)\n @accepted_date_time = value\n end",
"def propagate_start_and_end_times\n if @start_time && @start_time != shift.start_time\n self.starts_at = twenty_four_hour_time(@start_time)\n else\n self.starts_at = nil\n end\n if @end_time && @end_time != shift.end_time\n self.ends_at = twenty_four_hour_time(@end_time)\n else\n self.ends_at = nil\n end\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def start_date_time=(value)\n @start_date_time = value\n end",
"def event_date_time=(value)\n @event_date_time = value\n end",
"def start_time\n date.to_time + kickoff_time.hour.hours\n end",
"def timeRecordsForDate(brick, date)\n end",
"def align_times\n # if booking the same day, then starts_at is in one minute from now.\n earliest_possible_starts_at = ( self.starts_at.to_date == Date.today ) ? ( DateTime.now + 1.minute ) : self.starts_at.beginning_of_day\n self.attributes = {\n starts_at: earliest_possible_starts_at,\n ends_at: self.ends_at.end_of_day\n }\n end",
"def internal_due_date_time=(value)\n @internal_due_date_time = value\n end"
] |
[
"0.639774",
"0.6387715",
"0.6031999",
"0.59773725",
"0.59708434",
"0.59489584",
"0.59467953",
"0.5913828",
"0.58895594",
"0.5829928",
"0.5810156",
"0.58087486",
"0.57840437",
"0.5775544",
"0.57466674",
"0.5738322",
"0.5725611",
"0.5725611",
"0.5718948",
"0.5704946",
"0.5703718",
"0.5703493",
"0.56832844",
"0.5667271",
"0.56539994",
"0.56456",
"0.56456",
"0.5628649",
"0.56282264",
"0.5617453",
"0.56155044",
"0.5584829",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55819196",
"0.55802524",
"0.55708337",
"0.5556643",
"0.5550657",
"0.5549714",
"0.55493844",
"0.5533435",
"0.5527544",
"0.5521503",
"0.55187196",
"0.5517834",
"0.550708",
"0.5505683",
"0.5488274",
"0.547795",
"0.54768246",
"0.5475868",
"0.5473259",
"0.54673755",
"0.546272",
"0.5459438",
"0.54523045",
"0.5446306",
"0.54444104",
"0.5438011",
"0.54377717",
"0.54337054",
"0.5430585",
"0.54169005",
"0.5413726",
"0.54108155",
"0.5409202",
"0.5403571",
"0.54000396",
"0.539138",
"0.537739",
"0.5373792",
"0.53711116",
"0.5370054",
"0.5370054",
"0.53698033",
"0.53698033",
"0.53698033",
"0.53698033",
"0.5365356",
"0.5359565",
"0.5356586",
"0.53548354",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5351722",
"0.5350948",
"0.5350917",
"0.5350247",
"0.53482866",
"0.5347044"
] |
0.0
|
-1
|
Specifies pertinent From date of the claim
|
def claim_from_date
if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime("%Y%m%d"))
[ 'DTM', '232', @eob.claim_from_date.strftime("%Y%m%d")].join(@element_seperator)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_from_date = \"00000000\"\n else\n claim_from_date = eob.claim_from_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim From Date:#{claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_from_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def from_date\n @from_date ||= begin\n Date.parse(@data['fromDate']) if @data['fromDate']\n end\n end",
"def from_date\n @from_date ||= begin\n Date.parse(@data['fromDate']) if @data['fromDate']\n end\n end",
"def from_date\n @from_date ||= begin\n Date.parse(@data['fromDate']) if @data['fromDate']\n end\n end",
"def from_date\n Date.parse(@data['fromDate']) if @data['fromDate']\n end",
"def award_date\n @from_date ||= begin\n Date.parse(@data['awardDate']) if @data['awardDate']\n end\n end",
"def date_from=(date_from)\n if !date_from.nil? && date_from.to_s.length > 10\n fail ArgumentError, 'invalid value for \"date_from\", the character length must be smaller than or equal to 10.'\n end\n\n if !date_from.nil? && date_from.to_s.length < 10\n fail ArgumentError, 'invalid value for \"date_from\", the character length must be great than or equal to 10.'\n end\n\n @date_from = date_from\n end",
"def set_FromDateTime(value)\n set_input(\"FromDateTime\", value)\n end",
"def set_FromDateTime(value)\n set_input(\"FromDateTime\", value)\n end",
"def set_FromDateTime(value)\n set_input(\"FromDateTime\", value)\n end",
"def set_FromDateTime(value)\n set_input(\"FromDateTime\", value)\n end",
"def set_FromDateTime(value)\n set_input(\"FromDateTime\", value)\n end",
"def fromdate\n query_root_node(\"gdacs:fromdate/text()\", @@NAMESPACES)\n end",
"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 from=(value)\n @from = value\n end",
"def from=(value)\n @from = value\n end",
"def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def from(from)\n @value[:from] = from\n self\n end",
"def resent_from=( val )\n header[:resent_from] = val\n end",
"def answer_given_date\n @answer_given_date ||= respond_to?(:answerGivenDate) ? DateTime.parse(answerGivenDate) : nil\n end",
"def valid_from(from_time)\n add_field('authValidFrom', from_time.to_i.to_s + '000')\n end",
"def valid_from(from_time)\n add_field('authValidFrom', from_time.to_i.to_s + '000')\n end",
"def valid_from\n utc_timestamp_from('valid_from')\n end",
"def from=(from)\n if from.nil?\n fail ArgumentError, 'invalid value for \"from\", from cannot be nil.'\n end\n @from = from\n end",
"def from_date(date)\n return self if date.blank?\n\n date = date.to_date.beginning_of_day\n\n where(validity_start_date: date..)\n end",
"def set_akt\n @akt = Akt.notdeleted.find(params[:id])\n @akt.from_date = @akt.from_date.strftime(\"%d.%m.%Y\")\n end",
"def from\n attributes.fetch(:from)\n end",
"def immersive_start_date\n @p0_start_date + 63\n end",
"def claimed_at\n params['claimed_at']\n end",
"def from\n @property[:from]\n end",
"def set_initial_date\n unless date_requested\n self.date_requested = Date.today\n end\n end",
"def mbox_from=(value)\n @mbox_from = value\n end",
"def from=(from)\n write_attr :from, from\n end",
"def initialize(date)\n @to_date = date\n end",
"def init\n\t\tself.extra_person = 0 if self.extra_person.nil?\n\t\tself.from_date = Date.today if self.from_date.nil?\n\t\tself.to_date = Date.today + 1.day if self.to_date.nil?\n\tend",
"def claim_to_date\n unless eob.claim_to_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_to_date = \"00000000\"\n else\n claim_to_date = eob.claim_to_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << claim_to_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def start_date\n @start_date ||= respond_to?(:partyMembershipStartDate) ? DateTime.parse(partyMembershipStartDate) : nil\n end",
"def before date\n @before = date\n end",
"def admitted_at\n if get(\"ADM_DATE\")\n Time.parse get(\"ADM_DATE\")\n else\n nil\n end\n end",
"def start_date\n date\n end",
"def statement_from_date\n claim_date = claim_start_date\n if claim_date && can_print_service_date(claim_date.strftime(\"%Y%m%d\"))\n ['DTM', '232', claim_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def start_access_on_date\n @attributes[:start_access_on_date]\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end",
"def from(value)\n @from = value\n @options[:from] = value\n self\n end",
"def begin_date=(date)\n date = IncompleteDate.new date unless date.is_a? IncompleteDate or date.nil?\n @begin_date = date\n end",
"def date_set(date_from, date_to)\n # if the first parameter is empty, default to using second date instead\n date_from = date_overwrite(date_from, date_to)\n date_to = date_overwrite(date_to, date_from)\n\n # after date potentially duplicated above, use first/last entry years\n # and first/last day of year to cover missing year, month, and day\n date_from = date_default(date_from, [DATE_FIRST[0], \"01\", \"01\"])\n date_to = date_default(date_to, [DATE_LAST[0], \"12\", \"31\"])\n\n date_from = date_format(date_from, default_year: DATE_FIRST[0].to_i)\n date_to = date_format(date_to, default_year: DATE_LAST[0].to_i)\n\n # Set parameters so form populated with calculated dates\n params[:date_from] = date_from.split(\"-\")\n params[:date_to] = date_to.split(\"-\")\n\n [date_from, date_to]\n end",
"def resent_from( val = nil )\n default :resent_from, val\n end",
"def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_to_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def from\n @from ||= begin\n results = relation.search_with_conditions(public_access, rows: 1, sort: MODIFIED_DATE_FIELD + ' asc')\n if results.present?\n results.first.fetch(MODIFIED_DATE_FIELD)\n else\n BEGINNING_OF_TIME\n end\n end\n end",
"def initial_date\n self.start_date.strftime('%m-%d-%Y')\n end",
"def set_contributor_until\n self.contributer_until = \"Oct 1 2011\"\n self.content_contributer_until = \"Oct 1 2011\"\n end",
"def to_date\n @from_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def from(value)\n merge(culfrom: value.iso8601)\n end",
"def from_truncated\n truncate_datetime(from)\n end",
"def date_claim(label, value)\n text_claim(label, value)\n end",
"def set_MinFaveDate(value)\n set_input(\"MinFaveDate\", value)\n end",
"def set_MinFaveDate(value)\n set_input(\"MinFaveDate\", value)\n end",
"def set_MinFaveDate(value)\n set_input(\"MinFaveDate\", value)\n end",
"def set_MinFaveDate(value)\n set_input(\"MinFaveDate\", value)\n end",
"def start_date\n read_attribute(:start_date).nil? ? nil : read_attribute(:start_date).to_date\n end",
"def between(from, to)\n FFaker::Time.between(from, to).to_date\n end",
"def original_purchase_date\n read_datetime_from_string('original_purchase_date')\n end",
"def resolve_valid_from(resource)\n debug \"resolve_valid_from: resource: #{resource}\"\n return resource[:valid_from] = Time.parse(resource[:valid_from]).utc if resource[:valid_from]\n resource[:valid_from] = Time.now.utc\n end",
"def to(date)\n @to = fmt_date(date)\n end",
"def f_start_date\n\t\tself.expected_start_date.strftime(\"%d / %m / %Y\")\n\tend",
"def invoice_date\n invoiced_on || created_at.to_date\n end",
"def set_from\n @from = From.find(params[:id])\n end",
"def date\n set_function_and_argument(:date, nil)\n end",
"def initialize(record)\n @qts_award_date = record.fetch(:qts_date)\n end",
"def from=( val )\n header[:from] = val\n end",
"def set_param_date\n # sets datas based on params or last transaction\n # if params include a date from/to converted to beginning and end of month\n # if only front will set from and to (or today of to missing)\n # if parmans not present will get last transaction and set from to beginning of its month\n # if from is in current month, may look back 7 days from from date\n @today = Date.today\n minus7 = @today.day < 8 ? 8 - @today.day : 0 # if in first week of month, look back 7 days\n if params[:date].present? # from month pulldown\n @date = Ledger.set_date(params[:date])\n @from = @date.beginning_of_month\n @to = @date.end_of_month\n elsif params[:from].present? # from date picker(from,to)\n @from = Ledger.set_date(params[:from])\n @to = params[:to].present? ? Ledger.set_date(params[:to]) : @today.end_of_month\n else\n last_tran = @account.last_entry_date ||= @today.beginning_of_year\n @from = last_tran.beginning_of_month\n @from -= minus7 if Ledger.dates_in_same_month(@today,@from)\n @to = @today.end_of_month\n end\n end",
"def start_date_as_date\n return USDateParse(self.start_date)\n end",
"def set_due_date_to_month_from_now\n \tif self.due_date.nil?\n \t\tself.due_date = 1.month.from_now\n \tend\n end",
"def start_date\n params[:start_date] ? params[:start_date].to_datetime : DateTime.now.beginning_of_month\n end",
"def from\n @from\n end",
"def initial_call_off_start_date_valid_date\n Date.parse(\"#{initial_call_off_start_date_dd.to_i}/#{initial_call_off_start_date_mm.to_i}/#{initial_call_off_start_date_yyyy.to_i}\")\n rescue ArgumentError\n errors.add(:initial_call_off_start_date, :not_a_date)\n end",
"def invoice_date\n completed_at\n end",
"def set_birth_date\n self.birth_date = Time.now\n end",
"def date_approval=(date)\n super parse_date(date)\n end",
"def mobilisation_start_date_validation\n mobilisation_start_date = initial_call_off_start_date - mobilisation_period.weeks - 1.day\n errors.add(:mobilisation_start_date, :greater_than) if mobilisation_start_date <= Time.zone.today\n end",
"def starts_at=(date)\n super(date)\n set_ends_at\n end",
"def initialize(date)\n @representing_date = date\n end",
"def read_date; end",
"def start_date_date=(date)\n self[:start_date_day] = date.day\n self[:start_date_month] = date.month\n self[:start_date_year] = date.year\n end",
"def initialize(charge_start_date:)\n @charge_start_date = charge_start_date\n end",
"def expires_on\n self.expires_on = Date.strptime(expiration_date,'%m/%Y')+1.month\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def set_MinTakenDate(value)\n set_input(\"MinTakenDate\", value)\n end",
"def start_date\n return start\n end",
"def read_date=(_); end",
"def default_date_range\n \"#{Hyrax.config.analytics_start_date},#{Time.zone.today}\"\n end",
"def set_BeginDate(value)\n set_input(\"BeginDate\", value)\n end",
"def date_collected_fill\n if self.user_id.nil?\n self.user_id = self.current_user\n end\n\n if self.collected_on_day.blank? or self.collected_on_month.blank? or self.collected_on_year.blank? or self.collected_on_day == 'UNKNOWN' or self.collected_on_month == 'UNKNOWN' or self.collected_on_year == 'UNKNOWN'\n self.date_collected = nil\n else\n self.date_collected = DateTime.strptime(self.collected_on_year + \"/\" + self.collected_on_month + \"/\" + self.collected_on_day, \"%Y/%m/%d\" )\n end\n\n end",
"def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end",
"def set_StartDate(value)\n set_input(\"StartDate\", value)\n end"
] |
[
"0.7641909",
"0.75583285",
"0.7301756",
"0.7301756",
"0.7261059",
"0.71562874",
"0.7124526",
"0.6807425",
"0.6753635",
"0.6753635",
"0.6753635",
"0.6753635",
"0.6753635",
"0.63954306",
"0.63586754",
"0.6248928",
"0.6248928",
"0.62271583",
"0.6224968",
"0.6162491",
"0.61388904",
"0.60205346",
"0.60104877",
"0.5991384",
"0.5968983",
"0.5951969",
"0.5939859",
"0.58651316",
"0.58552134",
"0.5837834",
"0.583408",
"0.5810398",
"0.58046323",
"0.57882214",
"0.5786267",
"0.5768205",
"0.57547694",
"0.57500046",
"0.5744795",
"0.5733007",
"0.5710468",
"0.5700881",
"0.5696766",
"0.5694936",
"0.5683095",
"0.5640911",
"0.5636684",
"0.56222665",
"0.5619001",
"0.56150603",
"0.5613214",
"0.56084096",
"0.5599916",
"0.5575608",
"0.5544953",
"0.5543114",
"0.55348426",
"0.55348426",
"0.55348426",
"0.55348426",
"0.5530097",
"0.55258155",
"0.55164045",
"0.55130833",
"0.5502776",
"0.5501178",
"0.5498997",
"0.5494143",
"0.5483664",
"0.5482618",
"0.5480601",
"0.5464354",
"0.546315",
"0.5458437",
"0.54455817",
"0.5438421",
"0.5407901",
"0.540471",
"0.54047066",
"0.5397502",
"0.53937167",
"0.5392027",
"0.5379059",
"0.5361169",
"0.5347924",
"0.53403705",
"0.5335808",
"0.53316396",
"0.53316396",
"0.53316396",
"0.53316396",
"0.53316396",
"0.53316396",
"0.5322412",
"0.5321387",
"0.53172886",
"0.53127503",
"0.53107774",
"0.53070116",
"0.5305678"
] |
0.7051829
|
7
|
Specifies pertinent To dates of the claim
|
def claim_to_date
if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime("%Y%m%d"))
['DTM', '233', @eob.claim_to_date.strftime("%Y%m%d")].join(@element_seperator)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def claim_to_date\n unless eob.claim_to_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_to_date = \"00000000\"\n else\n claim_to_date = eob.claim_to_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << claim_to_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def to(date)\n @to = fmt_date(date)\n end",
"def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_to_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def claim_from_date\n unless eob.claim_from_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_from_date = \"00000000\"\n else\n claim_from_date = eob.claim_from_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim From Date:#{claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_from_date\n claim_date_elements.join(@element_seperator)\n end\n end",
"def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def initialize(date)\n @to_date = date\n end",
"def compute_date_to\n\t\t\t\t\tif self.period.to_sym == :year\n\t\t\t\t\t\tself.to = self.from + 1.year - 1.day\n\t\t\t\t\telsif self.period.to_sym == :month\n\t\t\t\t\t\tself.to = self.from + 1.month - 1.day\n\t\t\t\t\tend\n\t\t\t\tend",
"def date_to=(date_to)\n if !date_to.nil? && date_to.to_s.length > 10\n fail ArgumentError, 'invalid value for \"date_to\", the character length must be smaller than or equal to 10.'\n end\n\n if !date_to.nil? && date_to.to_s.length < 10\n fail ArgumentError, 'invalid value for \"date_to\", the character length must be great than or equal to 10.'\n end\n\n @date_to = date_to\n end",
"def to_date\n @from_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def enrollment_dates\n if start_date\n \"#{start_date_formatted} - #{end_date_formatted}\"\n end\n end",
"def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end",
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def date_set(date_from, date_to)\n # if the first parameter is empty, default to using second date instead\n date_from = date_overwrite(date_from, date_to)\n date_to = date_overwrite(date_to, date_from)\n\n # after date potentially duplicated above, use first/last entry years\n # and first/last day of year to cover missing year, month, and day\n date_from = date_default(date_from, [DATE_FIRST[0], \"01\", \"01\"])\n date_to = date_default(date_to, [DATE_LAST[0], \"12\", \"31\"])\n\n date_from = date_format(date_from, default_year: DATE_FIRST[0].to_i)\n date_to = date_format(date_to, default_year: DATE_LAST[0].to_i)\n\n # Set parameters so form populated with calculated dates\n params[:date_from] = date_from.split(\"-\")\n params[:date_to] = date_to.split(\"-\")\n\n [date_from, date_to]\n end",
"def charge_item_detail\n \n \"#{date_from.strftime('%d/%m/%Y')} - #{date_to.strftime('%d/%m/%Y')}\" \n\n end",
"def invoice_date\n invoiced_on || created_at.to_date\n end",
"def dates\n end",
"def between(from, to)\n FFaker::Time.between(from, to).to_date\n end",
"def statement_from_date\n claim_date = claim_start_date\n if claim_date && can_print_service_date(claim_date.strftime(\"%Y%m%d\"))\n ['DTM', '232', claim_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def dates(from=nil, to=nil)\n from ||= start_at\n to ||= ((end_on && end_on.to_date) || from.to_date >> 12)\n expression.dates(from, to).collect {|date| date.to_time }\n end",
"def date_claim(label, value)\n text_claim(label, value)\n end",
"def to_date()\n #This is a stub, used for indexing\n end",
"def finances_finished_reservations(date_from, date_to)\n\n repository.adapter.select(query_finances_finished_reservations, date_from, date_to).sort do |x,y|\n comp = x.date_to <=> y.date_to\n comp.zero? ? Time.parse(x.time_to) <=> Time.parse(y.time_to) : comp\n end\n\n end",
"def finances_started_reservations(date_from, date_to)\n\n repository.adapter.select(query_finances_started_reservations, date_from, date_to).sort do |x,y|\n comp = x.date_from <=> y.date_from\n comp.zero? ? Time.parse(x.time_from) <=> Time.parse(y.time_from) : comp\n end\n\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end",
"def correct_dates?(object)\n object.date_from <= object.date_to\n end",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def due_by\n #occurring_days = ae_definition.occurring_days\n dob = profile.kids_type.birthdate.to_date\n dob + (ae_definition.occurring_days + ae_definition.due_by_days )\n end",
"def action_date\n case object.status\n when 'paid'\n object.created_at\n when 'canceled'\n object.closed_at\n when 'shipped'\n object.shipped_at\n when 'accepted'\n object.accepted_at\n end\n end",
"def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def select_custom_date_filter(from_date, to_date)\n date_option_custom.click\n custom_date_from.text = from_date\n custom_date_to.text = to_date\n end",
"def invoice_date\n completed_at\n end",
"def set_akt\n @akt = Akt.notdeleted.find(params[:id])\n @akt.from_date = @akt.from_date.strftime(\"%d.%m.%Y\")\n end",
"def recipients_from_to\n to\n end",
"def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end",
"def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end",
"def init\n\t\tself.extra_person = 0 if self.extra_person.nil?\n\t\tself.from_date = Date.today if self.from_date.nil?\n\t\tself.to_date = Date.today + 1.day if self.to_date.nil?\n\tend",
"def set_ToDateTime(value)\n set_input(\"ToDateTime\", value)\n end",
"def set_ToDateTime(value)\n set_input(\"ToDateTime\", value)\n end",
"def set_ToDateTime(value)\n set_input(\"ToDateTime\", value)\n end",
"def set_ToDateTime(value)\n set_input(\"ToDateTime\", value)\n end",
"def set_ToDateTime(value)\n set_input(\"ToDateTime\", value)\n end",
"def set_contributor_until\n self.contributer_until = \"Oct 1 2011\"\n self.content_contributer_until = \"Oct 1 2011\"\n end",
"def starts_at=(date)\n super(date)\n set_ends_at\n end",
"def created_at_filter(options)\n start_date = options[:from].minutes.ago\n end_date = options[:to].minutes.ago\n from = URI.encode(start_date.strftime(TIME_FORMULA))\n to = URI.encode(end_date.strftime(TIME_FORMULA))\n\n \"created_at[from]=#{from}&created_at[to]=#{to}\"\n end",
"def resent_to=( val )\n header[:resent_to] = val\n end",
"def inactive_date\n\t\tif inactive_changed?\n\t\t\tif inactive?\n\t\t\t\tself.inactive_from = Time.now\n\t\t\telse\n\t\t\t\tself.inactive_from = nil\n\t\t\tend\n\t\tend\n\n\t\tdef new_ownership\n\t\t\t@user = User.find(self.created_by)\n\t\t\tOwnership.create(business_id: self.id, user_id: self.created_by, \n\t\t\t\temail_address: @user.email, created_by: self.created_by)\n\t\tend\n\tend",
"def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end",
"def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end",
"def claimed_at\n params['claimed_at']\n end",
"def delivery_days_to\n hash[\"DeliveryDaysTo\"]\n end",
"def absentee_status_expires_on\n # TODO use real data\n 1.year.from_now.strftime('%B %d, %Y')\n end",
"def set_join_date\n membership = current_membership\n membership.join_date = Time.zone.now\n membership.save\n end",
"def valid_to\n utc_timestamp_from('valid_to')\n end",
"def award_date\n @from_date ||= begin\n Date.parse(@data['awardDate']) if @data['awardDate']\n end\n end",
"def to_date\n find\n end",
"def expiration_date\n end",
"def calculate_dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n end",
"def credit_note_end_at\n I18n.l(object.refunded_at.to_date)\n end",
"def to_date(date)\n return self if date.blank?\n\n date = date.to_date.end_of_day\n\n where(validity_end_date: ..date)\n end",
"def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end",
"def due\n @invoices = @account_invoices.where(invoices: { due_on_date: @start_date...@end_date })\n end",
"def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end",
"def rule_date_range_validation\n if self and self.from_date > self.to_date\n return [false,\"from_date should be less than to_date\"]\n else\n return true\n end\n end",
"def status_to\n TermsCalculator.this_year_end.to_date\n end",
"def apply_dates(attributes)\n attributes[:date] ||= []\n attributes[:date] << attributes[:date_published]\n attributes[:date] << attributes[:date_available]\n attributes[:date] << attributes[:date_accepted]\n attributes[:date] << attributes[:date_submitted]\n attributes[:date].uniq!\n end",
"def all_transfer_dates(from = nil, to)\n @user.transfers.map { |transfer| transfer.forecast(from, to) }.flatten.uniq\n end",
"def subscribed_at\n Time.parse params['subscr_date']\n end",
"def todate\n query_root_node(\"gdacs:todate/text()\", @@NAMESPACES)\n end",
"def imply_dates\n return unless !@properties['end'].nil? && !@properties['start'].nil?\n\n start_date = nil\n\n @properties['start'].each do |start_val|\n if start_val =~ /^(\\d{4}-[01]\\d-[0-3]\\d)/\n start_date = Regexp.last_match(1) if start_date.nil?\n elsif start_val =~ /^(\\d{4}-[0-3]\\d\\d)/\n start_date = Regexp.last_match(1) if start_date.nil?\n end\n end\n\n unless start_date.nil?\n @properties['end'].map! do |end_val|\n if end_val.match?(/^\\d{4}-[01]\\d-[0-3]\\d/)\n end_val\n elsif end_val.match?(/^\\d{4}-[0-3]\\d\\d/)\n end_val\n else\n start_date + ' ' + end_val\n end\n end\n end\n end",
"def date_payroll\n\t\treturn created_at,init_date,end_date,fortnight\n\tend",
"def invoice_date_display\n\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def service_date_reference\n service_date_elements, svc_date_segments = [], []\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\n to_date = service.date_of_service_to.strftime(\"%Y%m%d\") unless service.date_of_service_to.blank? \n if from_date\n service_date_elements << 'DTM'\n service_date_elements << '150'\n service_date_elements << from_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n if to_date\n service_date_elements = []\n service_date_elements << 'DTM'\n service_date_elements << '151'\n service_date_elements << to_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n svc_date_segments unless svc_date_segments.blank?\n end",
"def interview_date_decision_notification(interviewee, interviewer, datetime)\n @interviewee = interviewee\n @interviewer = interviewer\n @datetime = datetime\n mail to: [interviewee.email, interviewer.email], subject: \"#{interviewee.name} さんの面接日時が確定しました\"\n end",
"def set_termination_date\n if effective_date and approved_details.try(:duration) and (effective_date_changed? or approved_details_id_changed?)\n self.termination_date = Date.new(\n effective_date.year + approved_details.duration,\n effective_date.month,\n effective_date.day )\n end\n end",
"def set_dates(start_date = nil, end_date = nil)\n\n\t if (start_date.nil? and not end_date.nil?)\n\n\t\t start_date = (@utils.get_date_object(end_date)) - (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s\n\n\t elsif (not start_date.nil? and end_date.nil?)\n\n\t\t end_date =(@utils.get_date_object(start_date)) + (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t if end_date > Time.new.utc\n\t\t\tend_date = nil #Let API default to Now.\n\t\t end\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s if not end_date.nil?\n\n\t end\n end",
"def from_date_is_before_to_date\n \tif from_date.to_i > to_date.to_i\n\t \terrors.add(:from_date, \"can't be from_date.to_i > to_date.to_i\")\n\tend\nend",
"def to_range\n start_date..end_date\n end",
"def publication_date\n super(:dc_date)\n end",
"def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end",
"def to_range\n (@start_date..@end_date)\n end",
"def final_date\n self.end_date.strftime('%m-%d-%Y')\n end",
"def formatDate\n tmp = params['viewCDR']\n if !tmp.nil? and tmp.class==ActiveSupport::HashWithIndifferentAccess\n from_date = Time.new(tmp['from_date(1i)'], tmp['from_date(2i)'], tmp['from_date(3i)'])\n from_date_param = from_date.strftime(\"%Y-%m-%d\")\n to_date = Time.new(tmp['to_date(1i)'], tmp['to_date(2i)'], tmp['to_date(3i)'])\n to_date_param = to_date.strftime(\"%Y-%m-%d\")\n end\n redirect_to \"/accounts/viewCDR?to=#{to_date_param}&from=#{from_date_param}\"\n end",
"def specified_period\n @range = [@start_date, @end_date]\n end",
"def date_restrictable_must_be_chronological\n\n # bounce unless we have both dates\n return if valid_from.blank? or valid_until.blank?\n\n # otherwise…\n unless valid_until.to_date >= valid_from.to_date\n\n field_name = self.class.human_attribute_name( :valid_from )\n errors.add( :valid_until, :must_be_on_or_after, { field: field_name })\n\n end\n\n end",
"def default_date_range\n \"#{Hyrax.config.analytics_start_date},#{Time.zone.today}\"\n end",
"def date_approval=(date)\n super parse_date(date)\n end",
"def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? spent_on.cweek : nil\n end",
"def expires_on\n case self.current_state\n when :active then (self.last_renewal_on.to_time + self.length_in_issues.months).to_date\n end\n end",
"def acquired_on\n @object.most_recent_acquired_by_date.try(:strftime, '%-m/%-d/%Y')\n end",
"def invoice_created\n invoice_id = object['id']\n invoice_start = Time.at(object['period_start'].to_i)\n invoice_end = Time.at(object['period_end'].to_i)\n range = invoice_start..invoice_end\n user.bill_date_range_to_invoice(range, invoice_id)\n end",
"def all_dates\n return (@start_date...@end_date).to_a\n end",
"def event_start_end_dates\n esdate and eedate\n end",
"def mandrill_to\n if to\n to.each_with_index.map do |value,index|\n {\n 'email' => value,\n 'name' => self[:to].display_names[index]\n }\n end\n else\n []\n end\n end",
"def report_date\n order.completed_at.to_date\n end"
] |
[
"0.69593406",
"0.6751376",
"0.67212474",
"0.6312275",
"0.62085336",
"0.6140801",
"0.61147004",
"0.600482",
"0.59533244",
"0.57597077",
"0.5709655",
"0.5695636",
"0.56839246",
"0.56524444",
"0.5650989",
"0.5627358",
"0.5551082",
"0.5514058",
"0.54903793",
"0.5440202",
"0.54334575",
"0.5433327",
"0.542584",
"0.5415206",
"0.54126793",
"0.5404903",
"0.540441",
"0.54005986",
"0.5382631",
"0.5382053",
"0.53727907",
"0.5370319",
"0.536326",
"0.5355613",
"0.5352774",
"0.53489697",
"0.5335459",
"0.5335157",
"0.53325886",
"0.53325886",
"0.53325886",
"0.53325886",
"0.53325886",
"0.5315501",
"0.5307963",
"0.5291149",
"0.529101",
"0.5282427",
"0.5281287",
"0.5281287",
"0.5261357",
"0.52551264",
"0.52540594",
"0.52519",
"0.52498627",
"0.52451336",
"0.5238753",
"0.52281463",
"0.52246016",
"0.52105",
"0.5205341",
"0.5183326",
"0.5176687",
"0.5162012",
"0.51554364",
"0.5154442",
"0.5147662",
"0.5139016",
"0.51361275",
"0.51335174",
"0.5128014",
"0.5124103",
"0.50991535",
"0.5083411",
"0.5083411",
"0.5083411",
"0.50734854",
"0.50664186",
"0.5058727",
"0.50410956",
"0.5038321",
"0.5037702",
"0.5035979",
"0.50342774",
"0.50161034",
"0.50143737",
"0.49993017",
"0.49957448",
"0.49818587",
"0.49808568",
"0.49744534",
"0.49698895",
"0.49684542",
"0.49681595",
"0.4967245",
"0.49663562",
"0.49657935",
"0.49539977",
"0.49522933"
] |
0.6372782
|
4
|
generating service level segments
|
def generate_services
is_adjustment_line = @service.adjustment_line_is?
service_segments = []
service_segments << service_payment_information unless is_adjustment_line
service_segments << service_date_reference
unless is_adjustment_line
cas_segments, pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(@service, @client, @facility, @payer, @element_seperator, @eob, @batch, @check)
service_segments << cas_segments
else
pr_amount = 0.0
end
service_segments << service_line_item_control_num unless is_adjustment_line
service_segments << provider_control_number unless is_adjustment_line
supp_amount = supplemental_amount
service_segments << service_supplemental_amount(supp_amount) unless supp_amount.blank? || @service.amount('service_paid_amount').blank?
service_segments << patpay_specific_lq_segment if @facility.abbr_name == "RUMC"
service_segments << standard_industry_code_segments(@service)
[service_segments.compact.flatten, pr_amount]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def segments; end",
"def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end",
"def segments=(_arg0); end",
"def lists_and_segments\n response = get \"listsandsegments\", {}\n Hashie::Mash.new(response)\n end",
"def segment_0; segments[0]; end",
"def Segment\n A = 1\n B = 2\n C = 4\n D = 8\n E = 16\n F = 32\n G = 64\n H = 128\n J = 256\n K = 512\n M = 1024\n N = 2048\n P = 4096\n\n def initialize(segments=0)\n @segments = segments\n end\n\n def s(seg=Segment.new)\n Segment.new seg.segments + SOUTH\n end\nend",
"def list_service_segments(opts = {})\n data, _status_code, _headers = list_service_segments_with_http_info(opts)\n data\n end",
"def list_service_segments_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/segments/service-segments'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceSegmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi#list_service_segments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def street_segments\r\n\t\tstart_street_segments + end_street_segments\r\n\tend",
"def segmentpairs\n unless defined?(@segmentparis); parse_segmentpairs; end\n @segmentpairs\n end",
"def segmentpairs\n unless defined?(@segmentpairs); parse_segmentpairs; end\n @segmentpairs\n end",
"def list_service_segments_0(opts = {})\n data, _status_code, _headers = list_service_segments_0_with_http_info(opts)\n data\n end",
"def list_service_segments_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.list_service_segments_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/segments/service-segments'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceSegmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi#list_service_segments_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def base_route_segments\n table_name.to_s\n end",
"def segments\n if !@segments.present?\n @segments = path.split('/').select { |s| !s.empty? }\n else\n @segments\n end\n end",
"def services\n\n end",
"def services\n end",
"def services\n\tend",
"def segments\n if magic32?\n command(:LC_SEGMENT)\n else\n command(:LC_SEGMENT_64)\n end\n end",
"def segments\n Management::Segment.all(self)\n end",
"def service_payment_info_loop\n segments = []\n @clp_05_amount = 0\n eob.service_payment_eobs.each_with_index do |service, index|\n service_klass = Output835.class_for(\"Service\", facility)\n Output835.log.info \"Applying class #{service_klass}\" if index == 0\n service_obj = service_klass.new(service, facility, payer, index, @element_seperator) if service\n service_segments = service_obj.generate\n segments += service_segments[0]\n @clp_05_amount += service_segments[1]\n end\n segments\n end",
"def all\n segments_attrs = @connection.send_request('get_segments')['result']\n segments_attrs.map do |id, attrs|\n Segment.new(attrs.merge('id' => id))\n end\n end",
"def map_dynamic_segments(route)\n segments = route.to_s.split('/')\n segments.map! do |segment|\n if segment =~ /:/\n '.*'\n else\n segment\n end\n end\n\n segments.join('/')\n end",
"def segment(series, control, segment_align_usec=5_000_000)\n each_subseries_in series, control do |name, subseries|\n new_subseries = {}\n\n # rely on request timestamps provided in control - especially with counters,\n # there will be variable numbers of samples available so ranges will be inconsistent\n min_ts = control[:start_ts]\n max_ts = control[:end_ts]\n min_ts_seg = min_ts / segment_align_usec\n max_ts_seg = max_ts / segment_align_usec\n min_ts_seg_start = min_ts_seg * segment_align_usec\n\n # compute the number of segments\n range = max_ts - min_ts\n seg_count = max_ts_seg - min_ts_seg + 1\n\n # initialize the segments - all segments must exist in output\n 0.upto(seg_count-1).map do |seg|\n key = min_ts_seg_start + seg * segment_align_usec\n new_subseries[key] = { :timestamps => [], :values => [] }\n end\n\n # move the individual entries into segments ready for rollups\n seg_ts = min_ts_seg_start\n subseries.keys.sort.each do |ts|\n # advance to the next bin if necessary\n until ts.between?(seg_ts, seg_ts + segment_align_usec - 1) do\n seg_ts = seg_ts + segment_align_usec\n end\n\n # compute_rollups requires two arrays, timestamps & values\n new_subseries[seg_ts][:timestamps] << ts\n new_subseries[seg_ts][:values] << subseries[ts]\n end\n\n # now use the rollup function to generate all of the useful aggregations\n new_subseries.keys.each do |seg_ts|\n new_subseries[seg_ts] = compute_rollups(\n new_subseries[seg_ts][:timestamps],\n new_subseries[seg_ts][:values],\n segment_align_usec, seg_ts, (seg_ts + segment_align_usec - 1)\n )\n end\n\n new_subseries\n end\n end",
"def gather_segs(fh)\n\t\t(0...@nsegs).each do |segnum|\n\t\t\tname, loc, size, type = getl(fh).split(' ')\n\t\t\t\t\t\n\t\t\t@segrecs[segnum] = build_segrec(segnum, name, loc.hex, size.hex, type)\n\t\t\t@segnames[name] = segnum\n\t\tend\n\tend",
"def segment_ends_s\n [from_end.to_s, to_end.to_s].join(\"---\")\n end",
"def segment_ends_s\n [from_end.to_s, to_end.to_s].join(\"---\")\n end",
"def mksegments(table)\n disjoint, = table.basis(table.instructions)\n remaining = Set.new(table.instructions)\n segment_id = table.instructions.head.segment_use.id\n segments = []\n\n # Scan each interesting element location\n disjoint.each do |(m, n), map|\n if remaining.empty?\n # We've already generated results for each possible instruction\n break\n end\n\n # Likely many values are mapped to only a few unique keys; in this\n # case, `instructions` is a singleton array (that's what makes the\n # value non-ambiguous, there's only one possible instruction)\n map.each do |value, instructions|\n op, = instructions\n repeatable = op.segment_use.definition.element_uses.at(m).repeatable?\n elements = Array.new(m)\n elements[m] =\n if n.nil?\n if repeatable\n repeated(value)\n else\n value\n end\n else\n components = Array.new(n)\n components[n] = value\n\n if repeatable\n repeated(composite(components))\n else\n composite(components)\n end\n end\n\n if remaining.member?(op)\n remaining.delete(op)\n segments.push([op, mksegment_tok(@reader.segment_dict, segment_id, elements, nil)])\n end\n end\n end\n\n segments\n end",
"def remove_namespaces_from_segments(segments)\n namespaces = controller_path.sub(controller_name,'').sub(/\\/$/,'').split('/')\n while namespaces.size > 0\n if segments[0].is_a?(ActionController::Routing::DividerSegment) && segments[1].is_a?(ActionController::Routing::StaticSegment) && segments[1].value == namespaces.first\n segments.shift; segments.shift # shift the '/' & 'namespace' segments\n update_name_prefix(\"#{namespaces.shift}_\")\n else\n break\n end\n end\n segments\n end",
"def segment(segment)\n { segment: segment }\n end",
"def details\n response = @create_send.get \"/segments/#{segment_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def endpoints; end",
"def to_s\n segments.inject('') do |str,seg|\n str << (seg.is_a?(Symbol) ? \":#{seg}\" : seg)\n end\n end",
"def get_contact_segments(id)\n return make_request(\"#{self.endpoint}/#{id}/segments\")\n end",
"def base_path\n super.concat '/services'\n end",
"def dynamic_segment\n raise(NotImplementedError)\n end",
"def details\n response = cs_get \"/segments/#{segment_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def segment_names_a\n [from.value, to.value]\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def sequence_segments(base=nil)\n last = nil\n segs = @segments\n segs = base.children if base\n\n segs.each do |s|\n if s.kind_of?( last.class ) && s.respond_to?( :set_id )\n last.set_id = 1 unless last.set_id && last.set_id.to_i > 0\n s.set_id = last.set_id.to_i + 1\n end\n\n sequence_segments( s ) if s.has_children?\n\n last = s\n end\n end",
"def starred_segments(options = {}, &block)\n paginate 'segments/starred', options, Strava::Models::Segment, &block\n end",
"def make_segment_array(segment_hash, segment)\n merged_hash = nil\n segment_variable = segment.to_s.split('_').first\n if !segment_hash.blank?\n # This is to insert '#' to the segment option for which size hash is defined\n eval(\" if @#{segment_variable}[:size]\n @#{segment_variable}[:size].each do |key, value|\n segment_hash[key] += \\\"#\\#{value}\\\" if segment_hash[key]\n end\n end\n merged_hash = segment_hash.merge(@#{segment_variable})\")\n end\n if !merged_hash.blank?\n merged_hash.delete(:size)\n segment_array = merged_hash.segmentize.to_string\n end\n end",
"def make_segment_array(segment_hash, segment)\n merged_hash = nil\n segment_var = segment.to_s.split('_').first\n eval(\"merged_hash = segment_hash.merge(@#{segment_var})\")\n segment_array = merged_hash.segmentize.to_string\n end",
"def segment(id_or_options, options = {})\n id, options = parse_args(id_or_options, options)\n Strava::Models::Segment.new(get(\"segments/#{id}\", options))\n end",
"def build_path(from, to)\n PathSegment.get_all(\"FromStationCode\" => from, \"ToStationCode\" => to)\n end",
"def split_segments(data)\n pos = 0\n segments = []\n segments.append(data[pos...pos += RECORD_SIZE]) while pos < data.length\n segments\n end",
"def generate_and_stream_segments\n NewRelic::Agent::InfiniteTracing::Client.any_instance.stubs(:handle_close).returns(nil)\n unstub_reconnection\n server_context = nil\n with_config fake_server_config do\n # Suppresses intermittent fails from server not ready to accept streaming\n # (the retry loop goes _much_ faster)\n Connection.instance.stubs(:retry_connection_period).returns(0.01)\n nr_freeze_time\n nr_freeze_process_time\n\n simulate_connect_to_collector fake_server_config do |simulator|\n # starts server and simulated agent connection\n server_context = ServerContext.new FAKE_SERVER_PORT, InfiniteTracer\n simulator.join\n\n yield\n\n # ensures all segments consumed\n NewRelic::Agent.agent.infinite_tracer.flush\n server_context.flush\n server_context.stop\n\n return server_context.spans\n ensure\n Connection.instance.unstub(:retry_connection_period)\n NewRelic::Agent.agent.infinite_tracer.stop\n server_context.stop unless server_context.nil?\n reset_infinite_tracer\n nr_unfreeze_time\n nr_unfreeze_process_time\n end\n end\n end",
"def qualified_segments\n @qualified_segment_mutex.synchronize { @qualified_segments.clone }\n end",
"def enclosing_segments\n segments = remove_namespaces_from_segments(recognized_route.segments.dup)\n while segments.size > 0\n segment = segments.pop\n return segments if segment.is_a?(::ActionController::Routing::StaticSegment) && segment.value == resource_specification.segment\n end\n ResourcesController.raise_missing_segment(self)\n end",
"def route_sets; end",
"def segment_count\n @segments.length\n end",
"def to_endpoint id\n t=id.split('/')\n domain = t[1..-2].join('_')\n type = t[-1]\n \"freebase_tsv_#{domain}__#{type}\"\nend",
"def list_all_infra_segments_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/segments'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'SegmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsSegmentsApi#list_all_infra_segments_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def format_service\n\n end",
"def list_all_infra_segments_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivitySegmentsSegmentsApi.list_all_infra_segments, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/segments'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'SegmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsSegmentsApi#list_all_infra_segments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def slice_path_for(type, *segments)\n ::ChefServerSlice.slice_path_for(type, *segments)\n end",
"def init_with_segment(segments)\n raise \"No segments\" if segments.empty?\n @segments = segments\n @start_point = segments.first.start_point\n @svg_subpath = Savage::SubPath.new(start_point.x, start_point.y)\n @svg_subpath.directions.concat(segments.map(&:direction))\n self\n end",
"def segment(index)\n \traise NotImplementedError\n end",
"def main_services\n main_co.services\n end",
"def segments(progress = nil)\n @options[:split_across] ? segments_across(progress) :\n segments_within(progress)\n end",
"def add_segment_parameters( params )\n return unless builder\n params.each { |k,v| builder.current_segment[k] = v }\n end",
"def segment(project_id, key_id, language_iso, segment_number, req_params = {})\n params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }\n\n data = endpoint(name: 'Segments', params: params).do_get\n\n resource 'Segment', data\n end",
"def base_path\n super.concat \"/services/#{@service['id']}/service_plans\"\n end",
"def index\n @api_v1_social_link_segments = Api::V1::SocialLinkSegment.all\n end",
"def each # :yields: segment\n return unless @segments\n @segments.each { |s| yield s }\n end",
"def route_enclosing_names\n @route_enclosing_names ||= returning(Array.new) do |req|\n enclosing_segments.each do |segment|\n unless segment.is_optional or segment.is_a?(::ActionController::Routing::DividerSegment)\n req << [segment.value, true] if segment.is_a?(::ActionController::Routing::StaticSegment)\n req.last[1] = false if segment.is_a?(::ActionController::Routing::DynamicSegment)\n end\n end\n end\n end",
"def service_name; end",
"def index\n @customer_segments = CustomerSegment.all\n end",
"def slice_path_for(type, *segments)\n ::StaticSlice.slice_path_for(type, *segments)\n end",
"def get_all_segment_ids\n allsegs = get_all_segments\n segs = JSON.parse(allsegs)\n # make an array of ids\n return segs['segments'].map {|k,v| k['id']}\n end",
"def live_segmentations\n segmentations = Array.new\n \n segment = self.segments.new\n \n segmentations << segment.script(\"SELECT * FROM [$$brand_code$$_WeeklyCampaign] WHERE campaign_id = $$campaign_id$$\")\n segmentations << segment.script(\"SELECT * FROM [$$brand_code$$_Whole] Whole WHERE NOT EXISTS ( SELECT * FROM [$$brand_code$$_UNSUBS] Unsubs WHERE Unsubs.email_address = Whole.email_address ) AND NOT EXISTS ( SELECT * FROM ent.[ET_UNSUB] GlobalUnsubs WHERE GlobalUnsubs.email_address = Whole.email_address )\")\n \n versions.each do |v|\n list = (v.audience_list.split(',').collect { |a| \"'\" + a.lstrip + \"'\" }).join(', ')\n segmentations << segment.script(\"SELECT * FROM [$$treatment_name$$_WAU] WHERE email_version IN (#{list})\") \n end\n \n segmentations;\n end",
"def list_vs_services(options)\n options['method'] = \"vs\"\n dir_list = get_dir_item_list(options)\n message = \"vSphere Services:\"\n handle_output(options,message)\n dir_list.each do |service|\n handle_output(options,service)\n end\n handle_output(options,\"\")\n return\nend",
"def to_s\n \"in segment #{@whitelist}\"\n end",
"def to_s\n\n output = \"\"\n\n path = \"/\" + @prefix.join('/')\n @endpoints.each do |route|\n output += \"#{route[:method].to_s.upcase} #{path}\\n\"\n end\n @subroutes.each do |k, subroute|\n output += subroute.to_s\n end\n\n output\n\n end",
"def create_service_segment_0_with_http_info(service_segment_id, service_segment, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.create_service_segment_0 ...'\n end\n # verify the required parameter 'service_segment_id' is set\n if @api_client.config.client_side_validation && service_segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_segment_id' when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.create_service_segment_0\"\n end\n # verify the required parameter 'service_segment' is set\n if @api_client.config.client_side_validation && service_segment.nil?\n fail ArgumentError, \"Missing the required parameter 'service_segment' when calling PolicyNetworkingConnectivitySegmentsServiceSegmentsApi.create_service_segment_0\"\n end\n # resource path\n local_var_path = '/global-infra/segments/service-segments/{service-segment-id}'.sub('{' + 'service-segment-id' + '}', service_segment_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(service_segment)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'ServiceSegment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsServiceSegmentsApi#create_service_segment_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @segments = @stage.all\n end",
"def prepare_service(parameter)\n return @service_path % parameter\n end",
"def segment\n pre_process\n process\n post_process\n end",
"def segment_lengths\n ordered_segments.collect{|s| s.length}\n end",
"def base_path\n super.concat \"/services/#{@service['id']}/metrics/#{@metric['id']}/methods\"\n end",
"def create\n @segment = @segmentation_variable.segments.create(params[:segment])\n\n respond_to do |format|\n if @segment.save\n format.html { redirect_to @segmentation_variable, notice: t2('create.notice')}\n format.json { render json: @segment, status: :created, location: @segment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @segment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def san_paths\n san_array_node = self.sans.first.san_array_node\n return [] if san_array_node.nil?\n x = san_array_node.san_interfaces\n return [] if x.length < 1\n xx = x.enum_slice((x.length / 2)).to_a \n # permitation of san controllers\n san_port_array = xx.first.zip(xx.last).flatten(1)\n san_interfaces.map{|saniface| [saniface.first, \n san_port_array[saniface.last.split('.').last.to_i % san_port_array.length].last] }\n end",
"def build_segrec(num, name, loc, size, type, data=nil)\n\t\tseg = Hash.new\n\t\t\n\t\tseg[:segno] = num\n\t\tseg[:name] = name\n\t\tseg[:loc] = loc\n\t\tseg[:size] = size\n\t\tseg[:type] = type\n\t\tseg[:data] = data unless data == nil\n\t\treturn seg\n\tend",
"def services_walk\n\t\tprint_status('Enumerating Running Services.....')\n\t\tservices=[['Running Services']]\n\t\t@manager.walk('enterprises.77.1.2.3.1.1') { |x| services << [\"#{x.value}\"] }\n\t\tif services.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\ttable = services.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend",
"def index\n @api_v1_group_messages_segments = Api::V1::GroupMessagesSegment.all\n end",
"def service; end",
"def create_tags(services, current_user)\n services.each{ |service|\n provider = service.providers.first if service.providers.length == 1\n group_name, name = service.latest_version.service_versionified.wsdl_location.split('/')[-1].split('.')\n create_annotations([{'tag' =>'soaplab'}, {'tag'=> group_name}, {'display_name'=> name.split('?')[0]}], provider, service )\n } \n end",
"def net_services\n svc = []\n# svc = cluster_configurations.map{ |cc| cc.net_service(self.node_type.node_type) }\n clusters.each do |cc| \n cc.services.each {|s|\n svc << [s.ha_ip_address , s.ha_port ,\n s.ha_proto, s.localport,\n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n }\n svc << [nil, nil,'icmp', nil, \n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n end\n #puts \"DEBUG:#{hostname}: #{svc.inspect}\" if is_load_balancer? \n if is_server? then \n svc2 = []\n svc.each { |s| \n svc2 << [\"\",\"\",s[2],s[3], mangle(s[4])]\n svc2 << [\"\",\"\",s[2],s[3], s[4]]\n }\n #puts \"DEBUG:#{hostname}: #{svc2.inspect}\" if is_load_balancer? \n svc.concat(svc2)\n end\n # will be wrong for virutal with SANs\n san = san_nics.map { |nic| [nil, nil, 'tcp', 22, nic.port_name] }\n svc.concat(san)\n if node_type.is_loadbalancer?\n ha_svc = ClusterConfiguration.find_all_ha_net_services\n svc.concat(ha_svc)\n # For Testing only - Delete after Feb 28, 2009 or come up with\n # something better\n test_vlans = Cluster.find(:all, :conditions => [\"vlan <= 102 and vlan > 8\"]).map{|c| c.vlan }\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'tcp',22, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'icmp',nil, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n end\n # Icmp for application vlans\n if node_type.is_virtual?\n icmp = nics.map { |nic| \n [nil,nil,'icmp',nil, nic.port_name] if nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(icmp)\n nginx = nics.map { |nic| \n [nil,nil,'tcp', 80, nic.port_name] if nic.lan? and nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(nginx)\n end\n if hostname == 'uk01' then\n svc << [nil,nil,'tcp',11301,'eth4000']\n end\n rules = svc.map{|a| a.join(':') }\n if mgmt_ip_address then\n rules.concat( mgmt_ip_address.network.net_service(net_type) )\n end\n rules.map{|a| %Q(\\t\"#{a}\") }.sort.uniq.join(\"\\n\")\n end",
"def generate_lvs_cluster(c)\n svc = c.services.map { |s|\n [s.name, \"#{s.ha_protocol}://\", s.ha_hostname, s.localport ].join(', ') \n }\n [dec2ip(c.fw_mark), c.description, svc.map { |s| \"(#{ s })\" }.join('; ') ]\nend",
"def registered_services\n ENDPOINT_INSTANCES.keys\n end",
"def create_services_for_env(services=[])\n whitelist = ['name', 'label', 'plan', 'tags', 'plan_option', 'credentials']\n svcs_hash = {}\n services.each do |svc|\n svcs_hash[svc['label']] ||= []\n svc_hash = {}\n whitelist.each {|k| svc_hash[k] = svc[k] if svc[k]}\n svcs_hash[svc['label']] << svc_hash\n end\n svcs_hash.to_json\n end",
"def initialize_segments\n\t\t\t@line \t= Segment.new(self, 0, 0)\n\t\t\t@word = Segment.new(self, 0, 0)\n\t\t\t@selection = Segment.new(self, 0, 0)\n\t\tend",
"def dot_service( shortname )\n shortname + \".service\"\n end",
"def service_areas\n areas_zips = {}\n areas_city = {}\n areas_state = {}\n self.zipcodes.each do |zip|\n areas_zips[\"#{zip.city}#{zip.state}\"] = \"#{zip.zipcode} #{areas_zips[\"#{zip.city}#{zip.state}\"]}\"\n areas_city[\"#{zip.city}#{zip.state}\"] = zip.city \n areas_state[\"#{zip.city}#{zip.state}\"] = zip.state\n end\n\n # then assemble the string by traversing each city-state key\n service_areas = []\n areas_zips.keys.each do |key|\n service_areas << \"#{areas_city[key]}, #{areas_state[key]}: #{areas_zips[key]}\"\n end\n service_areas.join(\"; \")\n\n end",
"def __endpoint_parts\n parts = @spec['url']['paths'].select do |a|\n a.keys.include?('parts')\n end.map do |path|\n path&.[]('parts')\n end\n (parts.inject(&:merge) || [])\n end",
"def routes_map; end",
"def path_segments(path, segments = [])\n if path == '/'\n return segments\n else\n prefix, _ = File.split(path)\n return path_segments(prefix, [path] + segments)\n end\n end",
"def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] unless match.pre_match.empty?\n segments << match[2].intern\n path = strip[match.post_match]\n end\n segments << strip[path] unless path.empty?\n segments\n end"
] |
[
"0.75312275",
"0.6523971",
"0.64782524",
"0.64646417",
"0.6244528",
"0.6126322",
"0.60918397",
"0.60620755",
"0.605204",
"0.60224414",
"0.5968079",
"0.5942922",
"0.5928583",
"0.59226626",
"0.5916483",
"0.58785135",
"0.57835704",
"0.57679874",
"0.5737053",
"0.570221",
"0.5688339",
"0.56764066",
"0.56749904",
"0.5663322",
"0.5629673",
"0.5625025",
"0.56235874",
"0.56235874",
"0.5594233",
"0.5568218",
"0.5536262",
"0.55237126",
"0.55189985",
"0.5513054",
"0.55023193",
"0.545968",
"0.54523885",
"0.5426248",
"0.54196024",
"0.53780204",
"0.53780204",
"0.5375997",
"0.5365676",
"0.5349847",
"0.5315171",
"0.52885675",
"0.5288539",
"0.5280707",
"0.52757096",
"0.52550536",
"0.5241653",
"0.52242607",
"0.52182126",
"0.52096283",
"0.51914185",
"0.5190305",
"0.5180374",
"0.5177105",
"0.51754516",
"0.51749873",
"0.51729375",
"0.5170557",
"0.51703674",
"0.51701206",
"0.51618683",
"0.5161532",
"0.5160644",
"0.5158426",
"0.51576614",
"0.51451325",
"0.51427126",
"0.5139125",
"0.51276934",
"0.51264846",
"0.51083946",
"0.5075688",
"0.5062767",
"0.50567424",
"0.5055945",
"0.5031917",
"0.50240445",
"0.50204164",
"0.5016456",
"0.5012826",
"0.5011335",
"0.50023824",
"0.5000338",
"0.49977177",
"0.49968168",
"0.49930304",
"0.49882984",
"0.49864832",
"0.49856898",
"0.4983417",
"0.4977431",
"0.49730736",
"0.49696255",
"0.4967182",
"0.49648887",
"0.496302"
] |
0.70039004
|
1
|
supplies payment and control information to a provider for a particular service
|
def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)
@service = @service.nil?? service : @service
['SVC', composite_med_proc_id, @service.amount('service_procedure_charge_amount'), @service.amount('service_paid_amount'),
svc_revenue_code, @service.service_quantity.to_f.to_amount, svc_procedure_cpt_code].trim_segment.join(@element_seperator )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def service_payment_info_loop\n end",
"def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)\n @eob = @eob.nil?? eob : @eob\n @service = @service.nil?? service : @service\n ['SVC', \"RX:#{captured_or_blank_patient_account_number(@eob.patient_account_number)}\", @service.amount('service_procedure_charge_amount'),\n (@service.amount('service_paid_amount') == 0 ? \"\" : @service.amount('service_paid_amount'))].trim_segment.join(@element_seperator )\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << revenue_code\n service_payment_elements.join(@element_seperator )\n end",
"def choose_service_provider\n #validate permissions\n return unless permitted_for_user_type?(Client)\n # Retrieve service request\n return unless get_service_request?\n render_not_found \"service with id #{service.id} not found\" and return unless (service = @service_request.service)\n # validate ownership on this service\n render_forbidden \"you are not the client of this service request\" and return unless service.client_id == @current_user.id\n # Validate service request is approved\n render_forbidden \"service request with id #{@service_request.id} was not approved by service provider with id #{@service_request.service_provider.id}\" and return unless (@service_request.approved?)\n\n # Set service provider\n service.service_provider = @service_request.service_provider\n # Confirm service\n service.confirmed!\n #handle save\n render_unprocessable_entity \"couldn't save\" and return false unless service.save\n # Delete all other related requests\n ServiceRequest.delete_all(service: service)\n # Render success\n render_success\n\n # notify service provider\n NotificationsService.send_notification(@current_user, service_provider, NOTIFICATION_TYPE[:confirmed_you_as_provider], service.id)\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end",
"def process_payment!\n @payment_type.pay\n end",
"def confirm\n if @account.offload_billing?\n @current_subscription = @account.stripe_subscription.current_subscription\n end\n\n case @service\n when 'vps', 'vps_with_os'\n plan = params[:plan]\n plan_struct = VirtualMachine.plans['vps'][plan]\n\n @billing_amount = plan_struct['mrc']\n @code = 'VPS'\n @code_obj = ServiceCode.find_by(name: @code)\n\n @service_title = if @service == 'vps_with_os'\n VirtualMachine.os_display_name_from_code($CLOUD_OS, params[:os]) + ' VPS'\n else\n 'Generic VM'\n end\n\n @billing_amount_pro_rated = pro_rated_total(@billing_amount)\n\n @stripe_price_id = @account.offload_billing? ? $STRIPE_PRODUCTS['vps'][plan] : \"\"\n\n @pending_service = @account.services.create(\n pending: true,\n service_code: @code_obj,\n title: @service_title,\n billing_interval: 1,\n billing_amount: @billing_amount,\n stripe_price_id: @stripe_price_id\n )\n\n unless @account.offload_billing?\n @pending_invoice = @account.create_pro_rated_invoice!(\n @code, @service_title, @billing_amount_pro_rated, pending: true\n )\n end\n when 'metal'\n raise\n when 'thunder'\n raise\n when 'bgp'\n @billing_amount = 10.00\n @code = 'BANDWIDTH'\n @code_obj = ServiceCode.find_by(name: @code)\n @service_title = \"BGP Session (ASN #{params[:asn]})\"\n @billing_amount_pro_rated = pro_rated_total(@billing_amount)\n\n @stripe_price_id = @account.offload_billing? ? $STRIPE_PRODUCTS['bgp'] : \"\"\n\n @pending_service = @account.services.create(\n pending: true,\n service_code: @code_obj,\n title: @service_title,\n billing_interval: 1,\n billing_amount: @billing_amount,\n stripe_price_id: @stripe_price_id,\n description: \"Pending provisioning by ARP Networks staff.\\n\\nWe thank you for your patience!\"\n )\n\n unless @account.offload_billing?\n @pending_invoice = @account.create_pro_rated_invoice!(\n @code, @service_title, @billing_amount_pro_rated, pending: true\n )\n end\n when 'backup'\n raise\n end\n\n @services = [@pending_service].compact\n @invoices = [@pending_invoice].compact\n\n @enable_pending_view = true\n\n session[:service_to_enable] = @service\n session[:pending_service_ids] = @services.map(&:id)\n session[:pending_invoice_ids] = @invoices.map(&:id)\n end",
"def insert_payment_method\n authorize current_employer\n @customer = Customer.new(customer_params)\n pay_service = Services::Pay.new(current_employer, nil, @customer.stripe_card_token)\n\n if pay_service.is_customer_saved?\n redirect_to employers_payment_methods_path,\n notice: 'You have successfully added your payment information!'\n else\n redirect_to employers_payment_verify_path, alert: \"There was an error processing your card. Contact support.\"\n end\n end",
"def create\n @order = Order.new(order_params)\n @service = Service.find(params[:service_id])\n @seller = @service.userID\n\n @order.service_id = @service.id\n @order.buyer_id = current_user.id\n @order.seller_id = @seller\n\n PinPayment.secret_key = 'CRuWFFtjN2m3djtcNB439A'\n card_token = params[:card_token]\n number = params[:number]\n name = params[:name]\n expiry_year = params[:expiry_year]\n expiry_month = params[:expiry_month]\n cvc = params[:cvc]\n\n charge = PinPayment::Charge.create(\n email: current_user.email,\n description: @service.description,\n amount: (@service.price * 100).floor,\n currency: 'AUD',\n ip_address: request.remote_ip,\n card: {\n number: number,\n expiry_month: expiry_month,\n expiry_year: expiry_year,\n cvc: cvc,\n name: current_user.name,\n }\n ) \n\n if charge.success?\n alert (\"yo success\")\n end\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_url, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider_payment\n @provider_payment = ProviderPayment.find(params[:id])\n end",
"def create\n @provider_payment = ProviderPayment.new(provider_payment_params)\n\n respond_to do |format|\n if @provider_payment.save\n @provider_payment.provider.update(status: @provider_payment.provider.set_status)\n\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully created.' }\n format.json { render :show, status: :created, location: @provider_payment }\n else\n format.html { render :new }\n format.json { render json: @provider_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pay!\n #soap_server = VendorPayment.generate_soap_server\n #token = VendorPayment.generate_usa_epay_security_token\n #custNum = observed.vendor_payment_period.store.id\n #paymentMethodID = nil\n #parameters = generate_transaction_request\n #response = soap_server.runCustomerTransaction(token, custNum, paymentMethodID, parameters)\n #\n if self.vendor_payment_period.store.usa_epay_customer_number.blank?\n self.errors['usa_epay_customer_number'] = \"The USA ePay custNum must be set before a payment can be made.\"\n return\n end\n gateway = VendorPayment.gateway\n payment_methods_response = gateway.get_customer_payment_methods(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number)\n monthly_transfer_method = nil\n items = if payment_methods_response.params['get_customer_payment_methods_return']\n payment_methods_response.params['get_customer_payment_methods_return']['item']\n else\n []\n end\n \n if items.is_a?(Hash)\n items = [items]\n end\n \n items.each do |payment_method|\n if payment_method['method_name'].strip == 'Monthly ACH Transfer'\n monthly_transfer_method = payment_method\n end\n end\n \n if monthly_transfer_method\n response = gateway.run_customer_transaction(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number,\n :command => 'CheckCredit',\n # USA ePay does pennies for the amount, so it needs to be\n # multiplied by 100\n :payment_method_id => monthly_transfer_method['method_id'],\n :amount => self.amount * 100)\n \n \n self.state = if response.message['result_code'].strip == 'A'\n VendorPayment.status_codes[response.message['status_code']]\n else\n VendorPayment.status_codes[\"E\"]\n end\n self.response_data = YAML::dump(response)\n if !response.message['ref_num'].blank?\n self.response_code = response.message['ref_num']\n save\n else\n save\n self.errors['transaction'] = \"State: #{self.state}. There was an error with code #{response.message['error_code']}, while trying to make the payment. Check USA ePay for reference number #{response.message['ref_num']} if necessary.\\n\\nFull Message: #{response.message.inspect}\"\n end\n self.vendor_payment_period.update_payment_total!\n self.vendor_payment_period.update_state!\n else\n self.errors['payment_method'] = \"There is no payment method on the vendor called 'Monthly ACH Transfer'\"\n end\n end",
"def set_payment_provider\n @payment_provider = PaymentProvider.find(params[:id])\n end",
"def service_provider_params\n params.require(:service_provider).permit(:rate_cents, :currency, :name)\n end",
"def payment_instruction\n end",
"def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end",
"def add_payment_method\n authorize(current_employer)\n @customer = Customer.new\n end",
"def onsite_pay_choose\n @p = PaymentPresenter.new\n\n params[:registrant_id].each do |reg_id|\n reg = Registrant.find(reg_id)\n @p.add_registrant(reg)\n end\n end",
"def service_ppp!()\n @service = TAC_PLUS_AUTHEN_SVC_PPP\n end",
"def provider_service_params\n params.require(:provider_service).permit(:service_provider_id, :service_id, :comment, :entity_id, :user_id, :active_status, :change_status)\n end",
"def new_service(service)\n \tOrder.new(\n \t\torderNumber: 37592,\n \t\tservice: service,\n\t\t\torderType: \"установка розетки\",\n\t\t\tnameOrFIO: \"Нибелунг Зигфрид Беовульфыч\",\n\t\t\tstreet: \"бул. Амурский\",\n\t\t\thouse: 10,\n\t\t\tresponsiblePerson: \"Витя Кабан\",\n\t\t\tpersonType: \"Физ лицо\",\n\t\t\tformingDate: \"2013-11-13\")\n end",
"def create\n @payment_provider = PaymentProvider.new(payment_provider_params)\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully created.' }\n format.json { render :show, status: :created, location: @payment_provider }\n else\n format.html { render :new }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_providerservice\n @providerservice = Providerservice.find(params[:id])\n end",
"def initialize\n @payment_method_service = SpreeQuickbooks::Services::PaymentMethod.new({})\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def set_provider_service\n @provider_service = ProviderService.find(params[:id])\n end",
"def spAdd\n provider_name = $prompt.ask('Provider Name:')\n provider_phone = $prompt.ask('Provider Phone Number:')\n $all_sp.push(ServiceProvider.new(provider_name, provider_phone, [], {}, []))\n successPrint()\n end",
"def register_payout_details(person)\n # nothing to do by default\n end",
"def pay_slip\n \n end",
"def read_service_payments\r\n read_service_payment while peek == 'SVC'\r\n self\r\n end",
"def create\n @payment_provider = PaymentProvider.new(params[:payment_provider])\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully created.' }\n format.json { render json: @payment_provider, status: :created, location: @payment_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_first_payment\n make_payment\n end",
"def pay(payment)\n retval\n end",
"def add_payment_info(key, value) \r\n dispatch('7', key, value) \r\n @message = \"Failed to add Payment data : #{key} : #{value}\" unless @no_error\r\n end",
"def provider_class\n ActiveMerchant::Billing::Integrations::Sermepa\n end",
"def set_payment_form\n @payment_form = @paymentService.find(params[:id])\n end",
"def merchant_end_point; end",
"def service_provider_params\n params.require(:service_provider).permit(:name, :name_abreviation, :contact_email, :contact_name)\n end",
"def valitation\n # Create a payment and send ID\n end",
"def postContractPaymentSetup( contract_id, payment_provider_id, payment_provider_profile, user_name, user_surname, user_billing_address, user_email_address)\n params = Hash.new\n params['contract_id'] = contract_id\n params['payment_provider_id'] = payment_provider_id\n params['payment_provider_profile'] = payment_provider_profile\n params['user_name'] = user_name\n params['user_surname'] = user_surname\n params['user_billing_address'] = user_billing_address\n params['user_email_address'] = user_email_address\n return doCurl(\"post\",\"/contract/payment/setup\",params)\n end",
"def save_with_payment\n if valid? # We did added some validation to make sure user filled in properly ::contact.rb\n # After Stripe get this info, Stripe will do the charging, this method comes from Stripe gem\n # Stripe will return an id after charging\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token) # Stripe had upgrade their API from card: -> source:\n # Set a property to the user after received the id Stripe returned(stripe will return customer hash)\n # 'self' means the target of this function, in this case is User, and we set a new atribute stripe_customer_token to User. \n self.stripe_customer_token = customer.id # Setting stripe_customer_token to Stripe::customer.id \n save!\n end\n \n end",
"def service_pt!()\n @service = TAC_PLUS_AUTHEN_SVC_PT\n end",
"def pay_status_paypal\n\n end",
"def add_payment_details(post, amount, payment, options)\n txn = {\n 'donationAmt': amount(amount),\n 'recurrpay': empty?(options[:recurrfreq]) ? 'N' : 'Y',\n 'recurrfreq': options[:recurrfreq],\n 'othamt4': options[:othamt4]\n }\n payment_details =\n if payment.respond_to?(:routing_number)\n { 'paymenttype': options[:payment_type].presence || 'ACH' }\n else\n options = {\n 'paymenttype': CARD_BRAND[payment.brand.to_sym],\n 'ccnumber': payment.number,\n 'ccexpire':\n \"#{format(payment.month, :two_digits)}#{format(payment.year, :two_digits)}\"\n }\n if payment.verification_value\n options['ccvv'] = payment.verification_value\n end\n options\n end\n\n # if we are processing a creditcard payment, we need to insert\n # the cardholder name in the supporter hash\n unless payment.respond_to?(:routing_number)\n post['supporter'].merge!('Credit Card Holder Name': payment.name)\n end\n post['transaction'] =\n txn.merge(payment_details).delete_if { |_, v| v.blank? }\n end",
"def place_settlement\n @invoice = Invoice.find(params[:invoice_id])\n\n #check settlment parms\n #create a new invoice_items describing the payment via cc or something\n @invoice.charge params[:amount], params[:payment_method], params[:note]\n\n flash[:notice] = \"Settlement Placed\"\n render \"settlement\"\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_providers_payment_type\n @providers_payment_type = Providers::PaymentType.find(params[:id])\n end",
"def payment\n {\n :credit_card => credit_card\n }\n end",
"def process_add!(result)\n self.payment = OrderPayment.new(\n :name => result.credit_card.name,\n :number => result.credit_card.number,\n :expiration_month => result.credit_card.expiration_month,\n :expiration_year => result.credit_card.expiration_year,\n :provider_name => IslayShop::Engine.config.payments.provider,\n :provider_token => result.transaction.id,\n :status => result.transaction.status,\n :card_type => result.credit_card.card_type\n )\n\n skus = Hash[*sku_items.map {|i| [i.sku_id, i.quantity]}.flatten]\n Sku.purchase_stock!(skus)\n next!(\"Authorizing #{formatted_total}\")\n end",
"def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_with_payment\n #this will have to change when using cart instead of purchasing each book individually\n #if valid? \n @book = Book.find(self.book_id)\n @purchaser = User.find(self.user_id)\n self.pricesold = @book.price\n self.authorcut = ((@book.price * 80).to_i).to_f/100 #this calc may be different for different products & different currencies. It's an important part of the CrowdPublishTV business model. Perhaps it should be somewhere more prominent\n self.author_id = @book.user_id #do I need to save this in purchase incase bookauthor changes?\n author = User.find(@book.user_id) #but what if purchase consisted of items from several authors\n authoraccount = Stripe::Account.retrieve(author.stripeid) \n\n if(@purchaser.stripe_customer_token) \n customer_id = @purchaser.stripe_customer_token\n customer = Stripe::Customer.retrieve(customer_id)\n #card = customer.sources.create(:source => stripe_card_token) #I think this is only if existing/previous customer wants to enter new card\n else #if valid?\n customer = Stripe::Customer.create(\n :source => stripe_card_token,\n :description => @purchaser.name, # what info do I really want here\n :email => @purchaser.email\n )\n @purchaser.update_attribute(:stripe_customer_token, customer.id)\n end\n card_id = customer.default_source\n cardtoken = Stripe::Token.create(\n {:customer => customer.id, :card => card_id},\n {:stripe_account => authoraccount.id } # id of the connected account\n )\n charge = Stripe::Charge.create( {\n :amount => (@book.price * 100).to_i, #this is the amt charged to the customer's credit card\n :currency => \"usd\",\n# :customer => customer_id,\n :source => cardtoken,\n :description => @book.title, # what info do I really want here \n :application_fee => ((@book.price - self.authorcut)*100).to_i #how much crowdpublishtv keeps: crowdpublishtv is charged a fee by stripe, so must keep more than that fee\n },\n {:stripe_account => authoraccount.id }\n )\n save!\n\n rescue Stripe::InvalidRequestError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n errors.add :base, \"There was a problem with your credit card.\"\n false\n \n end",
"def purchase\n if express_token.include?(\"paykey=AP\")\n\n else\n\n #processes payment for express payment and on site with credit card.\n response = process_purchase\n #creates a transaction to store info from express payment and paywith Credit card\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end\n end",
"def authorize(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('RES', post)\n end",
"def service_params\n params.require(:service).permit(:customer_id, :process, :code, :reclaimed, :authorized, :difference)\n end",
"def read_claim_payment\r\n read_claim_info.read_service_payments\r\n self\r\n end",
"def providerservice_params\n params.require(:providerservice).permit(:name, :description, :providerprofile_id)\n end",
"def purchase(money, _, options={})\n requires!(options, :collectdate, :customeraccountname, :customerbic, :customeriban, :description, :invoicenumber, :mandatedate, :mandatereference)\n buckaroo_validate(money, options)\n\n mandatereference = options[:mandatereference]\n mandatereference = \"#{@options[:sepa_mandate_prefix]}-#{mandatereference}\" if @options[:sepa_mandate_prefix]\n\n post_params = {\n brq_amount: money,\n brq_channel: \"CALLCENTER\",\n brq_culture: options[:culture] ? options[:culture] : \"EN\",\n brq_currency: options[:currency] ? options[:currency] : \"EUR\",\n brq_description: options[:description],\n brq_invoicenumber: options[:invoicenumber],\n brq_payment_method: \"simplesepadirectdebit\",\n brq_service_simplesepadirectdebit_action: \"Pay\",\n brq_service_simplesepadirectdebit_collectdate: options[:collectdate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_customeraccountname: options[:customeraccountname],\n brq_service_simplesepadirectdebit_customerbic: options[:customerbic],\n brq_service_simplesepadirectdebit_customeriban: options[:customeriban],\n brq_service_simplesepadirectdebit_mandatedate: options[:mandatedate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_mandatereference: mandatereference,\n brq_startrecurrent: true,\n brq_websitekey: @options[:websitekey]\n }.merge(options.select {|k, *| k.to_s.start_with?(\"add_\") })\n\n BuckarooBPE3Toolbox.call(\"TransactionRequest\", post_params, @options[:secretkey], true)\n end",
"def service_request(service); end",
"def create\n\t\t# @payment = Payment.new({\n\t\t# :intent => \"sale\",\n\t\t# :payer => {\n\t\t# :payment_method => \"credit_card\",\n\t\t# :funding_instruments => [{\n\t\t# :credit_card => {\n\t\t# \t:type => params[:payment][:card_type], #\"visa\",\n\t\t# :number => params[:payment][:card_number], #\"4242424242424242\",\n\t\t# :expire_month => params[:payment][\"card_expires_on(2i)\"], #\"1\",\n\t\t# :expire_year => params[:payment][\"card_expires_on(1i)\"], #\"2018\",\n\t\t# :cvv2 => params[:payment][:cvv2], #\"874\",\n\t\t# :first_name => params[:payment][:first_name], #\"Joe\",\n\t\t# :last_name => params[:payment][:last_name], #\"Shopper\",\n\t\t# :billing_address => {\n\t\t# :line1 => params[:payment][:address], #\"52 N Main ST\",\n\t\t# :city => params[:payment][:city], #\"Johnstown\",\n\t\t# :state => params[:payment][:state], #\"OH\",\n\t\t# :postal_code => params[:payment][:postal_code], #\"43210\",\n\t\t# :country_code => params[:payment][:country_code] #\"US\" \n\t\t# }}}]},\n\t\t# :transactions => [{\n\t\t# :amount => {\n\t\t# :total => \"10.00\",\n\t\t# :currency => \"USD\" },\n\t\t# :description => \"This is the payment transaction description.\" }]})\n\n\t\t# @payment.create\n\t\t# if @payment.id.nil?\n\t\t# \terror = @payment.error\n\t\t# \tredirect_to payment_index_url, :alert => error.name+\"\\n\"+error.details.to_s\n\t\t# else\n\t\t# \tparams[:payment][:transaction_id] = @payment.id\n\t\t# \tparams[:payment][:amount] = 10\n\t\t# \t@data = current_user.build_payment(payment_params)\n\t\t# \tif @data.save\n\t\t# \t\tredirect_to payment_index_url, :notice => \"Payment Done with payment id #{@payment.id}\"\n\t\t# \telse\n\t\t# \t\tredirect_to payment_index_url, :alert => \"Something went wrong.\"\n\t\t# \tend\n\t\t# end\n\tend",
"def credit_with_payment_profiles(amount, payment, response_code, option)\n provider.credit(amount, payment)\n end",
"def payment_type\n :credit_card\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 set_service\n @supplier = Supplier.find(params[:supplier_id])\n @service = Service.find(params[:id])\n end",
"def service_params\n params.require(:service).permit(:code, :name, :cost, :price, :tax1_name, :tax1, :quantity, :description, :comments, :company_id, :discount, :currtotal,:cuenta)\n end",
"def create\n @profile = current_user.profile\n @payment = Payment.new(payment_params)\n @payment.profile = current_user.profile\n if @payment.save\n uri = URI('http://acm.ut.ac.ir/epayment/payments')\n parameters = {\n 'merchant' => \"4452A141\",\n 'amount' => @payment.amount,\n 'redirect' => \"http://acm.ut.ac.ir/events/payments/approve\"}\n response = transact(uri, parameters)\n puts response.body\n @payment.response = response.body\n parsed_response = JSON.parse(response.body)\n if parsed_response[\"status\"] != 1\n redirect_to payments_path, notice: \"در ارتباط با بانک خطایی رخ دادهاست.\"\n return\n end\n @payment.reference_key = parsed_response[\"reference\"]\n if @payment.save\n redirect_to parsed_response[\"bank\"]\n return\n else\n render :new\n end\n else\n render :new\n end\n\n end",
"def payment_provider_params\n params.require(:payment_provider).permit(:label, :connected, :provider_type, :api_key)\n end",
"def card_payment_service\n card_merchant_config&.payment_service\n end",
"def express_checkout_complete \n paypal_token = params[:token] \n @prize = Prize.find_by_paypal_token(paypal_token, :conditions => [\"paypal_state = 'purchase_setup'\"]) \n @details = gateway.details_for(paypal_token) \n \n if !@details.success?\n #paypal has reported error back to our system\n paypal_error(@details) \n else \n \n #might want to add to debug\n logger.info \"Customer name: #{@details.params['name']}\" \n logger.info \"Customer e-mail: #{@details.params['payer']}\" \n \n @response = gateway.purchase( \n amount_in_cents(@prize.paypal_prizecost), \n :token => @details.params['token'], \n :payer_id => @details.params['payer_id'] \n )\n \n if !@response.success? \n paypal_error(@response) \n else \n @prize.update_attributes(\n :paypal_state => 'closed',\n :paypal_amount => @response.params['gross_amount'] \n ) \n \n #send to prize confirmation page \n end #!@response.success? \n end #!@details.success?\nend",
"def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend",
"def service_payment_info_loop\n segments = []\n @clp_05_amount = 0\n eob.service_payment_eobs.each_with_index do |service, index|\n service_klass = Output835.class_for(\"Service\", facility)\n Output835.log.info \"Applying class #{service_klass}\" if index == 0\n service_obj = service_klass.new(service, facility, payer, index, @element_seperator) if service\n service_segments = service_obj.generate\n segments += service_segments[0]\n @clp_05_amount += service_segments[1]\n end\n segments\n end",
"def alipay_full_service_url( payment, payment_method )\n order = payment.order\n helper = ::OffsitePayments::Integrations::Alipay::Helper.new(create_out_trade_no(payment), payment_method.preferred_partner, key: payment_method.preferred_sign)\n #Rails.logger.debug \"helper is #{helper.inspect}\"\n\n if payment_method.preferred_using_direct_pay_service\n helper.total_fee order.total\n helper.service ::OffsitePayments::Integrations::Alipay::Helper::CREATE_DIRECT_PAY_BY_USER\n else\n helper.price order.item_total\n helper.quantity 1\n helper.logistics :type=> 'EXPRESS', :fee=>order.adjustment_total, :payment=>'BUYER_PAY' \n helper.service ::OffsitePayments::Integrations::Alipay::Helper::TRADE_CREATE_BY_BUYER\n end\n helper.seller :email => payment_method.preferred_email\n #url_for is controller instance method, so we have to keep this method in controller instead of model\n #Rails.logger.debug \"helper is #{helper.inspect}\"\n #helper.notify_url url_for(only_path: false, controller: 'tenpay_status', action: 'alipay_notify')\n #helper.return_url url_for(only_path: false, controller: 'tenpay_status', action: 'alipay_done')\n #helper.notify_url url_for(only_path: false, controller: 'alipay', action: 'notify')\n #helper.return_url url_for(only_path: false, controller: 'alipay', action: 'done')\n helper.return_url return_url(method: :alipay)\n helper.notify_url notify_url(method: :alipay)\n helper.body order.products.collect(&:name).to_s #String(400) \n helper.charset \"utf-8\"\n helper.payment_type 1\n helper.subject \"订单编号:#{order.number}\"\n Rails.logger.debug \"order--- #{order.inspect}\"\n Rails.logger.debug \"signing--- #{helper.inspect}\"\n helper.sign\n url = URI.parse(::OffsitePayments::Integrations::Alipay.service_url)\n #Rails.logger.debug \"query from url #{url.query}\"\n #Rails.logger.debug \"query from url parsed #{Rack::Utils.parse_nested_query(url.query).inspect}\"\n #Rails.logger.debug \"helper fields #{helper.form_fields.to_query}\"\n url.query = ( Rack::Utils.parse_nested_query(url.query).merge(helper.form_fields) ).to_query\n #Rails.logger.debug \"full_service_url to be encoded is #{url.to_s}\"\n url.to_s\n end",
"def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # service = params[:service]\n # @service = Service.new(description: service[:description], availablity: service[:availability], more_information: service[:more_information])\n @service = Service.new(service_params)\n @service.user = current_user \n @service.save\n end",
"def create_payment\n payment = ShopPayment.new({\n :order => @order,\n :gateway => gateway_name,\n :amount => @order.price,\n :card_type => card_type,\n :card_number=> card_number_secure\n })\n \n @order.update_attribute(:status, 'paid')\n \n @result[:payment] = payment.save\n end",
"def process_payments!\n if group_buy\n process_payments_with(:authorize!)\n else\n process_payments_with(:purchase!)\n end\n end",
"def service(nickname, reserved, distribution, type)\n end",
"def bi_service\n end",
"def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end",
"def create\n creditcard = @payment_presenter.creditcard\n creditcard.address = @payment_presenter.address\n creditcard.order = @order\n \n begin\n creditcard.authorize(@order.total)\n rescue Spree::GatewayError => ge\n flash.now[:error] = \"Authorization Error: #{ge.message}\"\n render :action => \"new\" and return \n end\n creditcard.save\n @order.next!\n redirect_to checkout_order_url(@order)\n end",
"def alipay_checkout_payment\n payment_method = PaymentMethod.find(params[:payment_method_id])\n #Rails.logger.debug \"@payment_method=#{@payment_method.inspect}\" \n Rails.logger.debug \"[DEBUG] alipay_full_service_url:\"+aplipay_full_service_url(@order, payment_method)\n # notice that load_order would call before_payment, if 'http==put' and 'order.state == payment', the payments will be deleted. \n # so we have to create payment again\n @order.payments.create(:amount => @order.total, :payment_method_id => payment_method.id)\n @order.payments.first.started_processing!\n\n #redirect_to_alipay_gateway(:subject => \"donatecn\", :body => \"donatecn\", :amount => @donate.amount, :out_trade_no => \"123\", :notify_url => pay_fu.alipay_transactions_notify_url)\n end",
"def payment_class\n raise NotImplementedError\n end",
"def add_payment(type, token = '')\n add_params(PTYP: type, PTOK: token)\n end",
"def pay\n unless self.payment_id\n payment = create_payment\n self.payment_id = payment.id\n self.status = 'paid'\n self.pay_date = Time.now\n self.save\n add_to_balance\n end\n end",
"def provider_payment_params\n params.require(:provider_payment).permit(:provider_id, :cantidad, :fecha)\n end",
"def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def add_payment(xml, options)\n return unless options[:credit_card] || options[:bank_account]\n\n xml.tag!('payment') do\n # Contains the customer’s credit card information\n add_credit_card(xml, options)\n # Contains the customer’s bank account information\n add_bank_account(xml, options)\n end\n end",
"def service_params\n params.require(:service).permit(:supplier_id, :desktype, :deskrate, :wifi, :wifilimit, :printing, :printingdesc, :sendfax, :receivefax)\n end",
"def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @service = @customer.service.new(service_params)\n\n respond_to do |format|\n if @service.save\n \n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def provider_payment_gateway\n provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?)\n end",
"def payment_params\n params.require(:payment).permit(:first_name, :last_name, :last4, :card_security_code, :credit_card_number, :expiration_month, :expiration_year, :amount, :amount, :success, :authorization_code, :user_id, :notify, :parking_id)\n end",
"def generate_services\n is_adjustment_line = @service.adjustment_line_is?\n service_segments = []\n service_segments << service_payment_information unless is_adjustment_line\n service_segments << service_date_reference\n unless is_adjustment_line\n cas_segments, pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(@service, @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n service_segments << cas_segments\n else\n pr_amount = 0.0\n end\n service_segments << service_line_item_control_num unless is_adjustment_line\n service_segments << provider_control_number unless is_adjustment_line\n supp_amount = supplemental_amount\n service_segments << service_supplemental_amount(supp_amount) unless supp_amount.blank? || @service.amount('service_paid_amount').blank?\n service_segments << patpay_specific_lq_segment if @facility.abbr_name == \"RUMC\"\n service_segments << standard_industry_code_segments(@service)\n [service_segments.compact.flatten, pr_amount]\n end",
"def provider_class\n ::Spree::PAYONE::Provider::Payment::EWallet\n end",
"def payment(method, data = {})\n call_endpoint(Endpoint::Payment, method, data)\n end",
"def provider\n\tend",
"def make_preapproved_payments(preapproval_key)\n api.execute :Pay, payment_options(preapproval_key)\nend",
"def authorize_payment(credit_card, options = {})\n\n # this is the major function that interacts with the credit card company\n options[:order_id] = number # currently just loading a date\n # options[:email] = 'developer@fitwit.com'\n # options[:billing_address] = {\n # :name => 'Cody Fauser',\n # :address1 => '1234 Shady Brook Lane',\n # :address2 => 'Apartment 1',\n # :city => 'Ottawa',\n # :state => 'ON',\n # :country => 'CA',\n # :zip => 'K3P5N5',\n # :phone => '999-999-9999'}\n\n authorization = OrderTransaction.authorize(amount, credit_card, options)\n self.save!\n self.order_transactions << authorization\n\n if authorization.success?\n self.payment_authorized!\n else\n self.transaction_declined!\n end\n\n authorization\n #end\n end",
"def create\n @title = \"Bakery Market | Purchase Credits\"\n @google_fonts = \"Josefin+Slab|Dancing+Script|Lato\"\n @stylesheet = \"users\"\n @order = Order.new(params[:order])\n if params[:id] < 4.to_s\n @service_plan = ServicePlan.find(params[:id])\n else\n @service_plan = ServicePlan.find(3)\n end\n @order.service_plan_id = @service_plan.id\n @order.ip_address = request.remote_ip\n @order.user_id = current_user.id\n if @order.save\n if @order.purchase(@service_plan.id)\n @meals_remaining = current_user.meals_remaining + @service_plan.meals_included\n @total_credits_purchased = current_user.total_credits_purchased + @service_plan.meals_included\n current_user.update_attributes(:meals_remaining => @meals_remaining, :total_credits_purchased => @total_credits_purchased)\n flash[:notice] = \"Thanks for your order. You're all set.\"\n redirect_to root_url\n UserMailer.purchase_complete(current_user, @service_plan).deliver\n else\n render :action => \"failure\"\n end\n else\n render :action => \"new\"\n end\n end"
] |
[
"0.6717453",
"0.66556394",
"0.657145",
"0.6368526",
"0.628441",
"0.6251136",
"0.6223648",
"0.6137595",
"0.6131912",
"0.6091232",
"0.6087689",
"0.6041838",
"0.60333484",
"0.6015361",
"0.60099614",
"0.59612507",
"0.59304965",
"0.59289956",
"0.59230745",
"0.5921717",
"0.5869013",
"0.58627284",
"0.58555394",
"0.5847551",
"0.58382505",
"0.58382505",
"0.5835029",
"0.58281505",
"0.5823998",
"0.5820394",
"0.5812864",
"0.5808725",
"0.5794466",
"0.578646",
"0.57819635",
"0.57734126",
"0.5748884",
"0.57442933",
"0.57378626",
"0.5722272",
"0.57183355",
"0.5713346",
"0.57128435",
"0.57097095",
"0.5688315",
"0.56881213",
"0.5685716",
"0.56828785",
"0.56780803",
"0.56755114",
"0.56745315",
"0.56620246",
"0.565224",
"0.5644362",
"0.5636496",
"0.56352544",
"0.5629812",
"0.56269336",
"0.56263393",
"0.56260085",
"0.5620368",
"0.56191",
"0.56149375",
"0.5603452",
"0.56001383",
"0.5600079",
"0.5595694",
"0.5585006",
"0.55809015",
"0.5579725",
"0.5563646",
"0.5563534",
"0.55530727",
"0.55449134",
"0.5536573",
"0.55345744",
"0.55339956",
"0.5533005",
"0.55284405",
"0.55275756",
"0.5527094",
"0.5521444",
"0.55177647",
"0.55092055",
"0.55087817",
"0.5505508",
"0.55027133",
"0.54989934",
"0.5497633",
"0.54946995",
"0.5494332",
"0.54941845",
"0.5494103",
"0.5493702",
"0.54883075",
"0.5485365",
"0.5483488",
"0.54823023",
"0.5479556",
"0.5478867"
] |
0.67547005
|
0
|
The DTM segment in the SVC loop is to be used to express dates and date ranges specifically related to the service identified in the SVC segment If service from and to dates are same, only print one segment with qual 472 Else print one segment each for the two dates
|
def service_date_reference
svc_date_segments = []
from_date = @service.date_of_service_from.strftime("%Y%m%d") unless @service.date_of_service_from.blank?
to_date = @service.date_of_service_to.strftime("%Y%m%d") unless @service.date_of_service_to.blank?
from_eqls_to_date = (from_date == to_date)
is_client_upmc = (@client_name == "UNIVERSITY OF PITTSBURGH MEDICAL CENTER")
if from_date && (!to_date || from_eqls_to_date || @client.group_code.to_s.strip == 'KOD')
if(@client_name == "ISTREAMS" && from_date == "20000101")
svc_date_segments = dtm_472("00000000")
elsif !(is_client_upmc && from_date == "20000112")
svc_date_segments = dtm_472(from_date) if can_print_service_date(from_date)
end
else
svc_date_segments << dtm_150(from_date) if can_print_service_date(from_date)
svc_date_segments << dtm_151(to_date) if can_print_service_date(to_date)
svc_date_segments unless svc_date_segments.join.blank?
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def service_date_reference\n service_date_elements, svc_date_segments = [], []\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\n to_date = service.date_of_service_to.strftime(\"%Y%m%d\") unless service.date_of_service_to.blank? \n if from_date\n service_date_elements << 'DTM'\n service_date_elements << '150'\n service_date_elements << from_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n if to_date\n service_date_elements = []\n service_date_elements << 'DTM'\n service_date_elements << '151'\n service_date_elements << to_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n svc_date_segments unless svc_date_segments.blank?\n end",
"def process_claim_start_and_end_dates(c,date_qualifier)\n if date_qualifier == \"434\" or date_qualifier == \"472\"\n service_dates = c[1].split(\"-\")\n @claim_information[\"claim_statement_period_start_date\"] = service_dates[0].to_s if @claim_information.claim_statement_period_start_date.nil?\n @claim_information[\"claim_statement_period_end_date\"] = service_dates.length == 2 ? service_dates[1].to_s : service_dates[0].to_s if @claim_information.claim_statement_period_end_date.nil?\n elsif date_qualifier == \"435\" or date_qualifier == \"096\"\n if date_qualifier == \"435\"\n @claim_information[\"claim_statement_period_start_date\"] = c[1] if @claim_information.claim_statement_period_start_date.nil?\n @service_from_date = @claim_information.claim_statement_period_start_date\n else\n @claim_information[\"claim_statement_period_end_date\"] = c[1] if @claim_information.claim_statement_period_end_date.nil?\n @service_to_date = @claim_information.claim_statement_period_end_date\n end\n end\n end",
"def generate_services\n is_adjustment_line = @service.adjustment_line_is?\n service_segments = []\n service_segments << service_payment_information unless is_adjustment_line\n service_segments << service_date_reference\n unless is_adjustment_line\n cas_segments, pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(@service, @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n service_segments << cas_segments\n else\n pr_amount = 0.0\n end\n service_segments << service_line_item_control_num unless is_adjustment_line\n service_segments << provider_control_number unless is_adjustment_line\n supp_amount = supplemental_amount\n service_segments << service_supplemental_amount(supp_amount) unless supp_amount.blank? || @service.amount('service_paid_amount').blank?\n service_segments << patpay_specific_lq_segment if @facility.abbr_name == \"RUMC\"\n service_segments << standard_industry_code_segments(@service)\n [service_segments.compact.flatten, pr_amount]\n end",
"def service_payment_info_loop\n segments = []\n @clp_05_amount = 0\n eob.service_payment_eobs.each_with_index do |service, index|\n service_klass = Output835.class_for(\"Service\", facility)\n Output835.log.info \"Applying class #{service_klass}\" if index == 0\n service_obj = service_klass.new(service, facility, payer, index, @element_seperator) if service\n service_segments = service_obj.generate\n segments += service_segments[0]\n @clp_05_amount += service_segments[1]\n end\n segments\n end",
"def health_remark_code_segments\n @eob = service.insurance_payment_eob\n facility = @eob.check_information.job.batch.facility\n health_remark_code_segments = []\n health_remark_code_segments << compute_lq(\"in\")\n health_remark_code_segments << compute_lq(\"out\") \n if facility.details[:interest_in_service_line] && service.interest_service_line?\n health_remark_code_segments << lq_rx_segments(\"109975\") if @eob.claim_interest.to_f > 0.0 \n end \n health_remark_code_segments << lq_rx_segments(\"109702\") if @eob.hcra.to_f > 0.0\n health_remark_code_segments.compact!\n health_remark_code_segments.flatten\n end",
"def statement_from_date\n claim_date = claim_start_date\n if claim_date && can_print_service_date(claim_date.strftime(\"%Y%m%d\"))\n ['DTM', '232', claim_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def process_claim_services(clm)\n row = @cnf['CLAIM_SERVICE_START_LINE']-1\n while(row < @cnf['CLAIM_SERVICE_END_LINE'])\n \n # New line characters may in a blank line\n if @cntnt[row].length > 1\n clm_items = ClaimServiceInformation.new\n @cnf['CLAIM_SERVICE'].each { |k, v| clm_items[k] = @cntnt[row][v[1]-1, v[2]].strip }\n @cnf['CLAIM_SERVICE_DATES'].each { |k, v| clm_items[k] = frame_date(@cntnt[row][v[1]-1, v[2]].strip) }\n @clm_fl_info.total_svcline_count += 1\n p clm_items\n clm.claim_service_informations << clm_items\n end\n row += 1\n end\n end",
"def live_segmentations\n segmentations = Array.new\n \n segment = self.segments.new\n \n segmentations << segment.script(\"SELECT * FROM [$$brand_code$$_WeeklyCampaign] WHERE campaign_id = $$campaign_id$$\")\n segmentations << segment.script(\"SELECT * FROM [$$brand_code$$_Whole] Whole WHERE NOT EXISTS ( SELECT * FROM [$$brand_code$$_UNSUBS] Unsubs WHERE Unsubs.email_address = Whole.email_address ) AND NOT EXISTS ( SELECT * FROM ent.[ET_UNSUB] GlobalUnsubs WHERE GlobalUnsubs.email_address = Whole.email_address )\")\n \n versions.each do |v|\n list = (v.audience_list.split(',').collect { |a| \"'\" + a.lstrip + \"'\" }).join(', ')\n segmentations << segment.script(\"SELECT * FROM [$$treatment_name$$_WAU] WHERE email_version IN (#{list})\") \n end\n \n segmentations;\n end",
"def service_adjustments\n payer_id = service.insurance_payment_eob.check_information.payer.id\n cas_segments = []\n cas_segments << cas_without_crosswalk('coinsurance_groupcode', 'coinsurance_code', 'service_co_insurance')\n cas_segments << cas_without_crosswalk('deductuble_groupcode', 'deductuble_code', 'service_deductible')\n cas_segments << cas_without_crosswalk('copay_groupcode', 'copay_code', 'service_co_pay')\n cas_segments << cas_with_crosswalk(payer_id, 'noncovered_groupcode', 'noncovered_code', 'noncovered_code_description', 'service_no_covered')\n cas_segments << cas_with_crosswalk(payer_id, 'discount_groupcode', 'discount_code', 'discount_code_description', 'service_discount')\n cas_segments << cas_with_crosswalk(payer_id, 'denied_groupcode', 'denied_code', 'denied_code_description', 'denied')\n cas_segments << cas_with_crosswalk(payer_id, 'contractual_groupcode', 'contractual_code', 'contractual_code_description', 'contractual_amount')\n cas_segments << cas_without_crosswalk('primary_payment_groupcode', 'primary_payment_code', 'primary_payment')\n cas_segments = cas_segments.compact\n cas_segments unless cas_segments.empty?\n end",
"def claim_loop\n segments = []\n @eobs.each_with_index do |eob, index|\n @check_grouper.last_eob = eob\n @check = eob.check_information\n @job = @check.job\n if @check.micr_line_information && @check.micr_line_information.payer && @facility.details[:micr_line_info]\n @payer = @check.micr_line_information.payer\n else\n @payer = @check.payer\n end\n @facility_output_config = @facility.output_config(@payer.payer_type)\n @reason_codes = nil #this variable is used in child class for configurable section\n @eob = eob\n @claim = eob.claim_information\n @eob_index = index\n @services = eob.service_payment_eobs\n @is_claim_eob = (eob.category.upcase == \"CLAIM\")\n @count = count\n segments << transaction_set_line_number(index + 1)\n segments << transaction_statistics([eob])\n segments += generate_eobs\n end\n segments.flatten.compact\n end",
"def get_product_service_kpi_from_to(product_service_map,time,time_list)\n @pro_normalPv_list = Array.new\n @pro_delayPv_list = Array.new\n size = time.size\n 0.upto(size-1) do |i|\n new_p,new_s = new_and_old_service(time[i]) \n product_service_map = concat_pro_ser(product_service_map,new_p,new_s)\n pro_kpi,pro_pv,pro_normalPv,pro_delayPv = get_kpi_by_collection_name(@db,\"count_kpi\",product_service_map,time_list[i],time_list[i+1])\n @pro_normalPv_list.push(pro_normalPv)\n @pro_delayPv_list.push(pro_delayPv)\n end\n pro_size = @pro_normalPv_list.size\n @pro_pv = 0\n @pro_delayPv = 0\n 0.upto(pro_size-1) {|i|@pro_pv += @pro_normalPv_list[i]+@pro_delayPv_list[i]; @pro_delayPv+=@pro_delayPv_list[i]} \n @pro_kpi = (@pro_pv-@pro_delayPv)/(@pro_pv*1.0)*100\n last = time_list.size-1\n @ser_kpi,@ser_pv,@ser_normalPv,@ser_delayPv = get_kpi_by_collection_name(@db,\"search_kpi\",nil,time_list[0],time_list[last])\n @pro_avi,@pro_yes_num,@pro_no_num = get_availability_by_collection_name(@db,\"count_usable\",time_list[0],time_list[last])\n @ser_avi,@ser_yes_num,@ser_no_num = get_availability_by_collection_name(@db,\"search_usable\",time_list[0],time_list[last])\n puts \"Starttime: #{time_list[0]}\\t Endtime: #{time_list[last]}\\t timegap: #{time_list.size-1} \"\n print nil\n end",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n port_sap = IpranaccessQosingressinterface.where(device_sap: @ipranaccess_qosingressinterface.device_sap).order(\"created_at ASC\").where(created_at: range)\n @chart_discard_1 = port_sap.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = port_sap.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = port_sap.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = port_sap.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = port_sap.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = port_sap.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = port_sap.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = port_sap.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = port_sap.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = port_sap.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = port_sap.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = port_sap.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = port_sap.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = port_sap.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def claim_payment_loop\n claim_payment_segments = []\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n service_eob = @services.detect{|service| service.adjustment_line_is? }\n if service_eob\n cas_segments, @clp_pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(service_eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n if @is_claim_eob\n cas_segments, @clp_05_amount, crosswalked_codes = Output835.cas_adjustment_segments(@eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << patient_name\n unless @eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier\n if @is_claim_eob\n claim_payment_segments << Output835.claim_level_remark_code_segments(@eob, @element_seperator, crosswalked_codes)\n end\n claim_payment_segments << image_page_name\n claim_payment_segments << medical_record_number\n claim_payment_segments << claim_uid if @client_name == \"QUADAX\"\n claim_payment_segments << other_claim_related_id\n claim_payment_segments.compact\n end",
"def claim_from_date\n if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime(\"%Y%m%d\"))\n [ 'DTM', '232', @eob.claim_from_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def get_datalog_trace\r\n transaction_id=params[0]\r\n trace_label=params[1]\r\n site_id=params[2]\r\n start_freq=params[3]\r\n stop_freq=params[4]\r\n start_ts=params[5] \r\n stop_ts=params[6] \r\n freq_res=params[7] \r\n ts_res=params[8]\r\n datalog_range=Datalog.get_range(site_id)\r\n logger.debug datalog_range.inspect()\r\n logger.info(\"START TS : #{start_ts}\")\r\n logger.info(\"STOP TS : #{stop_ts}\")\r\n ds={}\r\n\t \r\n\t###TODO\r\n\t\r\n\t \r\n\t \r\n if (datalog_range.nil?) || datalog_range[:max_ts].nil? || datalog_range[:max_ts].nil?\r\n ds[\"min_freq\"]=datalog_range[:min_freq]\r\n ds[\"max_freq\"]=datalog_range[:max_freq]\r\n ds[\"min_ts\"]=nil\r\n ds[\"max_ts\"]=nil\r\n ds[\"transaction_id\"]=transaction_id\r\n ds[\"trace_label\"]=trace_label\r\n else\r\n one_hour_ago=datalog_range[:max_ts]-3600\r\n logger.debug \"One hour ago #{one_hour_ago.to_s} Most Recent #{datalog_range[:max_ts]}\"\r\n overtime_flag=params.key?(9) ? params[9] : false\r\n site=Site.find(site_id)\r\n profile=nil\r\n anl=nil\r\n if site.nil?\r\n raise \"Failed to find Site.\"\r\n else\r\n logger.debug \"Getting Profile for site #{site.id}\"\r\n profile=site.get_profile()\r\n end\r\n datalog=Datalog.summarize_datalogs(\r\n {\r\n :site_id=>site_id, \r\n :start_ts=>start_ts,\r\n :stop_ts=>stop_ts,\r\n :start_freq=>start_freq,\r\n :stop_freq=>stop_freq\r\n },\r\n overtime_flag)\r\n recent_datalog=Datalog.summarize_datalogs(\r\n {\r\n :site_id=>site_id, \r\n :start_ts=>one_hour_ago,\r\n :stop_ts=>datalog_range[:max_ts],\r\n :start_freq=>start_freq,\r\n :stop_freq=>stop_freq\r\n },\r\n overtime_flag)\r\n ds[\"recent\"]=recent_datalog[:max]\r\n datalog_list=[]\r\n ds[\"trace_label\"]=trace_label\r\n ds[\"avg\"]=datalog[:avg]\r\n ds[\"min\"]=datalog[:min]\r\n ds[\"max\"]=datalog[:max]\r\n ds[\"total\"]=datalog[:total]\r\n ds[\"noise_floor\"]=datalog[:noise_floor] if overtime_flag\r\n logger.debug \"Datalog length #{ds[\"max\"].length}\"\r\n if ((!profile.nil?) && (!overtime_flag))\r\n logger.debug \"Got Profile #{profile.name()}, #{start_freq}, #{stop_freq}\"\r\n ds[\"profile_id\"]=profile.id\r\n ds[\"profile_name\"]=profile.name\r\n ds[\"profile_ref\"]=profile.trace(start_freq, stop_freq)\r\n #ds[\"profile_ref\"]=profile.trace()\r\n ds[\"profile_major\"]=profile.major_offset\r\n ds[\"profile_minor\"]=profile.minor_offset\r\n ds[\"profile_loss\"]=profile.loss_offset\r\n ds[\"profile_loss_flag\"]=profile.link_loss\r\n else\r\n logger.debug \"Did not get Profile #{profile.inspect()}\"\r\n end\r\n logger.debug datalog.inspect()\r\n logger.debug \"Finished Total\"\r\n if datalog.key?(:freq)\r\n ds[\"freq\"]=datalog[:freq]\r\n else\r\n ds[\"freq\"]=[]\r\n end\r\n if datalog.key?(:time)\r\n ds[\"time\"]=datalog[:time]\r\n else\r\n ds[\"time\"]=[]\r\n end\r\n ds[\"min_freq\"]=datalog[:min_freq]\r\n ds[\"max_freq\"]=datalog[:max_freq]\r\n ds[\"min_ts\"]=datalog[:min_ts]\r\n ds[\"max_ts\"]=datalog[:max_ts]\r\n ds[\"transaction_id\"]=transaction_id\r\n \r\n \r\n\t \r\n logger.debug ds[\"freq\"].inspect()\r\n logger.debug \"Finished Transaction. Now building XML\"\r\n end\r\n respond_to do |format|\r\n format.amf { \r\n render :amf => ds\r\n }\r\n end\r\n end",
"def expand_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def segments; end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n p ranges\n end",
"def claim_payment_loop\n claim_payment_segments = []\n service_eob = nil\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n eob.service_payment_eobs.collect{|service| service_eob=service if service.adjustment_line_is?}\n if !service_eob.blank?\n cas_segments, @clp_pr_amount = Output835.cas_adjustment_segments(service_eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << claim_interest_information_bac # _bac methods are used for dynamic output section it will be bypassed for non_banks\n if claim_level_eob?\n cas_segments, @clp_05_amount = Output835.cas_adjustment_segments(eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end \n claim_payment_segments << patient_name\n claim_payment_segments << reference_identification_qualifier_bac\n claim_payment_segments << reference_identification_bac if !@reason_codes.blank?\n unless eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier_bac\n claim_payment_segments << reference_id_bac\n claim_payment_segments << image_page_name_bac\n claim_payment_segments << other_claim_related_id\n claim_payment_segments = claim_payment_segments.compact\n claim_payment_segments unless claim_payment_segments.blank?\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend",
"def segment(series, control, segment_align_usec=5_000_000)\n each_subseries_in series, control do |name, subseries|\n new_subseries = {}\n\n # rely on request timestamps provided in control - especially with counters,\n # there will be variable numbers of samples available so ranges will be inconsistent\n min_ts = control[:start_ts]\n max_ts = control[:end_ts]\n min_ts_seg = min_ts / segment_align_usec\n max_ts_seg = max_ts / segment_align_usec\n min_ts_seg_start = min_ts_seg * segment_align_usec\n\n # compute the number of segments\n range = max_ts - min_ts\n seg_count = max_ts_seg - min_ts_seg + 1\n\n # initialize the segments - all segments must exist in output\n 0.upto(seg_count-1).map do |seg|\n key = min_ts_seg_start + seg * segment_align_usec\n new_subseries[key] = { :timestamps => [], :values => [] }\n end\n\n # move the individual entries into segments ready for rollups\n seg_ts = min_ts_seg_start\n subseries.keys.sort.each do |ts|\n # advance to the next bin if necessary\n until ts.between?(seg_ts, seg_ts + segment_align_usec - 1) do\n seg_ts = seg_ts + segment_align_usec\n end\n\n # compute_rollups requires two arrays, timestamps & values\n new_subseries[seg_ts][:timestamps] << ts\n new_subseries[seg_ts][:values] << subseries[ts]\n end\n\n # now use the rollup function to generate all of the useful aggregations\n new_subseries.keys.each do |seg_ts|\n new_subseries[seg_ts] = compute_rollups(\n new_subseries[seg_ts][:timestamps],\n new_subseries[seg_ts][:values],\n segment_align_usec, seg_ts, (seg_ts + segment_align_usec - 1)\n )\n end\n\n new_subseries\n end\n end",
"def service_billing_period\n (self.service_period_start_on..self.service_period_end_on)\n end",
"def street_segments\r\n\t\tstart_street_segments + end_street_segments\r\n\tend",
"def claim_loop\n segments = []\n eobs.each_with_index do |eob, index|\n Output835.log.info \"\\n\\n Check number #{eob.check_information.check_number} undergoing processing\"\n Output835.log.info \"\\n\\n Check has #{eob.check_information.insurance_payment_eobs.length} eobs\"\n segments << transaction_set_line_number(index + 1)\n segments << transaction_statistics([eob])\n eob_klass = Output835.class_for(\"SingleStEob\", facility)\n eob_obj = eob_klass.new(eob, facility, payer, index, @element_seperator, @check_num,count(eob)) if eob\n Output835.log.info \"Applying class #{eob_klass}\" if index == 0\n segments += eob_obj.generate\n end\n segments = segments.flatten.compact\n segments unless segments.blank?\n end",
"def set_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def get_drs_from_range(start_date, end_date)\n self.delta_requests.select do |dr|\n begin\n dr.start_time > start_date and dr.start_time < end_date\n rescue\n false\n end\n end\n end",
"def compute_from_worksheets(qdcgt_line, sdtw_line)\n with_form('1040 QDCGT Worksheet') do |qdcgt|\n return qdcgt.line[qdcgt_line]\n end\n with_form('1040 Schedule D Tax Worksheet') do |sdtw|\n return sdtw.line[sdtw_line]\n end\n return(yield)\n end",
"def build_cal from, to\n (from..to).map{ |d| [d.month, d.year ] }.uniq.map { |m,y|\n `cal #{m} #{y}`\n }.join(\"\\n\").split(/\\n/)\n end",
"def find_lines mta, start_station, end_station\n lines = [[],[]]\n mta.each do |line, stations|\n lines[0].push line if stations.include?(start_station)\n lines[1].push line if stations.include?(end_station)\n end\n\n if lines[0] & lines[1] != []\n common_line = lines[0] & lines[1]\n return [ common_line[0], common_line[0] ] # The 1st line both stations are on\n else\n return [ lines[0][0], lines[1][0] ] # The 1st line the staions are found on\n end\nend",
"def claim_payment_loop\n claim_payment_segments = []\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n claim_payment_segments << quantity\n service_eob = @services.detect{|service| service.adjustment_line_is? }\n if service_eob\n cas_segments, @clp_pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(service_eob,\n @client, @facility, @payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n if @is_claim_eob\n cas_segments, @clp_05_amount, crosswalked_codes = Output835.cas_adjustment_segments(@eob,\n @client, @facility, @payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << service_prov_identifier\n if @is_claim_eob\n claim_payment_segments << Output835.claim_level_remark_code_segments(@eob, @element_seperator, crosswalked_codes)\n end\n claim_payment_segments << image_page_name\n claim_payment_segments << medical_record_number\n claim_payment_segments << other_claim_related_id\n claim_payment_segments.compact\n end",
"def detect_segment_errors(segment, segment_start, segment_end) #collapse_start\n segment_length = segment.length\n averaged_segment = Array.new(segment_length)\n local_maxes = Array.new\n\n # Smooth the data by taking the averages\n for i in 0...segment_length\n if i == 0\n averaged_segment[i] = segment.slice(0,3).inject(:+).to_f / 3.0\n elsif i == 1\n averaged_segment[i] = segment.slice(0,4).inject(:+).to_f / 4.0\n elsif i == segment_length-1\n averaged_segment[i] = segment.slice(segment_length-3, 3).inject(:+).to_f / 3.0\n elsif i == segment_length-2\n averaged_segment[i] = segment.slice(segment_length-4, 4).inject(:+).to_f / 4.0\n else\n averaged_segment[i] = segment.slice(i-2, 4).inject(:+).to_f / 4.0\n end\n end\n\n # Find all the local maxes in the data, that can correspond to qrs segments or smaller local maxes\n j = 0\n while j < segment_length\n current = averaged_segment[j]\n local_max = true\n\n if (current - BASELINE_VALUE) > 20\n starting = [j-10, 0].max\n ending = [j+10, segment_length].min\n for k in starting...ending\n if averaged_segment[k] > current\n local_max = false\n break\n end\n end\n\n if local_max\n if (current - 512) > 250\n local_maxes.push({ index: j, type: 'qrs' })\n else\n local_maxes.push({ index: j, type: 'small' })\n end\n j += 10\n end\n end\n j += 1\n end\n\n distances = Array.new\n flutters = Array.new\n w = 0\n\n # Find the distances between qrs segments\n # Find the number of small local maxes in between qrs segments (corresponding to atrial flutters)\n while w < local_maxes.length - 1\n current = local_maxes[w]\n if current[:type] == 'qrs'\n idx = w+1\n counter = 0\n\n while idx < local_maxes.length\n if local_maxes[idx][:type] == 'qrs'\n distances.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n if counter >= 4\n flutters.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n end\n break;\n end\n\n counter += 1\n idx += 1\n end\n\n w = idx\n else\n w += 1\n end\n end\n\n max_distance = distances.present? ? distances.max_by { |obj| obj[:distance] }[:distance] : 0\n min_distance = distances.present? ? distances.min_by { |obj| obj[:distance] }[:distance] : 0\n long_distances = Array.new\n if max_distance - min_distance > 75\n long_distances = distances.select { |obj| obj[:distance] > max_distance-25 }\n long_distances = long_distances.reduce([]) do |memo, val|\n last = memo.last\n if last\n if last[:stop] == val[:start]\n last[:stop] = val[:stop]\n last[:distance] = last[:distance] + val[:distance]\n memo[-1] = last\n\n memo\n else\n memo.push(val)\n end\n else\n [val]\n end\n end\n end\n\n long_distances.each do |dist_obj|\n signal = segment.slice(dist_obj[:start], dist_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + dist_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + dist_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Sinus Arrythmia',\n ecg_stream_id: self.id\n })\n end\n\n flutters.each do |flutter_obj|\n signal = segment.slice(flutter_obj[:start], flutter_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + flutter_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + flutter_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Atrial Flutter',\n ecg_stream_id: self.id\n })\n end\n end",
"def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end",
"def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end",
"def getTripString(line, startStop, endStop) \n lineArray = getLine(line)\n string = \"\" # to save the station \n start_point = lineArray.index(startStop) # save the index of start point\n end_point = lineArray.index(endStop) # save the index of end point\n # p start_point \n # p end_point\n if start_point > end_point\n start_point.downto(end_point) do |j| \n string += \"#{lineArray[j]}, \"\n end\n else\n start_point.upto(end_point) do |j|\n string += \"#{lineArray[j]}, \"\n end \n end \n return string[0...-2] \nend",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n port_sap = IpranaccessQosegressinterface.where(device_sap: @ipranaccess_qosegressinterface.device_sap).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = port_sap.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n\n @chart_discard_1 = port_sap.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = port_sap.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = port_sap.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = port_sap.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = port_sap.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = port_sap.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = port_sap.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = port_sap.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = port_sap.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = port_sap.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = port_sap.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = port_sap.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = port_sap.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = port_sap.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def multiple_dates_occupation_detail(month, year)\n\n date_from = Date.civil(year, month, 1)\n date_to = Date.civil(year, month, -1)\n result = {}\n\n # Get planned activities\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new(:date,'$gte', date_from),\n Conditions::Comparison.new(:date,'$lte', date_to)\n ])\n planned_activities = condition.build_datamapper(::Yito::Model::Booking::PlannedActivity).all(\n :order => [:date, :time, :activity_code]\n )\n\n # Build the structure\n activities = ::Yito::Model::Booking::Activity.all(#:active => true,\n :occurence => :multiple_dates,\n 'activity_dates.date_from.gte'.to_sym => date_from,\n 'activity_dates.date_from.lte'.to_sym => date_to)\n\n activities.each do |activity|\n\n # Build item prices hash\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n\n # Fill with the activity turns\n activity_detail = {}\n activity.multiple_dates_timetable.each do |turn|\n # Build days hash\n days = {}\n (1..(date_to.day)).each do |day|\n date = Date.civil(year, month, day)\n modified_capacity = planned_activities.select do |item|\n item.date.strftime('%Y-%m-%d') == date.strftime('%Y-%m-%d') and\n item.time == turn and\n item.activity_code == activity.code\n end\n real_capacity = modified_capacity.size > 0 ? modified_capacity.first.capacity : activity.capacity\n\n if activity.start_date?(date)\n days.store(day, {quantity: (item_prices.empty? ? 0 : item_prices.clone),\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: true})\n else\n days.store(day, {quantity: '-',\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: false})\n end\n end\n activity_detail.store(turn, days)\n end\n\n # Store the item\n result.store(activity.code, {name: activity.name,\n capacity: activity.capacity,\n price_literals: activity.price_definition_detail,\n number_of_item_price: activity.number_of_item_price,\n occupation: activity_detail})\n end\n\n sql =<<-SQL\n select o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, CAST (o_i.status AS UNSIGNED) as status, sum(quantity) as quantity\n from orderds_order_items o_i\n join orderds_orders o on o.id = o_i.order_id\n join bookds_activities a on a.code = o_i.item_id \n where o.status NOT IN (3) and o_i.date >= ? and o_i.date <= ? and \n a.occurence IN (2)\n group by o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, o_i.status\n SQL\n\n # Fill with the orders\n\n orders = repository.adapter.select(sql, date_from, date_to)\n\n orders.each do |order|\n if result[order.item_id] and\n result[order.item_id][:occupation] and\n result[order.item_id][:occupation][order.time] and\n result[order.item_id][:occupation][order.time][order.date.day] and\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] and\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type]\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type] += order.quantity if order.status == 1\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] += order.quantity if order.status == 2\n end\n end\n\n return result\n\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def compare_scr\n line = Array.new\n @attribute_all.each_value{|const|\n const[1].each{|line,data|\n data.SDC.each{|sdc|\n sdc_tmp = sdc.gsub(\"\\*\",\"\").split[2].slice(2..1000)\n @RPT_ERR.each{|key,err|\n sig_tmp = err.SignalName.gsub(\"\\*\",\"\")\n if err.AttributeName == sdc.split[0] && sig_tmp == sdc_tmp\n data.ConstCheckFlag = 0\n data.SynthesisReport = err.Message\n noapply = Array.new\n noapply << line\n noapply << data.SDC\n noapply << err.Message\n @RPT_ErrorList << noapply\n end\n }\n }if data.SDC != nil\n }\n }\n end",
"def get_data(startdate, enddate)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: startdate, end_date: enddate)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\t# metric = @analytics::Metric.new(expression: 'ga:sessions')\n\t\t# metric = @analytics::Metric.new(expression: ['ga:sessions', 'ga:uniquePageviews'])\n\t\t# metric = @analytics::Metric.new\n\t\t# metric.expression = ['ga:sessions', 'ga:uniquePageviews']\n\t\t\n\t\tmetrics = ['ga:pageviews', 'ga:users', 'ga:bounces', 'ga:sessions',\n\t\t\t\t 'ga:avgTimeOnPage', 'ga:newUsers', 'ga:goal1ConversionRate', 'ga:goal1Completions'\n\t\t\t\t ]\n\n\t\t# metrics = ['ga:totalEvents'\n\t\t# \t\t ]\t\t \n\n\n\t\tmetric_type = Array.new\n\t\tmetrics.each do |m|\n\t\t\tmetric = @analytics::Metric.new\n\t\t\tmetric.expression = m\n\t\t\tmetric_type.push(metric)\n\t\tend\n\n\t\tdimensions = ['ga:pagePath', 'ga:pageTitle', 'ga:hostname' ]\n\t\t# dimensions = ['ga:pagePath', 'ga:eventCategory']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\n\t\t# dimension = @analytics::Dimension.new(name: 'ga:pagePath')\n\n\t\t# dimension_filters = @analytics::DimensionFilterClause.new(\n\t # filters: [\n\t # @analytics::DimensionFilter.new(\n\t # dimension_name: 'ga:pagePath',\n\t # operator: \"IN_LIST\",\n\t # expressions: ['/archives/69839', '/archives/54087', '/archives/68924', '/archives/58437', '/archives/65171', '/archives/64435', '/archives/61533', '/archives/68924',\n\t # \t\t\t\t'/archives/65086', '/archives/64736', '/archives/55244', '/archives/68211'\n\t # ]\n\t # )\n\t # ]\n\t # )\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: @view_id, \n \t\t\tmetrics: metric_type, \n \t\t\tdimensions: dimension_type,\n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\t# dimensions: [dimension], \n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpageSize: 10000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\t\tmessageHash = {}\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t\t\n\t\t\tkey = \"message\"\n\t\t\tmessageHash[key.to_sym] = \"no data\"\n\t\t \treturn messageHash\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\n\t\tkey_array = dimensions + metrics\n\n\t\t# get rid of 'ga:'\n\t\tkey_array.each_with_index do |k, index| \n\t\t\tkey_array[index] = k.gsub(\"ga:\",\"\")\n\t\tend\n\n\t\tkey_array.push('id')\n\t\tkey_array.push('clickCount')\n\n\t\tset_ga_data_array = Array.new\n\n\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\tdatahash = {}\n\t\t\ti = 0;\n\n\t\t\t# setup dimension part\n\t\t\tr.dimensions.each do |d|\n\t\t\t\tdatahash[key_array[i]] = d\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t# setup metrics part\n\t\t\tr.metrics.first.values.each do |m|\n\t\t\t\tdatahash[key_array[i]] = m\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t\n\t\t\t# get aticle data from db\n\t\t\tarticleArr = set_article_data(datahash['hostname'], datahash['pagePath'], startdate, enddate)\n\n\t\t\t# setup id, mcv\n\t\t\tarticleArr.each do |a|\n\t\t\t\tdatahash[key_array[i]] = a\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\tset_ga_data_array.push(datahash)\n\n\t\t\t#datahash sample -> { \"pagePath\": \"/archives/69839\", ... , \"goal1Completions\": \"23\", \"id\": 4, \"clickCount\": 0 },\n\t\tend\n\t\t\n\t\treturn set_ga_data_array\n\tend",
"def get_response( date )\r\n date_range = [parse_date( date ), parse_date( date.next_month )]\r\n puts \"Getting records modified from #{date_range.join(' to ')} ...\"\r\n \r\n response = ERP::ERPAgent.post(\r\n :url => AppConfig.SOAP_CU_SERV,\r\n :body => ERP::Customer.generate_xml( \"find_entity_key_list_customers\", :operator => \"Range\", :value1 => date_range.first, :value2 => date_range.last )\r\n )\r\nend",
"def doprops(props,block,boundary)\n for prop in props\n catchmentside = insideoutside(block,boundary,prop[\"full_address\"])\n sqft = prop[\"characteristics\"][\"improvement_area\"]\n description = prop[\"characteristics\"][\"description\"]\n myprops = prop[\"property_id\"]+\"\\t\"+prop[\"account_number\"]+\"\\t\"+prop[\"full_address\"] + \"\\t\" + sqft.to_s + \"\\t\" + description.to_s + \"\\t\" + catchmentside\n mydates = Array.new\n myprices = Array.new\n numsales = 0\n for sales in prop[\"sales_information\"]\n k,v = sales\n if k == 'sales_date'\n #/Date(1212120000000-0400)/\n if /\\((\\d+)/.match(v)\n datestrings = /\\((\\d+)/.match(v).captures\n datestring = datestrings[0]\n mydate = DateTime.strptime(datestring,'%Q').strftime(\"%Y-%m-%d\")\n else\n mydate = ''\n end\n mydates << mydate\n elsif k == 'sales_price'\n myprice = v.to_s\n myprices << myprice\n end\n end\n mydates.zip(myprices).each do |thisdate, thisprice|\n print myprops + \"\\t\" + thisdate + \"\\t\" + thisprice + \"\\n\"\n end\n end\nend",
"def idsr_monthly_report_summary\n date = params[:year_month].split('-')\n @start_date = Date.new(date[0].to_i,date[1].to_i)\n\n @end_date = @start_date + 1.month - 1.day\n @disaggregated_diagnosis = {}\n\n idsr_monthly_set = ConceptName.where([\"name IN (?)\",[\"Idsr Monthly Summary\"]]).map(&:concept_id)\n\n\n idsr_monthly_set_members = ConceptSet.where([\"concept_set IN (?)\",idsr_monthly_set]).map(&:concept_id)\n\n concept_ids = ConceptName.where([\"concept_name.concept_id IN (?)\",\n idsr_monthly_set_members]).map(&:concept_id)\n\n observation = Observation.where([\"obs.obs_datetime >= ? AND obs.obs_datetime <= ?\n AND obs.value_coded IN (?)\",@start_date, @end_date,concept_ids]).includes({:person=>{}})\n\n observation.each do | obs|\n next if obs.person.blank?\n next if obs.answer_concept.blank?\n previous_date = obs.obs_datetime.strftime('%Y-%m-%d').to_date\n sex = obs.person.gender\n age = PatientService.age(obs.person, previous_date)\n diagnosis_name = obs.answer_concept.fullname rescue ''\n\n @disaggregated_diagnosis[diagnosis_name]={\n \"=<4\" =>0,\n \"=>5\" =>0\n }\n\n # if @disaggregated_diagnosis[diagnosis_name] != nil\n if age.to_i < 5\n @disaggregated_diagnosis[diagnosis_name][\"=<4\"]+=1\n else\n @disaggregated_diagnosis[diagnosis_name][\"=>5\"]+=1\n end\n # end\n # end\n @diaggregated_paginated = []\n @disaggregated_diagnosis.each { | diag, value |\n @diaggregated_paginated << [diag, value]\n }\n end\n #raise @diaggregated_paginated.inspect\n render :json=> @diaggregated_paginated\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end",
"def segmentpairs\n unless defined?(@segmentparis); parse_segmentpairs; end\n @segmentpairs\n end",
"def stops_between_stations(startLine, startPos, endLine, endPos)\n#defining the lines \nredline = [\"South Station\",\"Park Street\",\"Kendall\",\"Central\",\"Harvard\",\"Porter\",\"Davis\",\"Alewife\"]\ngreenline = [\"Government Center\",\"Park Street\",\"Boylston\",\"Arlington\",\"Copley\",\"Hynes\",\"Kenmore\"]\norangeline = [\"North Station\",\"Haymarket\",\"Park Street\",\"State\",\"Downtown Crossing\",\"Chinatown\",\"Back Bay\",\"Forest Hills\"]\n\nrefer = {\n\"Red\" => redline,\n\"Green\" => greenline,\n\"Orange\" => orangeline,\n} \n\n\n intro1 = \"You must travel through the following stops on the #{startLine}:\"\n intro2 = \"Your trip continues through the following stops on #{endLine}:\" \n\n\n #if you are in the same line then just count it onece \nif startLine == endLine\nsingleLine(refer[startLine], startPos, endPos)\nelse\np intro1\narr1 = singleLine(refer[startLine], startPos, \"Park Street\")\np arr1[0]\np intro2\narr2 = singleLine(refer[endLine], \"Park Street\", endPos)\np arr2[0]\np \"#{arr1[1]+arr2[1]} stops in total.\"\nend\n\n\nend",
"def run_staggered( uri, from, to, step )\n \n # Create a query\n query = RDTQuery.new( uri )\n \n # Create a silent version of MechReporter\n m = MechReporter.new( false )\n \n # Create a blank Sheet\n ret = RubyExcel::Workbook.new.add 'Report'\n \n # Run the report, stepping through the dates until the end\n ( from..to ).each_slice( step ) { |range| puts \"Running date range #{ range.first.strftime( '%d/%m/%y' ) } - #{ range.last.strftime( '%d/%m/%y' ) }\"; ret << m.run( query.set_dates( range.first, range.last ) ); internal_puts ret.maxrow.to_s + ' lines' }\n \n # Return the combined data\n ret\n \n end",
"def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n chart_device_port = IprannetQosegressinterface.where(device_port: @iprannet_qosegressinterface.device_port).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = chart_device_port.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n @chart_discard_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end",
"def temporal_to_rifcs(builder)\n temporal.each do |x|\n\n builder.coverage {\n builder.temporal {\n \n if (x =~ /^(\\d{4})$/ ||\n x =~ /^(\\d{4}-\\d{2})$/ ||\n x =~ /^(\\d{4}-\\d{2}-\\d{2})$/)\n # Single date (TODO: is having two date elements correct?)\n builder.date($~[1], type: 'dateFrom', dateFormat: 'W3CDTF')\n builder.date($~[1], type: 'dateTo', dateFormat: 'W3CDTF')\n\n elsif (x =~ /^(\\d{4})\\/(\\d{4})$/ ||\n x =~ /^(\\d{4}-\\d{2})\\/(\\d{4}-\\d{2})$/ ||\n x =~ /^(\\d{4}-\\d{2}-\\d{2})\\/(\\d{4}-\\d{2}-\\d{2})$/)\n # Date range\n builder.date($~[1], type: 'dateFrom', dateFormat: 'W3CDTF')\n builder.date($~[2], type: 'dateTo', dateFormat: 'W3CDTF')\n\n else\n # Unrecognised temporal value, treat as text\n builder.text_(x)\n end\n } # </temporal>\n } # </coverage>\n end\n\n end",
"def retrieve_date_range_11\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)\n @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)\n end",
"def get_update\n str = \"Performance Restriction of #{speed_restriction} #{speed_restriction_unit}\"\n\n segment_type = transam_asset.try(:infrastructure_segment_unit_type)\n\n if segment_type.present? && segment_type != InfrastructureSegmentUnitType.find_by(name: 'Lat / Long')\n str << \" From: #{from_line} #{from_segment}\"\n str << \" - To: #{to_line} #{to_segment}\" if to_line.present? || to_segment.present?\n end\n str << \" for #{performance_restriction_type}\"\n\n str\n end",
"def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end",
"def index\n @customer_segments = CustomerSegment.all\n end",
"def find_stations(si, ei, line) # si is short for start index and ei is short for end index\n if ei >= si\n line_stop_count = ei - si\n passing_stations = line[(si+1)..ei].join(\", \")\n else\n line_stop_count = si - ei\n passing_stations = line[(ei)..(si-1)].reverse.join(\", \")\n end\n return {:num_stops => line_stop_count, :stops => passing_stations}\nend",
"def get_app_traffic(start_date, end_date)\n total_vc = Array.new\n while start_date.next_week < end_date\n total_vc.push get_all_viewcounts(start_date.utc, start_date.next_week.utc)\n start_date = start_date.next_week\n end\n total_vc\n end",
"def get_service_contacts(service_id, start_date, end_date)\n get_agent_contacts(service_group_id: -1,\n service_id: service_id,\n team_name: '',\n agent_id: -1,\n start_date: start_date,\n end_date: end_date,\n contact_type: 'PBX EMAIL SMS FAX SCAN CHAT COBRO MANUAL FACE TASK VIDEO')\n end",
"def validate_service_range\n errors.add(:service_start_date, \"service_start_date required\") unless service_start_date\n errors.add(:service_end_date, \"service_end_date required\") unless service_end_date\n if service_start_date && service_end_date\n errors.add(:service_start_date, \"service_start_date begins after service_end_date\") if service_start_date > service_end_date\n end\n end",
"def returnservicearray(aclservicename)\n\tservicevalue = aclservicename\n\tif (servicevalue =~ /lt \\d+/)\n\t\tvalue = servicevalue.scan(/lt (\\d+)/)\n\t\tvalue.flatten!\n\t\tservicerange = [0,value[0]]\n\t\treturn servicerange\n\telsif (servicevalue =~ /gt \\d+/)\n\t\tvalue = servicevalue.scan(/gt (\\d+)/)\n\t\tvalue.flatten!\n\t\tservicerange = [value[0],65535]\n\t\treturn servicerange\n\telsif (servicevalue =~ /eq \\d+/)\n\t\tvalue = servicevalue.scan(/eq (\\d+)/)\n\t\tvalue.flatten!\n\t\tservicerange = [value[0],value[0]]\n\t\treturn servicerange\n\telsif (servicevalue =~ /range \\d+ \\d+/)\n\t\tvalue = servicevalue.scan(/range (\\d+) (\\d+)/)\n\t\tvalue.flatten!\n\t\tservicerange = [value[0],value[1]]\n\t\treturn servicerange\n\telse \n\t\tservicerange = []\n\t return servicerange\n\tend\n end",
"def claim_to_date\n if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime(\"%Y%m%d\"))\n ['DTM', '233', @eob.claim_to_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def claim_to_date\n if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime(\"%Y%m%d\"))\n ['DTM', '233', @eob.claim_to_date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end\n end",
"def segment_0; segments[0]; end",
"def print_segments\n\t\t# METHOD: after all of the HL7 content has been parsed, print the contents of each segment in a more easily readible format\n\t\t# output for 1 segment looks like:\n\t\t\t\t\t#~ :: Segment: PID\n\t\t\t\t\t#~ PID-0: Segment => PID\n\t\t\t\t\t#~ PID-1: Set ID - PID => 1\n\t\t\t\t\t#~ PID-2: Patient ID => \n\t\t\t\t\t#~ PID-3: Patient Identifier List => [[\"P00057804\", \"\", \"\", \"\", \"PN\"], [\"4009887514\", \"\", \"\", \"AUSHIC\", \"MC\"], [\"SMIAL001\", \"\", \"\", \"\", \"PI\"]]\n\t\t\t\t\t#~ PID-4: Alternate Patient ID - PID => \n\t\t\t\t\t#~ PID-5: Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\n\t\t\t\t\t#~ PID-6: Mother’s Maiden Name => \n\t\t\t\t\t#~ PID-7: Date/Time of Birth => 19770621\n\t\t\t\t\t#~ PID-8: Sex => M\n\t\t\t\t\t#~ PID-9: Patient Alias => \n\t\t\t\t\t#~ PID-10: Race => \n\t\t\t\t\t#~ PID-11: Patient Address => [\"818 Beach Road\", \"\", \"BEECHMERE\", \"\", \"4510\", \"AU\", \"H\"]\n\n\t\t\t# iterate over each segment\n\t\t\t@parsed_content.each do |segment|\n\t\t\t\tseg = segment[0]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # eg => \"PID\"\n\t\t\t\t\n\t\t\t\t#get yaml file details\n\t\t\t\tyamlfile = \"hl7specification/#{seg}\"\t\t\t\t\t# for each segment, find the appropriate yaml file (ie one for each segment)\n\t\t\t\tspecs = YAML.load_file(yamlfile)\t\t\t\t\t\t\t# load the yaml file\n\t\t\t\t\n\t\t\t puts \":: #{specs[\"Header\"][\"name\"]} (#{seg})\"\t\t\t# print the text eg \":: Message Header Segment (MSH)\"\n\t\t\t \n\t\t\t # then iterate over each field in the particular segment\n\t\t\t\tsegment.each_with_index do |field, index|\t\t\t\t\t# then for each field...\n\t\t\t\t\tif index > 0 then\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only if the index is 1 or more (ie the first value is not useful here)\n\t\t\t\t\t\tfld = \"#{seg}-#{index}\"\t\t\t\t\t\t\t\t\t # get the field id => \"PID-5\"\n\t\t\t\t\t\tprint \" #{fld}: \"\t\t\t\t\t\t \t\t\t\t\t\t# on each line print the particular field being queried eg \"PID-5: \"\n\t\t\t\t\t\tfldname = specs[fld][\"name\"]\t\t\t\t\t\t\t\t\t# get the name of the field from the yaml file\n\t\t\t\t\t\tprint \"#{fldname} => \"\t\t\t\t\t\t\t\t\t\t\t\t# print the field name after the field eg \"PID-5: Patient Name\"\n\t\t\t\t\t\tif field.class == String then\t\t\t\t\t\t\t\t\t# if the field class is a string...\n\t\t\t\t\t\t\tputs field\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# then just print (ie add) the value of the string eg \"PID-7: Date/Time of Birth => 19770621\"\n\t\t\t\t\t\telsif field.class == Array then\t\t\t\t\t\t\t\t# otherwise if the field is an array, ie there is lower level structure...\n\t\t\t\t\t\t\tputs field.inspect\t\t\t\t\t\t\t\t\t\t\t\t\t# then print the structure eg \"PID-5 Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\"\n\t\t\t\t\t\tend # << end if field...\n\t\t\t\t\tend # << end if index > 0 \n\t\t\t\tend\t # << end segment.each_with_index\n\t\t\t\tputs\t\n\t\t end\t # << end @parsed_content.each\n\t \n\t end",
"def segment_ends_s\n [from_end.to_s, to_end.to_s].join(\"---\")\n end",
"def segment_ends_s\n [from_end.to_s, to_end.to_s].join(\"---\")\n end",
"def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end",
"def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end",
"def forecast_charged(date_from, date_to)\n result = {total: 0, detail: {}}\n month = date_from.month \n year = date_from.year\n last_month = date_to.month\n last_year = date_to.year\n until (month == last_month && year == last_year) do\n result[:detail].store(\"#{year}-#{month.to_s.rjust(2, '0')}\", 0)\n if month == 12\n month = 1\n year += 1\n else\n month += 1\n end\n end\n data = query_strategy.forecast_charged(date_from, date_to)\n data.each do |item| \n result[:total] += item.total\n result[:detail][item.period] += item.total\n end\n return result\n end",
"def stations_in_between2 (end_lane)\n if ($end_connection>$end)\n puts \"then the stations to follow are:\"\n puts $mta[end_lane][$end+1...$end_connection]\n else\n puts \"then the stations to follow are:\"\n puts $mta[end_lane][$end_connection+1...$end].reverse\n end #end of the if\n end",
"def collect\n @logger.info('Extracting reservation data for CSI2CSV data export...')\n reservations = if @filtering_team.instance_of?(Team)\n @logger.info(\"(Filtering for #{@filtering_team.get_full_name} swimmers)\")\n MeetingReservation.where(meeting_id: @meeting.id, team_id: @filtering_team.id).is_coming\n else\n MeetingReservation.where(meeting_id: @meeting.id).is_coming\n end\n\n # Scan involved swimmers\n reservations.each do |meeting_reservation|\n swimmer = meeting_reservation.swimmer\n next unless @meeting.meeting_event_reservations.where(['swimmer_id = ?', swimmer.id]).is_reserved.exists?\n\n badge = meeting_reservation.badge\n gender_type = swimmer.gender_type\n category_type = badge.category_type\n\n @logger.info(\"Swimmer #{swimmer.get_full_name} (#{badge.category_type.code})\")\n @swimmers_reservations += 1\n\n # Store the first reservation in order to extract useful team data for the headers later on:\n @first_swimmer_reservation = meeting_reservation if @swimmers_reservations == 1\n\n # Scan reserved events\n @meeting.meeting_event_reservations.where(['swimmer_id = ?', swimmer.id]).is_reserved.each do |meeting_event_reservation|\n swimmer_row = ''\n swimmer_row << \"#{swimmer.complete_name};\"\n swimmer_row << \"#{swimmer.year_of_birth};\"\n swimmer_row << \"#{badge.team_affiliation.name};\"\n\n # Check for no time to set correct notation\n swimmer_row << if meeting_event_reservation.is_no_time\n '999998;'\n else\n \"#{meeting_event_reservation.get_timing_flattened};\"\n end\n\n # Badge number if present or single space if not\n swimmer_row << \"#{badge.number != '?' ? badge.number : ' '};\"\n\n # Find out csi gender-category-event code\n swimmer_row << \"#{get_csi_reservation_code(gender_type, category_type, meeting_event_reservation.event_type)};\"\n\n # Enod of line character sequence \";\"\n swimmer_row << '\";\"'\n @csi_data_rows << swimmer_row\n end\n end\n # After we have collected the reservations, we can prepare the headers and footer if needed:\n # prepare_header_titles()\n prepare_footer_filler\n end",
"def segmentpairs\n unless defined?(@segmentpairs); parse_segmentpairs; end\n @segmentpairs\n end",
"def validate_service_range\n if service_start_date && service_end_date\n errors.add(:service_start_date, \"service_start_date begins after service_end_date\") if service_start_date > service_end_date\n end\n end",
"def segment_names_a\n [from.value, to.value]\n end",
"def intersectWithSegmentAsLineResult seg\n # self is the intersection \n self\n end",
"def refere_based_on_diput\n yy = self.starting_at.year\n mm = self.starting_at.month\n if yy >= 2000\n yy = yy - 2000\n end\n if yy > 1900\n yy = yy - 1900\n end\n diput = !self.subscriber.blank? ? self.subscriber.diput : self.client.diput\n (yy * 10000000000) + (mm * 100000000) + diput.to_i\n end",
"def prepare_interest_svc_line(batch, facility)\r\n interest = insurance_payment_eob.claim_interest.to_f\r\n charge = service_procedure_charge_amount.to_f\r\n\r\n if facility.details[:service_date_from]\r\n min_date = insurance_payment_eob.find_least_date_for_interest_svc_line\r\n end\r\n min_date ||= batch.bank_deposit_date\r\n insurance_payment_eob.total_submitted_charge_for_claim =\r\n ( insurance_payment_eob.total_submitted_charge_for_claim - charge )+ interest\r\n insurance_payment_eob.total_amount_paid_for_claim =\r\n ( insurance_payment_eob.total_amount_paid_for_claim - charge ) + interest\r\n insurance_payment_eob.save\r\n \r\n { :service_procedure_charge_amount => interest,\r\n :service_paid_amount => interest,\r\n :date_of_service_from => min_date, :date_of_service_to => min_date }\r\n end",
"def processField008(field)\n return nil if field.nil?\n field = field.value[6..15]\n if field[0] == \"p\" or field[0] == \"r\"\n \n first_date = field[1..4]\n second_date = field[5..9]\n start_date = first_date.gsub(\"u\", \"9\").to_i\n end_date = second_date.gsub(\"u\", \"9\").to_i\n \n if ( start_date > end_date && !second_date.include?(\"u\") )\n # if the secondDate is lower and there was not a \"u\" in the date field.\n return MARC::DataField.new('980', '', ' ', ['a', end_date], ['b', \"008\"], ['c', field[0] ])\n elsif ( start_date > end_date && second_date.include?(\"u\") ) \n # if the 2nd date is lower and there was a 'u', this means we need to add a date range.\n start_date = end_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n elsif ( first_date.include?(\"u\") )\n # first date is larger, but there's a 'u' so, it needs a range. \n end_date = start_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n else\n # at this point, we assume first date was larger and no 'u' so we just add the first date\n return MARC::DataField.new('980', '', ' ', ['a', start_date], ['b', \"008\"], ['c', field[0] ])\n end\n\n end\n end",
"def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += self.direct_costs_for_visit_based_service_single_subject(line_items_visit) * self.indirect_cost_rate\n end\n return total\n else\n return 0\n end\n end",
"def specific_days_in_semester\n date_start = USDateParse(self.start_date)#USDateParse(self.start_date)\n date_end = USDateParse(self.end_date)#USDateParse(self.end_date)\n curr_date = date_start\n date_hash = Hash.new(0)\n while curr_date <= date_end do\n if (! self.individual_dates_with_no_classes.include?(curr_date))\n date_hash[curr_date.cwday] += 1\n end\n curr_date += 1\n end\n return date_hash\n end",
"def getting_stops on_line, on_stop, off_line, off_stop\n\tstops = []\n\n\tif is_same_line(on_line, off_line)\n\t\texit if on_line.index(on_stop) == on_line.index(off_stop) \n\t\t\t\n\t\tstops << (on_line[ on_line.index(on_stop)..on_line.index(off_stop) ]) \n\t\t\"you have to travel through: #{ stops.join(\" -> \") }\"\n\n\telse\n\t\tif is_left_to_union(on_line, on_stop, \"Union Square\")\n\t\t\tstops << on_line[on_line.index(on_stop)..on_line.index(\"Union Square\")]\n\n\t\telse\n\t\t\tstops << on_line[on_line.index(\"Union Square\")..on_line.index(on_stop)].reverse\n\t\tend\n\n\t\tif is_left_to_union(off_line, off_stop, \"Union Square\")\n\t\t\tstops << off_line[off_line.index(off_stop)..off_line.index(\"Union Square\")].reverse\n\n\t\telse\n\t\t\tstops << off_line[off_line.index(\"Union Square\")..off_line.index(off_stop)]\n\t\tend\n\n\t\t# delete \"Union Square\" from stops[1] as it is duplicate with stops[0]\n\t\tstops[1].shift\n\n\t\t\"You have to travel through: #{ stops[0].join(\" -> \") }\\n Change at: Union Square\\n Your travel continues through: #{ stops[1].join(\" -> \") }\\n The total number of stops you have to travel is: #{ stops.flatten.length }\"\n\tend\nend",
"def singleTrip (start_station, end_station, line)\n start_index = MTA[line].index(start_station)\n end_index = MTA[line].index(end_station)\n\n if start_index < end_index\n stops = MTA[line][start_index ... end_index]\n num_stops = end_index - start_index\n end\n\n if end_index < start_index\n stops = MTA[line][end_index ... start_index]\n stops = stops.reverse\n num_stops = start_index - end_index\n\n end\n print = \"You must travel through the following stops on the #{line}: #{stops}\"\n # print = \"#{num_stops} in total\"\nend",
"def statement_from_date\n unless claim_start_date.blank?\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << claim_start_date.strftime(\"%Y%m%d\")\n claim_date_elements.join(@element_seperator)\n end\n end",
"def getFundAppriciationOverTime(port, start_date, end_date)\r\n\r\n\t\t\r\n\r\n\tend",
"def cyclic_occupation_detail(month, year)\n\n date_from = Date.civil(year, month, 1)\n date_to = Date.civil(year, month, -1)\n result = {}\n\n # Get planned activities\n condition = Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new(:date,'$gte', date_from),\n Conditions::Comparison.new(:date,'$lte', date_to)\n ]) \n planned_activities = condition.build_datamapper(::Yito::Model::Booking::PlannedActivity).all(\n :order => [:date, :time, :activity_code]\n ) \n\n # Build the structure\n activities = ::Yito::Model::Booking::Activity.all(active: true, occurence: :cyclic)\n\n activities.each do |activity|\n \n # Build item prices hash\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n \n\n # Fill with the activity turns\n activity_detail = {}\n activity.cyclic_turns_summary.each do |turn|\n # Build days hash\n days = {}\n (1..(date_to.day)).each do |day| \n date = Date.civil(year, month, day)\n modified_capacity = planned_activities.select do |item|\n item.date.strftime('%Y-%m-%d') == date.strftime('%Y-%m-%d') and \n item.time == turn and\n item.activity_code == activity.code\n end\n real_capacity = modified_capacity.size > 0 ? modified_capacity.first.capacity : activity.capacity\n\n if activity.cyclic_planned?(date.wday)\n days.store(day, {quantity: (item_prices.empty? ? 0 : item_prices.clone),\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: true})\n else\n days.store(day, {quantity: '-',\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: false})\n end \n end\n activity_detail.store(turn, days) \n end\n\n # Store the item\n result.store(activity.code, {name: activity.name,\n capacity: activity.capacity,\n price_literals: activity.price_definition_detail,\n number_of_item_price: activity.number_of_item_price,\n occupation: activity_detail})\n end\n\n # Fill with the orders\n\n sql =<<-SQL\n select o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, CAST (o_i.status AS UNSIGNED) as status, sum(quantity) as quantity\n from orderds_order_items o_i\n join orderds_orders o on o.id = o_i.order_id\n join bookds_activities a on a.code = o_i.item_id \n where o.status NOT IN (3) and o_i.date >= ? and o_i.date <= ? and \n a.occurence IN (3)\n group by o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, o_i.status\n SQL\n\n orders = repository.adapter.select(sql, date_from, date_to)\n\n orders.each do |order|\n if result[order.item_id] and\n result[order.item_id][:occupation] and\n result[order.item_id][:occupation][order.time] and \n result[order.item_id][:occupation][order.time][order.date.day]\n # Prepare not planned activities that have been ordered\n if result[order.item_id][:occupation][order.time][order.date.day][:quantity] == '-'\n activity = ::Yito::Model::Booking::Activity.first(code: order.item_id)\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n result[order.item_id][:occupation][order.time][order.date.day][:quantity] = item_prices\n end\n if result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] and\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type]\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type] += order.quantity if order.status == 1\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] += order.quantity if order.status == 2\n end\n end\n end\n\n # Result\n result\n\n end",
"def show\n @bill_dates = @service.bill_dates.page params[:bill_date_page]\n @service_dates = @service.sort_service_dates\n end",
"def get_values(from_date, to_date)\n self.spc_values.select(\"work_date, seq, val1, val2, val3, val4, val5, x_val, r_val, x_usl, x_lsl, r_usl, r_lsl\").where(\"spc_item_id = ? and work_date between ? and ?\", self.id, from_date, to_date).order(\"work_date asc, seq asc\")\n end",
"def calculate_time_from_to_cost\n\n time_cost = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_price', '0')\n if time_cost != '0'\n\n # Check if the reservation correspond to the main season or not\n main_season_month_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_from', 1).to_i\n main_season_day_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_from', 1).to_i\n main_season_month_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_to', 12).to_i\n main_season_day_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_to', 31).to_i\n\n if main_season_month_from == 1 and main_season_day_from == 1 and main_season_month_to == 12 and main_season_day_to == 31\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else\n # JAN DIC\n # -------------------------------------\n # ^=======================^\n # from to\n if main_season_month_from <= main_season_month_to or \n (main_season_month_from == main_season_month_to and main_season_day_from <= main_season_day_to) \n if (@date_from.month >= main_season_month_from or \n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) and\n (@date_to.month <= main_season_month_to or \n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to)) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n else\n # JAN DIC\n # -------------------------------------\n # ======^ ^======\n # to from\n if ((@date_from.month >= main_season_month_from or\n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) or\n (@date_from.month <= main_season_month_to or \n (@date_from.month == main_season_month_to and @date_from.day <= main_season_day_to))\n ) and\n ((@date_to.month >= main_season_month_from or\n (@date_to.month == main_season_month_from and @date_to.day >= main_season_day_from)) or\n (@date_to.month <= main_season_month_to or\n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to))) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n end\n end\n\n #p \"timetable_id: #{timetable_id} -- main season: #{main_season_day_from}-#{main_season_month_from} #{main_season_day_to}-#{main_season_month_to}\"\n\n time_cost = BigDecimal.new(time_cost)\n if timetable_id > 0\n if timetable = ::Yito::Model::Calendar::Timetable.get(timetable_id)\n @time_from_cost = calculate_time_cost(@date_from, @time_from, time_cost, timetable)\n @time_to_cost = calculate_time_cost(@date_to, @time_to, time_cost, timetable)\n end\n end\n\n end\n end",
"def segmentation\n # Total\n @mic[\"total\"] = status_count(@total_mic)\n\n # PACPOA: contagem separada por matriz e programa = PACPOA\n matriz_pacpoa = ['CARNE', 'LEITE', 'OVO', 'PESCADO']\n matriz_pacpoa.each do |matriz|\n segment = @total_mic.programa('PACPOA').matriz(matriz)\n @mic[\"PACPOA_#{matriz}\"] = status_count(segment)\n end\n\n # PNCP: contagem separada por programa\n pncp = ['Listeria', 'Aves', 'STEC', 'Suínos']\n pncp.each do |name|\n segment = @total_mic.programa(name)\n @mic[\"PNCP_#{name}\"] = status_count(segment)\n end\n\n # Bebidas nao alcoolicas: amostras de origem vegetal\n bebidas = @total_mic.matriz('VEGETAL')\n @mic['bebidas'] = status_count(bebidas)\n\n # Outros\n @mic['outros'] = others(@mic)\n end",
"def bus_available(from_city,to_city)\n @variable = @line_id\n @buses = []\n # p \"--------Current User(#{current_user.id})---------------\"\n #freq = 7\n \n @line_id.each do |line|\n available_buses = Bus.where(route_id: line, status: true)\n # p \"--------Line Id: #{line}--Bus #{available_buses.present?}---------\"\n\n if available_buses\n\n available_buses.each do |bus|\n # p \"---------Bus#{bus.bus_timings.find_by(city: from_city.name).day_of_deperture}-City#{from_city.name}----------\"\n \n\n freq = bus.frequency\n bus_time = bus.bus_timings\n \n\n start_date = bus.start_date + (day_offset = (bus_time.find_by(city: from_city.name).day_of_deperture - 1)).day\n end_date = bus.end_date + (bus_time.find_by(city: from_city.name).day_of_deperture - 1).day\n\n # p \"-------Start #{start_date}--End #{end_date}-------\" \n\n var = start_date - freq.day\n # p \"----------var#{var}------------\"\n\n (start_date..end_date).step(freq) do |date|\n\n if (Date.today <= date) && seat_availability(bus,(date - day_offset.day))\n @buses << {\"user_id\" => current_user,\"bus_id\" => bus.id, \"date\" => date, \"start_date\" => (date - day_offset.day), \"start_time\" => bus_time.first.deperture ,\"route\" => LineColorRoute.find(line).name ,\"source\" => from_city.name.titleize, \"departure\" => bus_time.where(city: from_city.name).first.deperture,\"destination\" => to_city.name.titleize, \"arrival\" => bus_time.where(city: from_city.name).last.arrival }\n end\n \n end\n end\n end\n end\n @buses = @buses.sort_by{ |hash| hash[\"date\"]}\n end",
"def append_matter_date_cond(search,conditions_hash)\n\n \n search += \" AND created_at Between :start_date AND :end_date \" if params[:get_records] == \"My\"\n \n time = nil\n case params[:report][:duration]\n when \"1\" #1 months\n time = Time.zone.now.last_month\n when \"2\" #3 months\n 3.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n when \"3\" #6 months\n 6.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n else #date range given\n conditions_hash[:start_date] = params[:date_start].to_time\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\n end\n if params[:report][:duration] != \"range\"\n conditions_hash[:start_date] = time\n conditions_hash[:end_date] = Time.zone.now\n end\n search\n end",
"def print_mc\n if @minimal_segment_count == segment_count+1\n print \"0\\n\";\n else\n print \"#{@minimal_segment_count}\\n\"\n for i in 0..segment_count-1\n if is_in_mc?(i)\n get_segment(i).to_s2\n end\n end\n end\n end",
"def driver_service_agreement\n @job = Job.joins(:company).where(companies: { disabled: false }).where(id: params[:job])\n @months = %w[January February March April May June July August September October November December]\n\n if @job.length == 1\n @job = @job.first\n @job_start_day = @job.starts_on.day.to_s\n\n # rubocop:disable Metrics/LineLength\n if (@job_start_day[1] == \"1\") || (@job_start_day == \"1\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"st\"\n elsif (@job_start_day[1] == \"2\") || (@job_start_day == \"2\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"nd\"\n elsif (@job_start_day[1] == \"3\") || (@job_start_day == \"3\") && (@job_start_day.to_i < 11) && (@job_start_day.to_i > 20)\n @job_start_day += \"rd\"\n else\n @job_start_day += \"th\"\n end\n # rubocop:enable Metrics/LineLength\n\n @job_start_month = @months[@job.starts_on.month]\n\n @job_start_year = @job.starts_on.year\n\n if @job.driver.nil?\n @job = nil\n elsif current_user.driver? && @job.driver.id != current_user.id\n @job = nil\n elsif current_user.company_user? && @job.company.id != current_user.company.id\n @job = nil\n end\n else\n @job = nil\n end\n end",
"def compute_lq(patient_type)\n segments = []\n patient_code = service.send(\"#{patient_type}patient_code\")\n facility_payer_information = FacilitiesPayersInformation.find_by_payer_id_and_facility_id(payer.id, facility.id) if payer\n if facility_payer_information\n capitation_code = facility_payer_information.capitation_code\n if(patient_type == \"in\")\n allowance_code = facility_payer_information.in_patient_allowance_code\n payment_code = facility_payer_information.in_patient_payment_code\n else\n allowance_code = facility_payer_information.out_patient_allowance_code\n payment_code = facility_payer_information.out_patient_payment_code\n end\n \n end\n unless patient_code.blank?\n patient_code_array = patient_code.split(\",\")\n segments << (lq_rx_segments(allowance_code) if patient_code_array.include?(\"1\") and !allowance_code.blank?)\n segments << (lq_rx_segments(capitation_code) if patient_code_array.include?(\"2\") and !capitation_code.blank?)\n end\n serv_amt = service.service_paid_amount.to_f\n pat_type = @eob.patient_type.downcase rescue nil\n \n if serv_amt > 0 and pat_type == \"#{patient_type}patient\"\n segments << (lq_rx_segments(payment_code) unless payment_code.blank?)\n end\n segments\n end",
"def generate_eobs\n Output835.log.info \"\\n\\nPatient account number : #{@eob.patient_account_number}\"\n Output835.log.info \"This EOB has #{@services.length} service lines\"\n Output835.log.info \"This is a CLAIM LEVEL EOB\" if @is_claim_eob\n claim_segments = [claim_payment_loop, include_claim_dates]\n claim_segments << claim_supplemental_info unless @facility.details[:interest_in_service_line]\n claim_segments << claim_level_allowed_amount\n claim_segments << standard_industry_code_segments(@eob, @is_claim_eob) if @is_claim_eob\n claim_segments << service_payment_info_loop unless @is_claim_eob\n update_clp! claim_segments\n claim_segments.flatten.compact\n end",
"def reservations_by_date(date_query)\n res_list = []\n @reservations.each do |res|\n if res.range.include?(date_query)\n res_list << res\n end\n end \n return res_list \n end",
"def get_stop_details(line)\nx = $subway_lines\n for i in x do\n if line == i[:line]\nline_details = i[:stops]\n end\nend\nline_details\nend",
"def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend",
"def download_data_range(entity, start_date, end_date)\n # custom by API, returning a sample result file\n 'output/entity_1_1529588678.csv'\n end",
"def index\n\n start_date = (params[:start_date].present?) ? params[:start_date] : \"1970-01-01 00:00:00\"\n end_date = (params[:end_date].present?) ? params[:end_date] : \"3000-12-31 00:00:00\"\n @display_start_date = (params[:start_date].present?) ? params[:start_date] : \"\"\n @display_end_date = (params[:end_date].present?) ? params[:end_date] : \"\"\n values = {start_date: start_date, end_date: end_date}\n conditions = [\"date_of_service >= :start_date\",\"date_of_service <= :end_date\"]\n @unpaid = (params[:search_type] == \"unpaid\")\n if params[:query].present? \n @query = params[:query] \n values[:vendor] = @query\n conditions << \"vendor = :vendor\"\n #@awards = Award.where(\"vendor = ? AND date_of_service >= ? AND date_of_service <= ?\", params[:query],start_date,end_date).order(created_at: :desc)\n #else\n #@awards = Award.where(\"date_of_service >= ? AND date_of_service <= ?\", start_date,end_date).order(created_at: :desc)\n end\n @awards = Award.includes(:patient).where(conditions.join(\" AND \"), values)\n @awards.to_a.reject! { |a| a.patient.nil? }\n @awards = @awards.sort_by { |a| a.patient.last_name }\n #@vendors = Award.all.map {|a| [a.vendor, a.vendor]};\n @vendors = Award.uniq.pluck(:vendor)\n @vendors.unshift([\"All\", \"\"])\n end"
] |
[
"0.6629668",
"0.59278655",
"0.5803223",
"0.565906",
"0.5452688",
"0.54257756",
"0.52251405",
"0.5195947",
"0.5170736",
"0.51558065",
"0.5110476",
"0.5109761",
"0.5103426",
"0.50876486",
"0.5058007",
"0.5046841",
"0.5042525",
"0.50308174",
"0.5021806",
"0.5013138",
"0.49822974",
"0.4956197",
"0.4925654",
"0.4921575",
"0.49017614",
"0.49000773",
"0.48926312",
"0.48854533",
"0.48699325",
"0.48670563",
"0.48553956",
"0.4842641",
"0.48417446",
"0.48191375",
"0.48104185",
"0.48048326",
"0.48048326",
"0.48048326",
"0.4787771",
"0.47687513",
"0.47572553",
"0.47519028",
"0.4746545",
"0.4733603",
"0.47247732",
"0.4723633",
"0.47161734",
"0.47100002",
"0.47089294",
"0.46902826",
"0.4682154",
"0.46771064",
"0.4658397",
"0.46455735",
"0.46411267",
"0.46285376",
"0.46168765",
"0.46156627",
"0.46115026",
"0.4609658",
"0.4609101",
"0.4609101",
"0.46075082",
"0.46026966",
"0.46013686",
"0.46013686",
"0.4599313",
"0.45965144",
"0.45947197",
"0.45907348",
"0.4588146",
"0.45857555",
"0.45855117",
"0.45806524",
"0.4573984",
"0.456984",
"0.4568682",
"0.456567",
"0.45610407",
"0.45607057",
"0.4551164",
"0.4544055",
"0.45374224",
"0.45373225",
"0.45359418",
"0.45350292",
"0.4533255",
"0.45273837",
"0.45269218",
"0.45152873",
"0.4515043",
"0.4514458",
"0.4509103",
"0.450804",
"0.4507026",
"0.4501518",
"0.45008165",
"0.44993067",
"0.4493205",
"0.448944"
] |
0.7368086
|
0
|
Method deletes the leading and trailing spaces of string. Method is called for GS03 facility name as per the requirement Feature 23701
|
def strip_string string
string.strip
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end",
"def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend",
"def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend",
"def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend",
"def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend",
"def cleanup(str)\n str.gsub(/[^a-z]/,\" \").squeeze(\" \")\nend",
"def cleanup(string)\n string.gsub(/[\\W\\d]/, ' ').gsub(/\\s+/, ' ')\nend",
"def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend",
"def cleanup2(string)\n string.gsub(/[^a-z]/i, ' ').squeeze\nend",
"def remove_excess_whitespace_from_name\n self.name = name&.split&.join(' ')\n end",
"def cleanup(string)\n string = string.gsub(/[^a-z]/i, ' ')\n until !string.include?(' ')\n string.gsub!(' ', ' ')\n end\n string\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend",
"def cleanup(string)\n string.gsub!(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/i, \" \").squeeze(' ')\nend",
"def cleanup(str)\nstr.gsub!(/[^0-9A-Za-z]/, \" \").squeeze(\" \")\n\nend",
"def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def cleanup(str)\n\tnew_str = str.gsub(/[^a-z]/i, ' ').split.join(' ')\n\t\" #{new_str} \"\nend",
"def cleanup(str)\n str.gsub(/[^a-zA-Z]+/, ' ')\nend",
"def cleanup(string)\n string.gsub(/[^A-Za-z0-9]/, \" \").squeeze\nend",
"def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend",
"def cleanup(str)\n str.gsub!(/[^a-z]+/i, ' ') if str.match(/[^a-z]+/i)\n str\nend",
"def cleanup(string)\n\ts = string.gsub(/[^0-9a-z]/i, ' ')\n\ts.squeeze(\" \")\nend",
"def cleanup(text)\n text.gsub(/[^a-z]/i,\" \").squeeze(\" \")\nend",
"def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend",
"def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend",
"def cleanup(str)\r\n str.chars.map {|char| char.match(/[A-Za-z0-9]/) ? char : ' ' }.join.squeeze(\" \")\r\nend",
"def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end",
"def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend",
"def cleanup(string)\n string.gsub!(/[^a-z]/i, \" \") #/i makes it case insensitive\n\n loop do\n string.gsub!(\" \", \" \")\n break if !string.include?(\" \")\n end\n string\nend",
"def cleanup(string)\n characters = string.chars\n characters.each_with_index do |char, index|\n if !('a'..'z').include?(char.downcase)\n if characters[index - 1] == ' '\n characters[index - 1] = ''\n characters[index] = ' '\n else\n characters[index] = ' '\n end\n end\n end\n characters.join\nend",
"def dustoff(str)\n str = str.gsub PERIOD, ' '\n str = str.squeeze ' '\n str.strip\n end",
"def cleanup(string)\n string.gsub!(/\\W/, ' ').squeeze(' ')\nend",
"def cleanup(str)\n str.gsub(/\\W+/,' ')\nend",
"def clean_string s\n s.gsub(/\\s/, \"\")\n end",
"def trim_name_whitespace!\r\n self.name.strip!\r\n end",
"def cleanup(str)\n str.gsub(/\\W/, ' ').squeeze(' ')\nend",
"def cleanup(string)\n letters = %w(a b c d e f g h i j k l m n o p q r s t u w v x y z\n A B C D E F G H I J K L M N O P Q R S T U W V X Y Z )\n index = 0\n loop do\n string[index] = ' ' unless letters.include?(string[index])\n index += 1\n break if index == string.size\n end\n string.squeeze(' ')\nend",
"def remove_whitespace\n self.name = self.name.strip\n self.phone = self.phone.strip\n end",
"def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end",
"def cleanup string\n string.gsub(/\\W|\\d/, ' ').gsub(/\\ (?=\\ )/, '')\nend",
"def evaporate\n self.gsub(/\\s/, '')\n end",
"def cleanup(string)\n string.gsub!(/\\W+/, ' ')\nend",
"def cleanup(str)\n str.gsub(/\\W+/, ' ')\nend",
"def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end",
"def cleanup(str)\n str.chars.map { |char| ('a'..'z').include?(char.downcase) ? char : ' ' }.join.squeeze(' ')\nend",
"def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end",
"def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end",
"def strip_strings\n self.name = name.strip\n end",
"def strip_strings\n self.name = name.strip\n end",
"def cleanup(str)\n clean = str.chars.map do |char|\n ('a'..'z').include?(char) ? char : ' '\n end\n clean.join.squeeze(' ')\nend",
"def cleanup(str)\n output = [] \n no_go = false\n str = str.gsub(/[^A-Za-z0-9 ]/, ' ').split(\"\")\n str.each_index do |i|\n if str[i]==\" \"\n output.push(str[i]) unless no_go == true\n no_go = true\n else\n output.push(str[i]) \n no_go = false\n end\n end\n output.join\nend",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def cleanup(str)\n letters = (\"a\"..\"z\")\n\n str = str.split(\"\").map do |char|\n p char\n if letters.include?(char)\n char\n else \n \" \"\n end\n end\n\n str = str.join\n\n str.squeeze!(\" \")\nend",
"def clean_name\n clean_name = name.strip\n clean_name.gsub!(/\\s+/,'_')\n clean_name.gsub!(/[^0-9A-Za-z_-]/, '_')\n clean_name\n end",
"def name_clean\n self.name.gsub(/_/, \" \")\n end",
"def cleanup(string)\n i = 0\n final = ''\n while i < string.length\n final << (('a'..'z').cover?(string[i]) ? string[i] : ' ')\n i += 1\n end\n final.squeeze(' ')\nend",
"def clean_up_movie_name(value)\n value[0] = '' if value[0] == '*'\n value[-1] = '' if value[-1] == '#'\n value.strip\nend",
"def dewhitespace\n gsub(/\\s+/,' ').strip\n end",
"def remove_unofficial(name)\n\tname = params[:param2]\n\tl_name = name.partition(\" \")\n\tl_name[0].clear\n\tname = \"\"\n\tl_name.each do |word|\n\t\tname += word\n\tend\n\treturn name\n\nend",
"def spacify(str)\n # str.chars.map { |c| c += ' '}.join.rstrip\n str.gsub(/\\w/) {|s| s + ' '}.rstrip\nend",
"def remove_whitespace\n self.time = self.time.strip\n self.description = self.description.strip\n self.venue = self.venue.strip.downcase\n self.location = self.location.strip.downcase\n end",
"def remove_whitespace\n self.first_name = self.first_name.strip\n self.last_name = self.last_name.strip\n self.biography = self.biography.strip\n end",
"def cleanup(str)\n char_clean = []\n str.chars.each do |char|\n if /[a-z]/.match(char)\n char_clean << char\n else\n char_clean << ' ' unless char_clean[-1] == ' '\n end\n end\n char_clean.join\nend",
"def force_strip(str)\n str[0] = \"\"\n end",
"def cleanup(sentence)\n sentence.gsub(/[^a-z]+/i, ' ')\nend",
"def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end",
"def clean(str)\n # remove any underscores\n $temp = str.gsub(\"_\", \" \")\n $temp = $temp.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n end",
"def remove_spaces(string)\n result = ''\n string.chars.each do |k|\n if k == ' '\n result += '%20'\n else\n result +=k\n end\n end\n result\nend",
"def clean(str)\n # remove any underscores\n $temp = str.gsub(\"_\", \" \")\n $temp = $temp.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n end",
"def sans_whitespace_and_commas\n @str.gsub(' ', '').gsub(',', '')\n end",
"def remove_whitespaces(myString)\n\treturn myString.gsub(/\\s+/, \"\")\nend",
"def space_out_letters(person)\n return person.split(\"\").join(\" \")\nend",
"def remove_formatting(str)\n Name.clean_incoming_string(str.gsub(/[_*]/, ''))\n end",
"def condense_spaces(str)\n str.gsub(/\\s+/, \" \")\n end",
"def admin_strip_text(str)\n\t\tstr.gsub(/\\t|\\n/,'')\n\t\tstr.strip\n\tend",
"def space_out\n gsub(/(.)/, ' \\1')\n end",
"def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end",
"def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end",
"def snake_to_space(string)\n string.to_s.gsub(/_/, ' ')\n end",
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def sanitize_data str\n str.to_s.strip.gsub(%r{^(-\\s)+}, \"\")\n end",
"def cleanup(str)\n new_string = []\n characters = ['-', \"'\", '+', '*', '&', '?']\n str.chars.each do |c|\n characters.include?(c) ? new_string << ' ' : new_string << c\n end\n new_string.join.squeeze\nend",
"def cleanup(string)\n new_string = ''\n\n string.chars.each_with_index do |char, index|\n char_alphanumeric = char.match(/[a-z0-9]/)\n if index == 0\n prior_char_alphanumeric = true\n else\n prior_char_alphanumeric = string[index - 1].match(/[a-z0-9]/)\n end\n\n\n # p [char_alphanumeric, prior_char_alphanumeric]\n\n if char_alphanumeric\n new_string << char\n elsif prior_char_alphanumeric\n new_string << ' '\n end\n end\n\n new_string\nend",
"def cleanCategoryTitle string\n string.strip.upcase\n end",
"def no_space(x)\n x.gsub(\" \", \"\")\nend",
"def clean( input )\n input.gsub( %r/\\s+/, '' )\n end",
"def cleanse_name\n return if self.name.nil?\n self.name = self.name.strip\n self.name = nil if self.name.length == 0\n end",
"def clean(line)\n ### FILL IN YOUR CODE HERE\n n = line.downcase\n c = n.gsub(/[^a-zA-z]/,\" \")\n end",
"def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end",
"def lstrip() end",
"def remove_blanks(str)\n str.blank? ? \".\" : str.to_s.gsub(/\\s+/, \"_\")\n end",
"def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end",
"def sanitize_name(name)\n name.gsub(/\\//,\"\").gsub(/\\s/, \"-\").downcase\nend",
"def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end",
"def white_out(str)\n str.delete(\" \\n\\t\")\nend",
"def trim_job_name(job_name)\n job_name = job_name.gsub('grid-', '');\n job_name = job_name.gsub('store-', '');\n job_name = job_name.gsub('sphere-', '');\n job_name = job_name.gsub('-public-deb', '');\n job_name = job_name.gsub('-private-deb', '');\n job_name = job_name.gsub('solr', 's');\n job_name = job_name.gsub('automation', 'am');\n job_name = job_name.gsub('webtests-production', 'wp');\n job_name = job_name.gsub('webtests-staging', 'ws');\n job_name = job_name.gsub('checkout', 'co');\n job_name = job_name.gsub('saucelabs', 'slabs');\n return job_name\nend",
"def cleanup(string)\n array = string.chars\n output = \"\"\n i = 0\n for i in (i..array.length-1)\n if array[i] =~ /[A-Za-z]/\n output << array[i]\n else\n output << \" \"\n end\n output.gsub!(\" \", \" \")\n i += 1\n end\n output\nend",
"def cleanup(string)\n string.gsub!(/^--- $/, \"\")\n end",
"def removing_spaces(isbn)\r\n\tisbn.gsub(\" \", \"\") #this strips the space and redefines isbn using the !\r\nend"
] |
[
"0.70609325",
"0.7005709",
"0.6936905",
"0.68915313",
"0.6854763",
"0.6831271",
"0.68074477",
"0.6806049",
"0.6802723",
"0.679799",
"0.67812824",
"0.6748708",
"0.67476606",
"0.6739367",
"0.67221814",
"0.67209643",
"0.6687914",
"0.66739005",
"0.66401035",
"0.66086346",
"0.6580791",
"0.65657985",
"0.6557549",
"0.65260524",
"0.6506486",
"0.646979",
"0.64693576",
"0.6454741",
"0.6452216",
"0.64367723",
"0.64267236",
"0.6425855",
"0.64101094",
"0.64043677",
"0.64019376",
"0.6389514",
"0.63795376",
"0.63714063",
"0.63710725",
"0.6370038",
"0.63636047",
"0.6338431",
"0.633154",
"0.6331489",
"0.63046795",
"0.62931025",
"0.6283092",
"0.6270305",
"0.6261948",
"0.6261948",
"0.6237661",
"0.6225382",
"0.6219625",
"0.6214427",
"0.61991715",
"0.6196419",
"0.619271",
"0.6159924",
"0.6159018",
"0.6153307",
"0.61515516",
"0.61450213",
"0.6144551",
"0.6142593",
"0.61368495",
"0.61068547",
"0.61058164",
"0.60980314",
"0.60975635",
"0.60968",
"0.60905194",
"0.6090457",
"0.60892767",
"0.6086253",
"0.6084495",
"0.60737985",
"0.60438347",
"0.60430115",
"0.60430115",
"0.60414404",
"0.60385555",
"0.60385555",
"0.6038088",
"0.6001026",
"0.60002625",
"0.5996198",
"0.5982835",
"0.5982619",
"0.5981912",
"0.5977564",
"0.5955707",
"0.5946403",
"0.59458315",
"0.59414124",
"0.5937266",
"0.5928268",
"0.59270215",
"0.59247214",
"0.59179735",
"0.59138066",
"0.59104466"
] |
0.0
|
-1
|
=> 1.5 This method is analogous to reduce(:+):
|
def my_sum(arr)
accumulator = arr.first # store first element as accumulator
arr.each_index do |idx|
next if idx == 0 # skip first element: it's already the accumulator
accumulator += arr[idx] # increment accumulator by current element
end
accumulator
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum(element)\n element.reduce(:+)\nend",
"def sum(a)\n a.reduce(&:+)\nend",
"def sum\n self.inject(:+)\n end",
"def sum\n reduce(0, &:+)\n end",
"def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend",
"def sum\n\t\treturn self.reduce(:+)\n\tend",
"def total(a)\n\ta.reduce(:+)\nend",
"def total(arr)\n x = arr.reduce(:+)\n return x\nend",
"def sum(nums)\n nums.reduce(&:+)\nend",
"def sum(i) \n i.inject(:+)\nend",
"def find_sum\n self.inject(0) { |sum, x| sum + x.to_f }\n end",
"def sum\n self.reduce('lambda{|sum, item| sum + item}')\n end",
"def total(numbers)\n numbers.reduce(:+)\nend",
"def total(numbers)\n return numbers.reduce(:+)\nend",
"def total(list)\n\n p list.reduce(:+)\n \nend",
"def sum(arr)\n arr.reduce(0, :+)\nend",
"def total(nums)\n nums.inject(:+)\nend",
"def total(arr)\n arr.inject(:+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def total(array)\n array.inject(:+)\nend",
"def total(arr)\n return arr.inject(:+)\nend",
"def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend",
"def sum (array)\n total = 0.0\n array.each { |elem| total += elem }\n total\nend",
"def my_sum(arr)\n arr.inject(:+)\nend",
"def sum(numbers)\n numbers.reduce(&:+)\n end",
"def sum(arr)\n arr.inject(:+)\nend",
"def sum\n flatten.compact.inject(:+)\n end",
"def get_sum(a, b)\n [a,b].reduce(&:+)\nend",
"def total(an_array)\n an_array.reduce(:+)\nend",
"def sum(array)\n total = 0.0\n array.each { |num| total += num }\n return total\nend",
"def total(list)\n list.reduce(:+)\nend",
"def sum(a)\n a.reduce(0) {|b,c| b + c}\nend",
"def sum(num, total) => total += num",
"def total(array)\n sum = array.inject(:+)\n sum\nend",
"def sum(numbers)\n numbers.inject(0, :+)\nend",
"def sum arr\n return arr.inject(0, :+)\nend",
"def square_of_sum(vals)\n vals.reduce(:+) ** 2\nend",
"def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend",
"def total_of_array(array)\n array.inject(&:+)\nend",
"def sum(arr)\n arr.inject(0.0) { |sum, el| sum + el.to_f }\n end",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def total(array)\n\tarray.inject(:+)\nend",
"def average(nums)\n sum = 0\n # nums.each {|num| sum += num}\n sum = nums.reduce(:+)\n sum.to_f / nums.count\nend",
"def reduce_to_sum(target_sum)\n current_sum = self.sum\n gap = current_sum - target_sum\n if gap < 0\n return nil\n elsif gap == 0\n return self.collect { |value| [value, value] }\n else\n reduced = 0\n result = self.collect do |value|\n x = (gap * value) / current_sum # Floats round here\n reduced += x\n [value, value - x]\n end\n # Second pass, as target sum is not reached yet due to rounding of floats\n (gap - reduced).times { |i| result[i][1] -= 1 }\n result\n end\n end",
"def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend",
"def total(numbers)\n\tnumbers.inject(:+)\nend",
"def sum(array)\n\tarray.reduce(:+)\nend",
"def sum\n [@r,@g,@b].inject(:+)\n end",
"def sum(array)\n array.inject(0, :+)\nend",
"def sum; end",
"def sum arr\n arr.inject(0, :+)\nend",
"def sum arr\n arr.inject(0, :+)\nend",
"def sum arr\n arr.inject(0, :+) \nend",
"def total ( numbers )\r\n\r\n\treturn numbers.reduce(:+);\r\n\r\nend",
"def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend",
"def total_of_array(array)\n array.reduce(:+)\nend",
"def sum_of(array)\n array.inject(0.0) { |sum, e| sum + e }\n end",
"def square_sum\n self.inject(0.0){|accum, i| accum +i**2 }\n end",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_values(arr)\n arr.inject(:+)\n end",
"def sum n\n\tbegin\n\tn.reduce(:+)\n\trescue \n\t\tn.map!{|x| x.is_a?(Array) ? x.reduce(:+) : x }\n\t\tsum n\n\tend\n\tp n.reduce(:+)\nend",
"def total array\n array.reduce(0, :+)\nend",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend",
"def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend",
"def sumList(num)\n\tnum.inject(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\n\nend",
"def mean(numbers)\n Float(numbers.inject(:+)) / numbers.length\nend",
"def sum(array)\n return array.inject(0, &:+)\nend",
"def inject_reduce\n self.list.inject {|sum, n| sum + n }\n end",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def square_of_the_sum\n (1..self).inject(&:+)**2\n end",
"def sum arr\n arr.reduce 0, :+ # reduce method is clearlier than inject. from 0 add to +:\nend",
"def sum(arr)\n\tarr.inject (:+)\n\nend",
"def sum (array)\n y=array.inject(:+).to_i\nend",
"def total\n Float(@values.values.reduce(:+))\n end",
"def total (array)\n array.inject {|m, v| m += v}\nend",
"def reduce_to_total(source_array, starting_point = 0)\n new_sum = source_array.reduce(starting_point, :+)\n return new_sum\nend",
"def sum_of_arr(arr)\n arr.inject(:+)\nend",
"def sum(addends)\n addends.inject(0, :+)\n end",
"def array_sum(arr)\n return arr.reduce(0, :+)\nend",
"def sum(i)\n sum = i.digits.reduce(:+)\n sum\nend",
"def reduce\n if left.reducible?\n Add.new(left.reduce, right)\n elsif right.reducible?\n Add.new(left, right.reduce)\n else\n Number.new(left.value + right.value)\n end\n end",
"def sum_ratings\n @sum_ratings ||= @user_ratings.map(&:rating).inject(&:+).to_f\n end",
"def sum(array)\n array.reduce(0) {|sum, num| sum += num}\nend",
"def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def total\n total = (@products.values.sum) * 1.075\n return total.round(2)\n end",
"def sum_of array\n# add the numbers of the array, these are three different ways I found\n array.inject{ |sum, value| sum += value}\n # or\n # array.map(&:to_i).reduce(0, :+)\n # or\n # array.sum\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def sum(sums)\r\n if sums.empty?\r\n 0\r\n else\r\n sums.reduce(:+)\r\n end\r\nend",
"def sums_all_elements(input)\n input.inject(:+)\n end",
"def sum_array(array)\n array.reduce(:+)\nend",
"def sum(array)\n array.map(&:to_i).reduce(0, :+)\nend",
"def summation(num)\r\n puts 1.upto(num).reduce(0, :+)\r\nend"
] |
[
"0.72864103",
"0.7281918",
"0.72153616",
"0.7181068",
"0.7059739",
"0.7054298",
"0.7048391",
"0.70040244",
"0.7001584",
"0.6969846",
"0.6864926",
"0.68622607",
"0.68506145",
"0.68389815",
"0.683038",
"0.6816554",
"0.6796375",
"0.6791699",
"0.6779876",
"0.6779085",
"0.6772911",
"0.6757435",
"0.67550766",
"0.67376375",
"0.6731434",
"0.6710936",
"0.67073375",
"0.66995704",
"0.669569",
"0.66781294",
"0.6666633",
"0.666597",
"0.664913",
"0.66344523",
"0.66175944",
"0.6608876",
"0.65944797",
"0.6592393",
"0.65805364",
"0.6561253",
"0.6552101",
"0.65401256",
"0.65386677",
"0.6528725",
"0.6527954",
"0.65207744",
"0.6508682",
"0.65083194",
"0.6506836",
"0.6505408",
"0.6504792",
"0.649901",
"0.649901",
"0.6496808",
"0.64960736",
"0.6485952",
"0.6477008",
"0.64713395",
"0.64516556",
"0.64472544",
"0.6441211",
"0.6439566",
"0.6436843",
"0.6435561",
"0.6435561",
"0.6431848",
"0.64283043",
"0.6427459",
"0.6422182",
"0.64150065",
"0.6412342",
"0.6406178",
"0.64021885",
"0.6393363",
"0.6383301",
"0.6383301",
"0.6374419",
"0.6372304",
"0.63706154",
"0.63630515",
"0.63505554",
"0.6349181",
"0.6338769",
"0.6334208",
"0.63335186",
"0.6329244",
"0.63240623",
"0.63153416",
"0.6313391",
"0.6308991",
"0.63056654",
"0.63047737",
"0.6303227",
"0.6298259",
"0.6298259",
"0.6298259",
"0.6296654",
"0.628891",
"0.6288418",
"0.6288074",
"0.62867963"
] |
0.0
|
-1
|
Invoking reduce with a block gives greater control over how to reduce the receiver. One isn't limited to binary methods or operations:
|
def sum_first_and_odds(arr)
arr.reduce do |acc, el|
if el.odd?
acc + el
else
# this else statement is necessary because otherwise the return value of
# the block would be nil if the element is even. Thus the interpreter
# would reassign acc to nil.
acc
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, msg, args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, msg, args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, msg, args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_64(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend",
"def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend",
"def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend",
"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 _reduce_1(val, _values, result); end",
"def _reduce_55(val, _values, result)\n result = new_call(nil, val[0], val[1])\n \n result\nend",
"def reduce(arr,acc)\n # for each element in the array, run the block, called by yield, with the accumulator and the current element, then set the new value of accelerator (acc) to the result of that round of the block being run.\n arr.each { |x| acc = yield(acc,x) }\n # return the final value of the accumulator\n acc\nend",
"def _reduce_65(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_65(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_65(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_375(val, _values, result)\n result = new_call(nil, val[0], val[1])\n \n result\nend",
"def _reduce_339(val, _values, result)\n result = val[0].\n push(@builder.blockarg_expr(val[2], val[3]))\n\n result\nend",
"def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend",
"def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend",
"def _reduce_337(val, _values, result)\n result = val[0].\n push(@builder.blockarg_expr(val[2], val[3]))\n \n result\nend",
"def _reduce_78(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def _reduce_68(val, _values, result)\n blk, _, (msg, _line), args = val\n result = new_call(blk, msg.to_sym, args).line blk.line\n\n result\nend",
"def reduce arr, val\n output = val\n arr.each do |n|\n output = yield(output, n)\n end\n output\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend",
"def reduce(memo = 0, &block)\n @schedule.reduce(memo, &block)\n end"
] |
[
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.76151586",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.7533438",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.75091296",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7428282",
"0.7267346",
"0.7267346",
"0.7267346",
"0.7195761",
"0.7195761",
"0.7195761",
"0.7195761",
"0.7188459",
"0.7188459",
"0.7188459",
"0.71519494",
"0.70830524",
"0.7013728",
"0.69962966",
"0.6978725",
"0.6978725",
"0.6978725",
"0.69637877",
"0.69395554",
"0.6923573",
"0.6923573",
"0.6918303",
"0.6904165",
"0.68654037",
"0.6865212",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.6859636",
"0.68569213"
] |
0.0
|
-1
|
=> 6 In Step 1's sixth practice assessment, we wrote a method that determined the longest word in a string. Here's the original solution and one using reduce: OLD SOLUTION
|
def old_longest_word(str)
words = str.split
longest_word = ""
words.each do |word|
if word.length > longest_word.length
longest_word = word
end
end
longest_word
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend",
"def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend",
"def longest_word(sen)\n words = sen.split\n words.map! { |word| word.delete('^A-Za-z1-9_\\'') }\n longest = words.first\n words.each_with_index do |word, idx|\n next if idx >= words.size - 1\n longest = longest.size < words[idx + 1].size ? words[idx + 1] : longest\n end\n longest\nend",
"def longest_word(string_of_words)\n # Give me back the longest word!\n longest = \"\"\n string_of_words.split(\" \").each do | word |\n if longest.length <= word.length\n longest = word\n end\n end\n return longest\nend",
"def get_the_longest_word(str)\n str.split(\" \").sort! {|s, l| l.length <=> s.length}[0]\nend",
"def longest_word(string)\n\t\n\tsplitted_string = string.split(\" \")\n\tword_length = []\n\t\n\tsplitted_string.each { |word| word_length << word.length }\n\t\n\tmax = word_length.max\n\tidx = word_length.index(max)\n\tsplitted_string[idx]\n\t\nend",
"def get_the_longest_word(str)\n words = str.split()\n longest = [0, \"\"]\n\n for word in words\n if word.length > longest[0]\n longest[0] = word.length\n longest[1] = word\n end\n end\n\n print(longest[1])\n return longest[1]\nend",
"def LongestWord(sen)\n words = sen.split(' ').map do |i|\n /[a-zA-Z0-9]+/.match(i)\n end\n\n longest = words.max_by.each do |i|\n i.to_s.length\n end\n\n longest\n\nend",
"def longest_word(str)\n longest_word = \"\"\n words = str.split(' ')\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\nend",
"def LongestWord(str)\n words = str.split.map { |s| s.gsub(/\\W/, '') }\n longest = words [0]\n words.each { |word| longest = word if word.length > longest.length }\n longest\nend",
"def longest_word(str)\r\n\r\n # temporary variables created\r\n word_length = 0\r\n longest_word = \"\"\r\n\r\n # checks length of each word\r\n str.split(\" \").each {|word|\r\n\r\n if word.length >= word_length\r\n word_length = word.length\r\n longest_word = word\r\n end\r\n\r\n }\r\n\r\n longest_word\r\nend",
"def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend",
"def longest_string(list_of_words)\n\treturn list_of_words.max {|x,y| x.length <=> y.length}\nend",
"def longest_word (sen)\n i = 0\n while i < sen.length do\n # negated regex boolean\n if sen[i] !~ /[a-z]|\\s/\n sen.slice!(i)\n else\n sen[i]\n i += 1\n end\n end\n return sen.split(\" \").max_by(&:length).length\nend",
"def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend",
"def find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend",
"def longest_word(string_of_words)\n\tas_arr = string_of_words.split(\" \")\n\tlengths = as_arr.map {|string| string.length}\n\tmax_length = lengths.max\n return as_arr.reverse.detect {|string| string.length === max_length}\nend",
"def longest_string(list_of_words)\n if list_of_words.length > 0\n longest_word = list_of_words[0]\n for word in list_of_words\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\n end\nend",
"def longest_string(arr)\n arr.max_by { |word| word.length }\nend",
"def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend",
"def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"def longest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.max == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"def longest_string(list_of_words)\n list_of_words.max { |a, b| a.length <=> b.length }\n end",
"def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend",
"def longest_string(list_of_words)\n # length = list_of_words.length\n if list_of_words == []\n return nil\n else\n return list_of_words.max_by { |x| x.length }\n end\nend",
"def longest_string(list_of_words)\n longest = list_of_words[0]\n list_of_words.each do |x|\n if x.length >= longest.length\n longest = x\n end\n end\n if list_of_words.empty?\n return nil\n end\nreturn longest\nend",
"def LongestWord(sen)\n arr = sen.split(' ')\n longest = arr[0]\n arr.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\nend",
"def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend",
"def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend",
"def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n # max = list_of_words[i]\n # end\n # end\n # end\n #\n # return max\nend",
"def find_longest_word(sentence)\n words = sentence.downcase.tr(\"^a-z\", \" \").split\n longest = \"\"\n words.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\n\nend",
"def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend",
"def longest(words=[])\r\n result = ''\r\n words.inject do |memo, word|\r\n result = memo.length > word.length ? memo : word\r\n end\r\n result # don't use puts here, just return a value\r\nend",
"def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend",
"def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend",
"def longest_word(sentence)\n result = \"\"\n sentence.split.each do |word|\n if word.length > result.length\n result = word\n end\n end\nresult\nend",
"def longest(string)\n if string.class == String\n words = string.split(' ').sort_by! {|word| word.length}\n words.last\n else\n nil\n end\nend",
"def longest_string(list_of_words)\n if list_of_words.size != 0\n longest_str = list_of_words.max_by{|a| a.size}\n return longest_str\n else\n end\nend",
"def longest_string(list_of_words)\n if list_of_words == []\n p nil\n else\n words_and_lengths = {}\n list_of_words.each do |word|\n words_and_lengths[word.length] = word\n end\n p words_and_lengths\n longest_length = list_of_words[0].length\n words_and_lengths.each do|length, word|\n if length > longest_length\n longest_length = length\n end\n end\n p words_and_lengths[longest_length]\n end\nend",
"def longest_word(words=[])\n longest = words.inject do |memo, word|\n memo.length > word.length ? memo : word\n end\n puts longest\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n longest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length > longest.length\n longest = word\n end\n }\n\n return longest\nend",
"def longest_word(sentence)\n word_arr = sentence.split\n longest = word_arr.shift\n \n word_arr.each do |word|\n longest = word if word.length >= longest.length\n end\n\n longest\nend",
"def longest_word(sentence)\n words = sentence.split(\"\") #This automically creates a new array with the string split already right?\n idx = 0\n # initially the longest word is empty\n \n longest_w = ''\n \n # We will loop over the current word.\n \n while idx < words.length\n if (words[idx].length > longest_w.length)\n longest_w = words[idx]\n else \n longest_w = longest_w\n end\n \n idx = idx + 1\n end\n \n return longest_w\nend",
"def longest_entry(words)\n return words.max_by(&:length)\n end",
"def find_longest_word(string)\n sentence = string.split\n longest_word = \"\"\n sentence.each do |word|\n word.gsub!(/\\W/, \"\") # filters out non alphanumeric\n longest_word = word if word.length >= longest_word.length\n end\n longest_word\nend",
"def longest_string(list_of_words)\n\tif list_of_words==[]\n\t\tnil\n\telse\n\t\tlist_of_words.max_by {|x| x.length}\n\tend\nend",
"def find_longest_word(sentence)\n # removes special characters | sorts by length | reverses to start with the longest\n longest = sentence.split(/\\W+/).sort_by { |word| word.length }.reverse!\n longest[0]\nend",
"def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend",
"def longest_string(list_of_words)\n longest = nil\n list_of_words.each do |words|\n if longest.nil? || longest.length < words.length\n longest = words\n end\n end\nlongest\nend",
"def longest_string(list_of_words)\n long_string = list_of_words[0]\n list_of_words.each do |measure|\n if long_string.size < measure.size\n long_string = measure\n end\n\n end\n p long_string\nend",
"def LongestWord(sen)\n longest = \"\"\n sen.scan(/\\w+/) do |word|\n if word.length > longest.length\n longest = word\n end\n end\n \n return longest\nend",
"def longest_string(list_of_words)\n if list_of_words == []\n return nil\n elsif list_of_words == ['']\n return ''\n elsif list_of_words.length == 1\n return list_of_words[0]\n elsif\n sorted_words = list_of_words.sort_by { |x| x.length}\n return sorted_words[-1]\n end\nend",
"def longest_word(sentence)\n words = sentence.split(\" \") # words = \"hello, you, motherfucker\"\n\n idx = 0\n while idx < words.length # 0 < 3\n current_word = words[idx] # current_word = words[0]\n\n longest_word = \"\" # set initial longest_word as empty string.\n if current_word.length > longest_word.length\n longest_word = current_word\n end\n\n idx += 1\n end\n return longest_word\nend",
"def length_of_longest_substring(str) ## Does not pass LeetCode Test\n max_longest = ''\n current_longest = ''\n str.each_char do |letter|\n current_longest = \"\" if current_longest.index(letter)\n current_longest << letter \n max_longest = current_longest if current_longest.length > max_longest.length \n end\n max_longest.length \nend",
"def longest str\n\tstr.max_by(&:length)\nend",
"def longest\n @strings.max { |a,b| a.length <=> b.length}\n end",
"def longestWord(sen)\n\tarray = []\n\tsen.gsub!(/[^0-9a-zA-Z\\s]/i, '')\n\tsen = sen.split(' ')\n\tsen.each {|word| array.push(word)}\n\tarray.sort! { |x,y| y.length <=> x.length }\n\treturn array.first\nend",
"def longest_string(list_of_words)\n # Your code goes here!\nend",
"def longest_sentence(text)\n longest_sentence = text.split(/(?<=!|\\.|\\?)\\s/).reduce('') do |longest, current|\n if current.split.size > longest.split.size\n current\n else\n longest\n end\n end\n p longest_sentence\n p longest_sentence.split.size\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0 then return nil\n end\n longest_word = list_of_words.max_by { |x| x.length }\n return longest_word\nend",
"def longest_string(list_of_words)\n long_string = list_of_words[0]\n counter = 0\n while counter < list_of_words.length\n if long_string.length < list_of_words[counter].length\n long_string = list_of_words[counter]\n end\n counter += 1\n end\n p long_string\n #return list_of_words.sort {|x,y| y.length <=> x.length}[0]\nend",
"def longest_word(sentence)\nend",
"def longest_word(sentence)\nend",
"def longest_word(sentence)\n\t\n\tarr = sentence.split(\" \")\n\tarr = []\n\tlongest = \"\"\n\t\n\tarr.each do |word|\n\tlongest = word if longest.length < word.length\t\n end\n return longest\nend",
"def longest_string(list_of_words)\n\tif list_of_words.size == []\n\t\treturn nil\n\telsif list_of_words.size == 1\n\t\treturn list_of_words[0]\n\telsif list_of_words.size >= 2\n\t\tlist_of_words.sort_by! {|word| word.length}\n\t\treturn list_of_words.last\n\tend\nend",
"def longest(str)\n count = 0\n str.split(\" \").each {|word| count = word.length if word.length > count}\n p count\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend",
"def longest_word(sentence)\n\tarr = sentence.split(\" \")\n\tp arr\n\titer = 0\n\twhile iter < arr.length\n\t\tlongest_word = nil\n\t\tcurrent_word = arr[iter]\n\t\tif longest_word == nil\n\t\t\tlongest_word = current_word\n\t\telsif longest_word.length < current_word.length\n\t\t\tlongest_word = current_word\n\t\tend\n\t\titer+=1\n\tend\n\treturn longest_word\nend",
"def longest_word(sentence)\n\n arr = sentence.split\n idx = arr.length\n cmp = []\n\n n = idx\n while n >= 0\n\n word = arr[n].to_s\n word_length_string = word.length\n word_length_integer = word_length_string.to_i\n cmp.unshift(word_length_integer)\n\n n = n - 1\n end\n\n n = 0\n longest_length = 0\n position = 0\n while n < cmp.length\n if cmp[n] > longest_length\n longest_length = cmp[n]\n position = n\n end\n n = n + 1\n end\n\nreturn arr[position]\n\nend",
"def longest_string(list_of_words)\n initial = list_of_words.kind_of?(Array) && list_of_words[0] != nil ? '' : nil\n\nreturn initial if initial == nil\n\nfor i in 0...list_of_words.length\n curr_val = list_of_words[i] if list_of_words[i].instance_of? String\n puts list_of_words[i].length\n initial = curr_val if i == 0 || initial.length < curr_val.length\nend\n\ninitial\nend",
"def longest_string string \n\tar = ['One','Two','Three','Four','Five']\n\tar.max_by(&:length)\nend",
"def longest_word(phrase)\n longestWord = \"\"\n longestWordLength = 0\n \n wordArray = phrase.split(\" \")\n wordArray.each do |word|\n if word.length > longestWordLength\n longestWord = word\n longestWordLength = word.length\n end\n end\n return longestWord\nend",
"def LongestWord(sen)\n arr = sen.split(\" \")\n arr.sort! { |a, b| b.length <=> a.length }\n arr[0]\n\nend",
"def longest_word(sentence)\n words = sentence.split\n words.sort_by!(&:length)\n words[-1]\nend",
"def longest_word(sentence)\n longestWord = \"\" #holds word\n words = sentence.split(' ') #split sentence into array of words.\n\n words.each do |word| #loop through array of words\n if word.length > longestWord.length #if the word the loop is on is greater than the longest word.. \n longestWord = word #set the longest word to that word.\n end\n end\n return longestWord #return longest word\nend",
"def longest_string array\n array.max_by(&:length)\nend",
"def longest_string(str)\n str = str.split(\" \")\n longest = 0\n for st in str do\n if st.length > longest\n longest = st.length\n end\n end\n return longest\nend",
"def longest_string(list_of_words)\n longestword = list_of_words.pop\n\n\n while list_of_words.count > 0 do\n word = list_of_words.pop\n if longestword.length < word.length\n longestword = word\n end\n end\n p longestword\nend",
"def longest_word_in_array(array)\n array.max_by{|word|word.length}\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend",
"def LongestWord(sen)\n\tarr = sen.gsub(/[^a-zA-Z]+/m, ' ').strip.split(\" \")\n\tcounter = \"\" \n\t\tarr.each do |word|\n\t\t\tif word.length >= counter.length \n\t\t\t\tcounter = word \n\t\t\tend\n\t\tend\n\t\tcounter\nend",
"def longest(s)\n\tall_results = []\n\n\tlist_of_chars = s.chars\n\n\tlist_of_chars.each_with_index do |char, index|\n\n\t\tresult = ''\n\t\tnext_index = index + 1 \n\t\tcurrent_index = index\n\t\tresult << char\n\n\t\tif current_index == list_of_chars.length - 1\n\t\t\tall_results = all_results.max { |a,b| a.length <=> b.length }\n\t\telse\n\t\t loop do\n\t\t \tif list_of_chars[next_index] == nil\n\t\t \t\tall_results << result\n\t\t \t\tbreak\n\t\t\t\telsif list_of_chars[next_index] >= list_of_chars[current_index]\n\t\t\t\t\tresult << list_of_chars[next_index]\n\t\t\t\t\tcurrent_index += 1\n\t\t\t\t\tnext_index += 1\n\t\t\t\telse\n\t\t\t\t\tall_results << result\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tall_results\nend",
"def longest_string(string_array)\n string_array.max_by(&:length)\nend",
"def longest_word(sentence)\n\n#split sentence in words kept in array words \nwords = sentence.split(\" \")\n\n# sets up empty variable longest_word (is this not definted already...?)\nlongest_word = nil \n\n#sets up counter, sets equal to 0 \nwords_idx = 0 \n\n#sets up while statement, constrains loops \nwhile words_idx < words.length\n#defines current words as word position in array based on counter \ncurrent_word = words[words_idx]\n\n#if the longest word is nil (it is, set equal to nil above)\nif longest_word == nil \n #then the longest word is whatever position you are at \n longest_word == current_word\n \n #if the longest word length (nil?) is less than the length of current word length \n #(remember current word is at position word_idx)\n elsif longest_word.length < current_word.length\nlongest_word = current_word \nend\n\nwords_idx += 1 \nend \n\nreturn longest_word\nend",
"def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend",
"def longest_word(str)\n arr = str.split()\n sortedArr = arr.sort_by!(&:length).reverse! \n p sortedArr[0]\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n word_hash = Hash.new\n list_of_words.each do |word|\n word_hash[word] = word.length\n end\n word_length = Array.new\n word_hash.each_value do |value|\n word_length.push(value)\n end\n length_sorted = word_length.sort\n tall_one = length_sorted.last\n word_hash.key(tall_one)\nend",
"def longest_string ar\n return ar.max_by(&:length)\nend",
"def longest_string\nend",
"def find_longest_word(sentence)\n words = sentence.split\n # x = 0\n # y = words[x]\n z = words[0]\n\n words.each do |word|\n\n if word.length > z.length\n z = word\n end\n # x += 1\n end\n z\nend",
"def longest_string ar\n\tar.max_by(&:length)\nend",
"def longest_two_words(string)\n string.delete!(\",.:;?!\")\n string.split.sort_by {|x|x.length}[-2..-1]\n\nend",
"def longest_string \nend",
"def longest_two_words(string)\n string.gsub(/[[:punct:]]/, '').split.sort_by(&:length)[-2..-1]\nend",
"def get_longest_string\n current_longest = {@data[0] => @data[0].length}\n longest_value = @data[0] # BUG should read @data[0].length\n @data.each do |word|\n if word.length > longest_value\n current_longest = {word => word.length}\n longest_value = word.length\n end\n end\n current_longest\n end",
"def longest_two_words(string)\n string.split.sort_by { |word| word.length }[-2..-1]\nend",
"def longest_two_words(string)\n string.split.sort_by { |word| word.length }[-2..-1]\nend",
"def longest_two_words(string)\n string.delete!(',.?:;\"!\"')\n word_arr = string.split(\" \").sort_by { |word| word.length }.reverse!\n word_arr[0..1]\nend"
] |
[
"0.8244373",
"0.82066965",
"0.8192249",
"0.8167795",
"0.8150644",
"0.8140021",
"0.8123376",
"0.8096654",
"0.80929434",
"0.8087551",
"0.8062892",
"0.8053171",
"0.8051514",
"0.80426157",
"0.80282557",
"0.80217296",
"0.7989718",
"0.7988252",
"0.797876",
"0.7974078",
"0.7966766",
"0.79357034",
"0.79323107",
"0.7923818",
"0.79194957",
"0.7918272",
"0.7902331",
"0.78947383",
"0.78919005",
"0.78916675",
"0.7871954",
"0.78594124",
"0.78551865",
"0.7838344",
"0.78327084",
"0.782964",
"0.7820092",
"0.7803957",
"0.77943766",
"0.77903396",
"0.77802247",
"0.7779726",
"0.7769234",
"0.77668786",
"0.7747563",
"0.77474535",
"0.7740708",
"0.7727758",
"0.7716829",
"0.7702964",
"0.76920587",
"0.7689006",
"0.76868933",
"0.76835465",
"0.7682993",
"0.76695085",
"0.76539457",
"0.76411825",
"0.7641085",
"0.7631489",
"0.76255035",
"0.76175475",
"0.7602944",
"0.7602944",
"0.75980383",
"0.75940704",
"0.7591222",
"0.7579031",
"0.7564186",
"0.75628114",
"0.7558807",
"0.75583774",
"0.7548325",
"0.75210315",
"0.75150365",
"0.751325",
"0.74755836",
"0.7473863",
"0.74730617",
"0.7472884",
"0.74619365",
"0.74591124",
"0.7438229",
"0.7437342",
"0.74279195",
"0.7426122",
"0.74205047",
"0.74171895",
"0.74150646",
"0.7414647",
"0.7403825",
"0.73846555",
"0.7382237",
"0.73753566",
"0.73724025",
"0.7370284",
"0.73694104",
"0.7361081",
"0.7361081",
"0.735759"
] |
0.8193987
|
2
|
With a Block, With an Initial Accumulator There are two differences between invoking reduce with an argument and a block versus with only a block: The interpreter initially assigns the accumulator to the given argument. The interpreter iterates through the entire receiver, i.e., it does not skip the first element. This method returns the number of words in the string that end in the letter "e" (e.g., e_words("Let be be finale of seem") => 3). Here's the solution we provided:
|
def old_e_words(str)
words = str.split
count = 0
words.each do |word|
count += 1 if word[-1] == "e"
end
count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def e_words(str)\n str.split.reduce(0) do |count, word|\n if word[-1] == \"e\"\n count + 1\n else\n count # return existing count from block so count isn't reassigned to nil\n end\n end\nend",
"def character_count(words)\n words = words.split(' ')\n words.reduce(0) { |sum, val| sum + val.length }\nend",
"def e_words(str)\r\n count = 0\r\n str.split(\" \").each {|w| w[-1] == 'e' ? count += 1: next}\r\n count\r\nend",
"def e_words(str)\r\n count = 0\r\n str.split(\" \").each {|w| w[-1] == 'e'? count += 1: next}\r\n count\r\nend",
"def word_lengths(str)\n str.split.reduce({}) do |acc, word|\n acc[word] = word.length\n acc\n end\nend",
"def letter_count(string)\n string.scan(/\\w/).reduce({}) do |counts, letter|\n counts.merge letter => string.count(letter)\n end\nend",
"def word_counter(string)\n\n if string.empty? #== 0, suggested by Rubocop\n i_num_words = 0\n else\n new_string = string\n new_string = new_string.delete \" \"\n i_num_words = string.length - new_string.length + 1\n end\n return i_num_words\nend",
"def word_counter(string)\n array = string.downcase.split(\" \")\n word_count = array.count\n the_count = array.count(\"the\")\n\n # option 1 for getting longest work\n # longest_word = \"\"\n # array.each do |x|\n # longest_word = x if longest_word.length < x.length\n # end\n\n # option 2 for getting longest word\n longest_word = array.max_by { |x| x.length }\n\n puts \"The number of words is #{word_count}, the longest word is #{longest_word}, and 'the' is used #{the_count} times.\"\nend",
"def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend",
"def double_letter_count(string)\n count = 0\n string.split.each { |word| count += count(word) }\n count\nend",
"def count_words(string)\n arg = string.downcase.gsub(/[^a-z ]/,\"\")\n words = arg.split(/\\s+/)\n result = Hash.new\n words.each { |word| \n if result[word].nil? then result[word] = 1 else result[word] += 1 end\n }\n result\nend",
"def LetterCount(str)\n words = str.split(' ')\n num_repeats = nil\n best_word = nil\n \n idx = 0\n while idx < words.length\n word = words[idx]\n count = 0\n \n word_freq = Hash.new(0)\n word.split('').map {|x| word_freq[x] += 1 }\n if word_freq.select {|x,y| y > 1 }.empty?\n idx += 1\n next\n else\n count += word_freq.select {|x,y| y > 1 }.size\n end\n \n if num_repeats == nil || count > num_repeats\n num_repeats = count\n best_word = word\n end\n \n idx += 1\n end\n \n if num_repeats == nil\n return -1\n else\n return best_word\n end\nend",
"def count_e(word)\n i = 0\n counter = 0\n while i < word.length\n if word[i] == \"e\"\n counter += 1\n end\n i += 1\n end\n return counter #only return final count so outside of while loop\nend",
"def e_words(str)\n count = 0\n str.delete('.').split.each{|word| count = count + 1 if word[-1]=='e'}\n return count\nend",
"def count_e(word)\n counter = 0\n i = 0\n while i < word.length\n if word[i] == \"e\"\n counter += 1\n end \n i += 1\n end\n return counter\nend",
"def wordCounter(inputString)\n inputString.scan(/\\w+/).length\nend",
"def count_words(string)\n return nil if string.nil?\n\n w = string.split(/\\b/).map {|x| x.gsub(/[\\W]+/, '').downcase}.reject {|x| x.empty?}\n Hash[w.map {|x| [x, w.select {|y| x == y}.size]}]\nend",
"def count_words(string)\n words = string.downcase.split(/[^a-zA-Z]/).reject{|e| e.empty?}\n wf = Hash.new(0)\n words.each { |word| wf[word] += 1 }\n return wf\nend",
"def word_counter (string)\n array = string.split\n array.length\nend",
"def count_e(word)\n i = 0\n count = 0\n while i < word.length\n if word[i] == 'e'\n count += 1\n end\n i += 1\n end\n return count\nend",
"def WordCount(string)\n string.scan(/\\w+/).count\nend",
"def calc_characters(string)\n words = string.split\n chars = 0\n words.each { |word| chars += word.size }\n chars\nend",
"def word_sizes(words_string)\n counts = Hash.new(0)\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n counts\nend",
"def word_counter(string)\n new_string = string.split\n return new_string.length\nend",
"def my_reduce(starting_value = nil)\n if starting_value != nil\n aggregate = starting_value\n starting_position = 0\n else\n aggregate = self[0]\n starting_position = 1\n end\n self[starting_position..-1].my_each do |word|\n aggregate = yield(aggregate, word)\n end\n aggregate\n end",
"def word_sizes(words_string)\n\n # We create a new hash, but we have to initialize is this way vs hash = {}\n # Because the first time we go to count[word.size] += 1, the element doesn't\n # exist yet, and returns nil. Since nil can't be added to 1, we have to do it this way\n counts = Hash.new(0)\n\n # Next we're going to split the string into words, then iterate over each word.\n # We assign a new variable clean_word equal to the word that we're iterating on\n # and delete anything that's not a letter using a simple REGEX.\n\n # We will then be counting the length of each word (based on the new variable clean_word)\n # that we're iterating, and storing that in our hash, counts.\n\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n # Return our hash\n counts\nend",
"def sum_of_a_beach (beach)\n (beach.scan(/sand|water|fish|sun/i) || []).length\nend",
"def count_words_in(the_string)\n the_words = the_string.split\n the_words.size\nend",
"def count_words(string)\r\n string.scan(/\\w+/).each_with_object(Hash.new(0)){|w,h| h[w.downcase]+=1}\r\n end",
"def word_points word\n word_array = word.upcase.split(\"\")\n points = word_array.reduce (0) {| total , letter | total + letter_values[letter]}\n puts \"The total points for your Scrabble™ answer is: #{points}\"\nend",
"def count_words(str)\n counts = {} #counts number of elements\n str.downcase.scan(/\\b[a-z]+/).each do |word| #downcase/seperate words for word do\n if counts[word].nil? then #condition if word exists\n counts[word] = 1 #word exists assign 1\n else\n counts[word] += 1 #object summation\n end\n end\n counts #calls counts\nend",
"def word_sizes(string)\n string.split.map { |word| word.size }.tally\nend",
"def count_e(word)\n count = 0\n word.each_char { |char| count += 1 if char == \"e\"}\n count\nend",
"def word_count(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase.gsub(/[^a-z]/i, \"\")}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\n p hash\n return hash\nend",
"def word_sizes(string)\n\tword_count = {}\n\tstring.split.each do |word|\n\t\tword_s = word.size\n\t\tif word_count[word_s]\n\t\t\tword_count[word_s] += 1\n\t\telse\n\t\t\tword_count[word_s] = 1\n\t\tend\n\tend\n\tword_count\nend",
"def word_count(string)\n words = string.split\n count = Hash.new(0)\n words.each { |word| count[word] += 1 }\n count\nend",
"def word_count(words)\n num = 0\n words.each do |word|\n unless word.include?('*') || word.include?('#')\n num += 1\n end\n end\n num\nend",
"def longest_word(words=[])\n longest = words.inject do |memo, word|\n memo.length > word.length ? memo : word\n end\n puts longest\nend",
"def word_counter\n \"This is a string\".split.size\nend",
"def count_words(string)\n\twords = Hash.new\n\t\n\tstring.downcase.scan(/[\\w]+\\b/) { |word|\n\t\tif !words.has_key?(word)\n\t\t\twords[word] = 0\n\t\tend\n\t\t\n\t\twords[word] += 1\n\t}\n\t\n\treturn words\nend",
"def number_of_words(string)\n\tstring.split.size\nend",
"def word_count(string)\n string_arr = string.split \n string_arr.size \nend",
"def longest(words=[])\r\n result = ''\r\n words.inject do |memo, word|\r\n result = memo.length > word.length ? memo : word\r\n end\r\n result # don't use puts here, just return a value\r\nend",
"def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend",
"def word_count(string)\n words = string.split(\" \")\n count = Hash.new(0)\n words.each { |word| count[word] += 1}\n count\nend",
"def word_lengths(str)\n counter = Hash.new(0)\n str.split(\" \").each do |x|\n counter[x] = x.length\n end\n counter\nend",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def word_sizes(string)\n word_count = Hash.new(0)\n\n string.split.each do |element|\n word_count[element.size] += 1\n end\n word_count\nend",
"def count_words(string)\n hash = Hash.new(0)\n string.scan(/\\w+/).each {|t| hash[t.downcase] = hash[t.downcase] + 1}\n hash\nend",
"def count_words(s)\n\ts = s.downcase\n\ts.gsub!(/\\W+/,\" \")\n\ts = s.split(\" \")\n\tfreqs = Hash.new(0)\n\ts.each{ |word| freqs[word] += 1 }\n\treturn freqs\nend",
"def word_sizes(string)\n clean_string = string.gsub(/[^a-zA-Z]/, \" \")\n \n clean_string.split.map { |word| word.size }.tally\n \nend",
"def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end",
"def count_e(word)\n puts word.count('e')\nend",
"def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend",
"def find_word_lengths(word_list)\n word_list.reduce(Hash.new(0)) do |hash, el|\n hash[el] += el.size\n hash\n end\nend",
"def LetterCountI(str)\n largest_count = 0\n words = str.split(\" \")\n i = 0\n while i < words.length\n if count(words[i]) > largest_count\n largest_count = count(words[i])\n largest_word = words[i]\n end\n i += 1\n end\n if largest_count == 0\n return -1\n else\n return largest_word\n end\nend",
"def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end",
"def word_lengths(string)\n string.split.map {|word| word + \" \" + word.size.to_s}\nend",
"def word_sizes(string)\n string.split.map do |word|\n word.size\n end.tally\n \nend",
"def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end",
"def word_count(string)\n words = string.split(/\\W+/) #split on any non-word char. Thanks Rubular.com!\n #Using \\b counts even spaces as \"words\". Using \\W counts ... as three words.\n #\\W+ splits on one or more of any non-word character\n words.length #return length\nend",
"def count_words(string)\n \n result = {}\n\n clean = string.downcase.gsub(/[^a-z]+/,\" \").split\n clean2 = clean.each{|d| checker1(d,result)}\n \n return(result)\n \n\nend",
"def word_lengths(str)\nend",
"def word_sizes(str)\n str.split.map { |element| element.size }.tally\nend",
"def word_lengths(string)\nstring.split.map{|e| e + ' ' + e.size.to_s}\nend",
"def score(s)\n count = 0\n s.split.each do |word|\n count += 1 if @words.include?(word)\n end\n count\n end",
"def word_sizes(str)\n words = str.split(' ')\n counts = Hash.new(0)\n words.each do |word|\n clean_word = word.delete(/[^a-z]/i)\n counts[clean_word.size] += 1\n end\n counts\nend",
"def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend",
"def count_e(word)\n count = 0 #use count to track number of e's\n\n i = 0 #use i to iterate thru the word\n while i < word.length\n char = word[i]\n \n if char == \"e\"\n count += 1\n end\n\n i += 1\n end \n\n return count\nend",
"def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend",
"def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend",
"def count_words( string )\n h = Hash.new\n arr = string.downcase.gsub(/[^a-z ]/, '').split.each { |word|\n if h.include?( word )\n h[word] = h[word].next\n else\n h[word] = 1\n end\n }\n return h\nend",
"def WordCount(str)\n str.split(\" \").count\nend",
"def longest(str)\n count = 0\n str.split(\" \").each {|word| count = word.length if word.length > count}\n p count\nend",
"def word_sizes(word_string)\n word_sizes = Hash.new(0)\n array = word_string.split.each { |string| string.slice!(/[^a-zA-Z]/) }\n array.each { |word| word_sizes[word.size] += 1 }\n word_sizes\nend",
"def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n str.split.map { |element| element.size }.tally\nend",
"def word_count(text)\n return text.split.count\nend",
"def count_words(string)\n string = string.downcase\n split_string = string.split(' ')\n \n word_hash = Hash.new\n word_hash.default = nil\n\n split_string.each do |s|\n s = s.gsub(/[^a-z]/, '')\n if word_hash[s]\n word_hash[s] = word_hash[s] + 1 \n else\n word_hash[s] = 1\n end\n end\n puts word_hash\nend",
"def LetterCountI(str)\n\n arr=str.split\n arr.each{|word|\n word.each_char{|char|\n return word if word.count(char)>1\n }\n \n }\n -1\nend",
"def word_lengths(string)\n string.split(' ').map {|word| \"#{word} #{word.length}\"}\nend",
"def WordCount(str)\n\n arr=str.split\n return arr.length\nend",
"def count_words(string) \n words_hash = Hash.new(0)\n string.downcase.gsub(/\\b/, '').split().each do |i| \n words_hash[i] += 1 \n end\n words_hash \nend",
"def word_lengths(string)\n words = string.split\n\n words.map do |word|\n word + ' ' + word.length.to_s\n end\nend",
"def count_words(string)\n # your code here\n ret = {}\n s = string.downcase\n s.split(/\\b/).each do |w|\n if w =~ /\\w/\n if ret[w]\n ret[w] += 1\n else\n ret[w] = 1\n end\n end\n end\n return ret\nend",
"def WordCount(str)\n\tarr = str.split(\" \").count\nend",
"def count_words(str)\n\tstr.gsub!(/[\\b[^a-zA-Z ]]/, '')\n\tarr = str.downcase.split\n\thash = Hash.new(0)\n\tarr.each { |name| hash[name] += 1 }\n\treturn hash\nend",
"def word_sizes(input_string)\n counts = Hash.new(0) # => {}\n input_string.split.each do |word| # => [\"Four\", \"score\", \"and\", \"seven.\"]\n counts[word.size] += 1 # => 1, 1, 1, 1\n end # => [\"Four\", \"score\", \"and\", \"seven.\"]\n counts # => {4=>1, 5=>1, 3=>1, 6=>1}\n # input_string.split(' ').map { |word| word.chars.count } # => [4, 5, 3, 6]\nend",
"def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend",
"def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend",
"def count_words(string)\n string.to_s.downcase!\n arr = string.to_s.split(/\\b/).select{|i| i =~ /\\w/}\n h = Hash.new\n arr.uniq.each{|i| h[i] = arr.count(i)}\n return h\nend",
"def getCount(str)\n # str = \"abracadabra\" => 5\n vowels = [\"a\", \"i\", \"e\", \"o\", \"u\"]\n str.split(\"\").filter { |letter| vowels.include?(letter) }.count # filter is an alias for select\nend",
"def longest_prefix(strings)\n word_array = strings[0].split(\"\")\n length = strings.length\n\n prefix = \"\"\n\n word_array.each_with_index do |letter,letter_index|\n count_words_with_letter = 0\n\n (length - 1).times do |i|\n if (strings[i+1].split(\"\"))[letter_index] == letter \n count_words_with_letter += 1\n else\n return prefix\n end\n end\n\n if count_words_with_letter = length-1\n prefix += letter\n end\n end\n\n return prefix\nend",
"def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend",
"def word_sizes(string)\n hash = Hash.new(0)\n string.split.each do |word|\n hash[word.size] += 1\n end\n hash\nend",
"def wc\n words = @str.split(/[\\s,.]+/)\n h=Hash.new(0)\n words.each do |w|\n if h.has_key?(w) == true then\n val = h.fetch(w)\n val = val+1\n h.store(w,val)\n else\n h.store(w,1)\n end\n end \n h.each_pair do |key,val|\n puts \"#{val} #{key}\"\n end\nend",
"def word_lengths(str)\n words = str.split(\" \")\n word_length = Hash.new(0)\n words.each {|ele| word_length[ele] = ele.length}\n word_length\nend",
"def count_words(string)\n if ( string == nil ) \n return {}\n end\n downcaseString = string.downcase\n resulthash = {}\n downcaseString.gsub(/\\w*/) do |s| \n if s.length > 0 then\n if ( resulthash.key?s )\n resulthash[s] += 1\n else\n resulthash[s] = 1\n end\n end\n end\n return resulthash\nend",
"def get_count(*words)\n\n\tif words[0].class == String\n\t\t# remove anything not a-zA-z\n\t\twords = words[0].gsub(/[^a-z^A-Z]/, \"\")\n\t\t# take everything to downcase to better count vowels, get total length string\n\t\twords = words.downcase\n\t\tlen = words.length\n\n\t\t# match aeio; will return[]; count #vowels\n\t\tvowels = words.scan(/[aeiou]/)\n\t\tvowel_len = vowels.length\n\t\tconsonants_len = len - vowel_len\n\n\t\t# create new Hash with info \n\t\toutput = {\"vowels\"=>vowel_len, \"consonants\" =>consonants_len}\n\telse\n\t\toutput = {\"vowels\"=>0, \"consonants\" =>0}\n\tend \nend",
"def word_sizes(string)\n\n arr_words = string.split \n hash_counts = Hash.new(0)\n\n arr_words.each do |word|\n size = word.size\n hash_counts[size] += 1\n end\n\n hash_counts\nend",
"def find_frequency(sentence, word)\n calc_count = 0\n sentence.split(' ').each_with_object([]) do |i, j|\n calc_count += 1 if i.downcase == word\n end\n return calc_count\nend"
] |
[
"0.78621924",
"0.68649894",
"0.667658",
"0.65928787",
"0.65476245",
"0.64105517",
"0.6265147",
"0.62433976",
"0.62091637",
"0.61969006",
"0.6163417",
"0.6160707",
"0.6145172",
"0.61261237",
"0.6113959",
"0.60885006",
"0.6087822",
"0.608003",
"0.60443336",
"0.6033731",
"0.60297716",
"0.60254484",
"0.60206425",
"0.5990883",
"0.59871143",
"0.5981305",
"0.5976364",
"0.59745324",
"0.5961567",
"0.5953385",
"0.5947403",
"0.5932891",
"0.5931244",
"0.592683",
"0.59241027",
"0.5922801",
"0.5905369",
"0.59031606",
"0.59008694",
"0.58822644",
"0.5877009",
"0.58615875",
"0.5858455",
"0.5857993",
"0.58544767",
"0.58423877",
"0.58372337",
"0.58344275",
"0.5829616",
"0.5824498",
"0.58096474",
"0.5800383",
"0.57965124",
"0.57895344",
"0.5787639",
"0.5787133",
"0.57831645",
"0.5774395",
"0.5773444",
"0.57692415",
"0.5763297",
"0.57598764",
"0.5759314",
"0.5757953",
"0.57518154",
"0.5750321",
"0.57422996",
"0.5731913",
"0.57301164",
"0.57292557",
"0.5719615",
"0.57135856",
"0.571356",
"0.57114774",
"0.5702415",
"0.56758",
"0.56732506",
"0.5671895",
"0.56538653",
"0.5645537",
"0.5640383",
"0.5638852",
"0.56338584",
"0.5633627",
"0.56322175",
"0.56268996",
"0.5625481",
"0.5624983",
"0.5624983",
"0.56147635",
"0.5609956",
"0.56040734",
"0.55973285",
"0.5593996",
"0.55908394",
"0.5588162",
"0.55814135",
"0.5577638",
"0.55746514",
"0.5571959"
] |
0.6559114
|
4
|
Take a moment to study an implementation using reduce:
|
def e_words(str)
str.split.reduce(0) do |count, word|
if word[-1] == "e"
count + 1
else
count # return existing count from block so count isn't reassigned to nil
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 _reduce_1(val, _values, result); end",
"def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend",
"def _reduce_69(val, _values, result); end",
"def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend",
"def _reduce_21(val, _values, result); end",
"def _reduce_23(val, _values, result); end",
"def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_586(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_704(val, _values, result); end",
"def _reduce_72(val, _values, result); end",
"def _reduce_72(val, _values, result); end",
"def _reduce_13(val, _values, result); end",
"def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_76(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
"def _reduce_369(val, _values, result); end",
"def _reduce_369(val, _values, result); end",
"def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_47(val, _values, result); end",
"def _reduce_263(val, _values, result); end",
"def _reduce_263(val, _values, result); end",
"def _reduce_1(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_634(val, _values, result); end",
"def _reduce_312(val, _values, result); end",
"def _reduce_725(val, _values, result); end",
"def _reduce_686(val, _values, result); end",
"def _reduce_372(val, _values, result); end",
"def reducer; end",
"def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_211(val, _values, result); end",
"def _reduce_211(val, _values, result); end",
"def _reduce_526(val, _values, result); end",
"def _reduce_684(val, _values, result); end",
"def _reduce_277(val, _values, result); end",
"def _reduce_277(val, _values, result); end",
"def _reduce_706(val, _values, result); end",
"def _reduce_359(val, _values, result); end",
"def _reduce_695(val, _values, result); end",
"def _reduce_612(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_344(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_637(val, _values, result); end",
"def _reduce_217(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_464(val, _values, result); end",
"def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_594(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_1(val, _values, result)\n return \"\" \n result\nend",
"def _reduce_669(val, _values, result); end",
"def _reduce_603(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_470(val, _values, result); end",
"def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_595(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_466(val, _values, result); end",
"def _reduce_120(val, _values, result)\n result = [ val[0] ]\n\n result\nend",
"def _reduce_1(val, _values, result)\n result = val[0]\n\n result\nend",
"def _reduce_17(val, _values, result); end",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_697(val, _values, result); end",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_702(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_379(val, _values, result); end",
"def _reduce_736(val, _values, result); end",
"def _reduce_45(val, _values, result); end",
"def _reduce_472(val, _values, result); end",
"def _reduce_472(val, _values, result); end",
"def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend",
"def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend",
"def _reduce_367(val, _values, result); end",
"def _reduce_9(val, _values, result); end",
"def _reduce_9(val, _values, result); end",
"def _reduce_591(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_1(val, _values, result)\n result = val[0] \n result\nend",
"def _reduce_115(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_115(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_363(val, _values, result); end",
"def _reduce_638(val, _values, result)\n yyerrok\n result\nend",
"def _reduce_638(val, _values, result)\n yyerrok\n result\nend",
"def _reduce_271(val, _values, result); end",
"def _reduce_271(val, _values, result); end",
"def _reduce_544(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_701(val, _values, result); end",
"def _reduce_46(val, _values, result)\n result = new_return(val[0], val[1])\n \n result\nend",
"def _reduce_46(val, _values, result)\n result = new_return(val[0], val[1])\n \n result\nend"
] |
[
"0.75888646",
"0.7562143",
"0.75409055",
"0.75175476",
"0.75061524",
"0.7471402",
"0.74696386",
"0.7466019",
"0.74581116",
"0.7457762",
"0.7442165",
"0.7442165",
"0.7429682",
"0.74285674",
"0.7410794",
"0.7410794",
"0.74072486",
"0.74072486",
"0.74034387",
"0.73941624",
"0.7374683",
"0.73728794",
"0.73728794",
"0.73680335",
"0.7365241",
"0.7365241",
"0.73582375",
"0.73567563",
"0.7348522",
"0.7346889",
"0.73464656",
"0.7325945",
"0.7320622",
"0.7316368",
"0.73155946",
"0.7312724",
"0.7312724",
"0.731237",
"0.73078895",
"0.7306261",
"0.7306261",
"0.7306095",
"0.7304296",
"0.73013425",
"0.73008657",
"0.7298958",
"0.729753",
"0.7294131",
"0.72864467",
"0.72832465",
"0.72781634",
"0.7276401",
"0.7274697",
"0.72737193",
"0.72708446",
"0.72706383",
"0.7270338",
"0.7270092",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72649133",
"0.72625077",
"0.72613716",
"0.72597724",
"0.7258657",
"0.7257997",
"0.72564137",
"0.72555155",
"0.72555155",
"0.72549075",
"0.72539115",
"0.72517174",
"0.72511196",
"0.72497594",
"0.7248601",
"0.7244411",
"0.7244411",
"0.7244387",
"0.7244387",
"0.72439706",
"0.72423905",
"0.72423905",
"0.72405875",
"0.72401386",
"0.72399616",
"0.72399616",
"0.7237589",
"0.7235592",
"0.7235592",
"0.7234748",
"0.7234748",
"0.7233679",
"0.7227898",
"0.72272825",
"0.72272825"
] |
0.0
|
-1
|
Here's our solution as well as an implementation using reduce with an empty string as the initial accumulator: OLD SOLUTION
|
def old_boolean_to_binary(arr)
binary = ""
arr.each do |boolean|
if boolean
binary += "1"
else
binary += "0"
end
end
binary
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _reduce_1(val, _values, result)\n paint \"| Empty String |\" , :white\n result\nend",
"def _reduce_424(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_439(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_423(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_424(val, _values, result)\n result = new_str val[0]\n \n result\nend",
"def _reduce_421(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_537(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_433(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_438(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_553(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_391(val, _values, result)\n result = new_str val[0]\n \n result\nend",
"def _reduce_435(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_416(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_563(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_435(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_542(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_539(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_384(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_542(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_552(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_386(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_394(val, _values, result)\n result = new_str val[0]\n \n result\nend",
"def _reduce_1(val, _values, result)\n return \"\" \n result\nend",
"def _reduce_403(val, _values, result)\n result = new_str val[0]\n \n result\nend",
"def _reduce_382(val, _values, result)\n result = new_str val[0]\n \n result\nend",
"def _reduce_565(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend",
"def _reduce_440(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n \n result\nend",
"def _reduce_475(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.intern)\n else\n result = s(:dsym, \"\", result)\n end\n \n result\nend",
"def concatenate(strings)\n\n strings.inject(\"\") do |result, str|\n result += str\n end\n\nend",
"def _reduce_37(val, _values, result)\n result = val.join \n result\nend",
"def _reduce_28(val, _values, result)\n result = val.join \n result\nend",
"def _reduce_496(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def crunch(str)\n last_character = ''\n collapsed = str.chars.each_with_object([]) do |character, arr|\n unless character == last_character\n arr.push(character)\n last_character = character\n end\n end\n collapsed.join\nend",
"def _reduce_476(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.intern)\n else\n result = s(:dsym, \"\", result)\n end\n \n result\nend",
"def _reduce_495(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_495(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_495(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_495(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_495(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result[0]\n when :dstr then\n result[0] = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_697(val, _values, result)\n result = :\"**nil\"\n\n result\nend",
"def accum(s)\n\t# your code\n arr = s.split(\"\")\n arr.map!.with_index do |el, idx|\n mapper = el * (idx+1)\n mapper = mapper.capitalize\n puts mapper\n mapper\n end \n\n arr.join(\"-\")\nend",
"def accum(s)\n newArr = []\n i = 1\n\ts.split('').each { |let|\n let *= i\n i += 1 \n newArr.push(let.downcase)\n }\n newArr.each { |let|\n let[0] = let[0].upcase\n }\n return newArr.join(\"-\")\nend",
"def _reduce_444(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_444(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_20(val, _values, result)\n @handler.scalar val[0].gsub(/^\"|\"$/, '') \n result\nend",
"def _reduce_566(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_566(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_566(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_573(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_619(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def test_reduce\n assert_equal('12Bar4BazBar78BarBaz11Bar1314BarBaz',\n @kbb.reduce { |acc, res| acc + res })\n end",
"def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_485(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_571(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_571(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def reduce(array, starting_value = nil)\n i = 0\n\n if array[0].class == String\n final_value = starting_value.to_s\n else\n final_value = array[0]\n end\n\n while i < array.length\n final_value = yield(final_value, array[i])\n\n i += 1\n end\n final_value\nend",
"def _reduce_569(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_519(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_519(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_570(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_570(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_570(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_519(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug20 26, val, result\n end\n\n result\nend",
"def _reduce_519(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug20 26, val, result\n end\n\n result\nend",
"def _reduce_519(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug20 26, val, result\n end\n\n result\nend",
"def _reduce_516(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_516(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_516(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_516(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def _reduce_516(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug 39\n end\n\n result\nend",
"def accum(s)\n arr = s.split('')\n arr.map!.each_with_index do |letter, index|\n (letter * (index + 1)).capitalize\n # binding.pry\n end\n arr.join('-')\nend",
"def crunch(str)\n if str == '' \n return ''\n end\n \n new_arr = str.split('')\n str_out = new_arr[0]\n \n (1..new_arr.size-1).each {|n|\n new_arr[n] != new_arr[n-1] ? \n str_out << new_arr[n]\n : n\n }\n \n str_out\nend",
"def _reduce_497(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_497(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_497(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend",
"def _reduce_568(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_568(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_568(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend",
"def _reduce_521(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug20 26, val, result\n end\n\n result\nend",
"def _reduce_521(val, _values, result)\n _, result, _ = val\n\n lexer.lex_state = EXPR_END\n\n result ||= s(:str, \"\").line lexer.lineno\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym).line result.line\n when :evstr then\n result = s(:dsym, \"\", result).line result.line\n else\n debug20 26, val, result\n end\n\n result\nend",
"def _reduce_443(val, _values, result)\n result = s(:nil) \n result\nend",
"def my_reduce(starting_value = nil)\n if starting_value != nil\n aggregate = starting_value\n starting_position = 0\n else\n aggregate = self[0]\n starting_position = 1\n end\n self[starting_position..-1].my_each do |word|\n aggregate = yield(aggregate, word)\n end\n aggregate\n end",
"def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend",
"def _reduce_475(val, _values, result)\n result = \"*#{val[1]}\".intern\n \n result\nend",
"def same_char_collapse(str)\r\n newStr = str\r\n newStr = collapsed(newStr)\r\n if !newStr[1]\r\n return newStr[0]\r\n else\r\n same_char_collapse(newStr)\r\n end\r\nend",
"def _reduce_509(val, _values, result)\n result = s(:nil) \n result\nend"
] |
[
"0.745299",
"0.7010364",
"0.7004395",
"0.69815725",
"0.6980433",
"0.69681126",
"0.69406784",
"0.6932525",
"0.6932525",
"0.6932525",
"0.6927861",
"0.6922835",
"0.69200784",
"0.69123733",
"0.68960446",
"0.6886463",
"0.68796694",
"0.6840588",
"0.6838066",
"0.6834939",
"0.6831415",
"0.6791166",
"0.6780988",
"0.6772165",
"0.67569566",
"0.67376065",
"0.6708971",
"0.6618884",
"0.65753484",
"0.6515246",
"0.6450319",
"0.6234838",
"0.6133638",
"0.605447",
"0.6042257",
"0.603269",
"0.60290045",
"0.6019157",
"0.6017384",
"0.6017384",
"0.6017384",
"0.6017384",
"0.6017384",
"0.5996035",
"0.5996035",
"0.59944826",
"0.59761375",
"0.5975411",
"0.59644306",
"0.59644306",
"0.5946493",
"0.591335",
"0.591335",
"0.591335",
"0.5911045",
"0.5888535",
"0.5885913",
"0.58769935",
"0.58769935",
"0.58747095",
"0.58689034",
"0.58689034",
"0.58682287",
"0.586305",
"0.5859142",
"0.5859142",
"0.5854558",
"0.5854558",
"0.5854558",
"0.58436215",
"0.58436215",
"0.58436215",
"0.58436215",
"0.58436215",
"0.5833478",
"0.5833478",
"0.5833478",
"0.58288074",
"0.58288074",
"0.58288074",
"0.58288074",
"0.58288074",
"0.5827212",
"0.5823318",
"0.58176845",
"0.58176845",
"0.58176845",
"0.58165854",
"0.58165854",
"0.58165854",
"0.5815621",
"0.5815621",
"0.5814756",
"0.58122295",
"0.580947",
"0.580947",
"0.580947",
"0.580947",
"0.5805515",
"0.58026487",
"0.5795115"
] |
0.0
|
-1
|
Try to code an implementation using reduce before looking at the solution: OLD SOLUTION
|
def old_factors(num)
factors = []
(1..num).each do |i|
if num % i == 0
factors << i
end
end
factors
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _reduce_69(val, _values, result); end",
"def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend",
"def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_72(val, _values, result); end",
"def _reduce_72(val, _values, result); end",
"def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_612(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_586(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_725(val, _values, result); end",
"def _reduce_704(val, _values, result); end",
"def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend",
"def _reduce_369(val, _values, result); end",
"def _reduce_369(val, _values, result); end",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_637(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
"def _reduce_217(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_684(val, _values, result); end",
"def _reduce_372(val, _values, result); end",
"def _reduce_277(val, _values, result); end",
"def _reduce_277(val, _values, result); end",
"def _reduce_47(val, _values, result); end",
"def _reduce_263(val, _values, result); end",
"def _reduce_263(val, _values, result); end",
"def _reduce_595(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_669(val, _values, result); end",
"def _reduce_13(val, _values, result); end",
"def _reduce_706(val, _values, result); end",
"def _reduce_344(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_271(val, _values, result); end",
"def _reduce_271(val, _values, result); end",
"def _reduce_594(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_21(val, _values, result); end",
"def _reduce_697(val, _values, result); end",
"def _reduce_606(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_464(val, _values, result); end",
"def _reduce_634(val, _values, result); end",
"def _reduce_248(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_248(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_417(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_736(val, _values, result); end",
"def _reduce_472(val, _values, result); end",
"def _reduce_472(val, _values, result); end",
"def _reduce_730(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_582(val, _values, result)\n result = val[1]\n\n result\nend",
"def _reduce_686(val, _values, result); end",
"def _reduce_526(val, _values, result); end",
"def _reduce_466(val, _values, result); end",
"def _reduce_544(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_591(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_356(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_115(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_115(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_707(val, _values, result); end",
"def _reduce_547(val, _values, result); end",
"def _reduce_547(val, _values, result); end",
"def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_441(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_581(val, _values, result)\n result = val[1]\n\n result\nend",
"def _reduce_332(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_23(val, _values, result); end",
"def _reduce_699(val, _values, result); end",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_122(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_363(val, _values, result); end",
"def _reduce_667(val, _values, result); end",
"def _reduce_119(val, _values, result)\n result = [ val[0] ]\n \n result\nend",
"def _reduce_702(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_695(val, _values, result); end",
"def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend",
"def _reduce_470(val, _values, result); end",
"def _reduce_312(val, _values, result); end",
"def _reduce_387(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_379(val, _values, result); end",
"def _reduce_1(val, _values, result)\n result = val[0]\n \n result\nend",
"def _reduce_699(val, _values, result)\n result = val[1]\n \n result\nend",
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_1(val, _values, result); end",
"def _reduce_684(val, _values, result)\n result = val[1]\n\n result\nend",
"def _reduce_561(val, _values, result); end"
] |
[
"0.7425461",
"0.74118716",
"0.73941344",
"0.7391247",
"0.7391247",
"0.7377703",
"0.73669505",
"0.7366489",
"0.7364236",
"0.73623353",
"0.7357239",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.73557806",
"0.7354074",
"0.7340278",
"0.7340278",
"0.73392063",
"0.7334446",
"0.73312783",
"0.73312783",
"0.73297787",
"0.7322956",
"0.7317419",
"0.73160887",
"0.73160887",
"0.73067194",
"0.73031515",
"0.73031515",
"0.73019457",
"0.7297695",
"0.72966117",
"0.72965693",
"0.7295777",
"0.7294856",
"0.7294233",
"0.72918373",
"0.72918373",
"0.7291125",
"0.72900367",
"0.72900367",
"0.72842777",
"0.72828037",
"0.72773015",
"0.7268596",
"0.7267936",
"0.72656405",
"0.72656405",
"0.7264798",
"0.726387",
"0.72613716",
"0.72575676",
"0.7257393",
"0.7257393",
"0.7256075",
"0.7255884",
"0.7254704",
"0.7253929",
"0.7249505",
"0.7247009",
"0.72464633",
"0.7246243",
"0.72459435",
"0.72459435",
"0.72454196",
"0.724302",
"0.724302",
"0.7242553",
"0.7242553",
"0.7242553",
"0.7242553",
"0.7242553",
"0.72412646",
"0.72410387",
"0.7241017",
"0.7240554",
"0.72400844",
"0.72400844",
"0.7239349",
"0.7237846",
"0.72370434",
"0.7236068",
"0.7234199",
"0.7232037",
"0.72319704",
"0.722977",
"0.7229186",
"0.72289646",
"0.7226491",
"0.72252893",
"0.7222697",
"0.72213596",
"0.7218604",
"0.7214222",
"0.72133476"
] |
0.0
|
-1
|
react_port(Port port, Energy energy)
|
def react_port(port, energy)
super(port, energy)
if energy.value >= threshold
energy.value = 0
try_callback(:on_react_drain, self, port, energy)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def react_port(port, energy)\n #\n try_vlog { |io| io.puts react_s(\"Rp=\", energy, port.id, port) }\n end",
"def react_port(port, energy)\n super(port, energy)\n emit(OUTPUT_ID, @state ? energy : emit_energy_null)\n state_depress if state_pressed?\n end",
"def emit_port(port, energy)\n try_vlog { |io| io.puts emit_s(\"Ep=\", energy, port.id, port) }\n port.client_react(energy)\n end",
"def react_port(port, energy)\n super(port, energy)\n if discharge?(energy)\n @discharge = true\n else\n pull = @energy.calc_pull(energy,\n @charge_pull_max,\n @charge_pull_min, @charge_ceil)\n @energy.value = [[@charge_foot, (@energy.value + pull)].max, @charge_ceil].min\n energy.value -= pull\n end\n emit(OUTPUT_ID)\n end",
"def react_port(port, energy)\n super(port, energy)\n case port.id\n when INPUT_COIL_ID\n # if energy is valid for coil then its state is inverted (ON)\n # however if it is not present then the coil will default to its\n # normal state (OFF)\n @state = coil_trigger?(energy) ? state_inverted :\n default_state\n emit(OUTPUT_COIL_ID, energy)\n try_callback(:on_react_coil, self, port, energy)\n when INPUT_COMMON_ID\n emit(@state ? OUTPUT_NO_ID : OUTPUT_NC_ID, energy)\n emit(!@state ? OUTPUT_NO_ID : OUTPUT_NC_ID, emit_energy_null)\n try_callback(:on_react_common, self, port, energy)\n end\n end",
"def react_port(port, energy)\n super(port, energy)\n case id = port.id\n when INPUT_AUX1_ID, INPUT_AUX2_ID\n @aux_state[id] = aux_trigger?(id, energy) ? coil_state_inverted :\n coil_state_normal\n #emit(OUTPUT_COIL_ID, energy)\n try_callback(:on_react_coil, self, port, energy)\n emit(OUTPUT_AUX1_ID, energy) if @aux_state[:aux1_in]\n emit(OUTPUT_AUX2_ID, energy) if @aux_state[:aux2_in]\n when INPUT_COMMON1_ID, INPUT_COMMON2_ID, INPUT_COMMON3_ID\n if full_aux?\n en = energy\n callback_name = :on_react_common\n else\n en = emit_energy_null\n callback_name = :on_react_common_off\n end\n case id\n when INPUT_COMMON1_ID\n emit(OUTPUT_COMMON1_ID, en)\n when INPUT_COMMON2_ID\n emit(OUTPUT_COMMON2_ID, en)\n when INPUT_COMMON3_ID\n emit(OUTPUT_COMMON3_ID, en)\n end\n try_callback(callback_name, self, port, en)\n end\n end",
"def react_port(port, energy)\n super(port, energy)\n case port.id\n when CONTACT_L1_ID\n if @state\n emit(CONTACT_X1_ID, emit_energy_null)\n emit(CONTACT_X2_ID, energy)\n try_callback(:on_react_common_l1, self, port, energy)\n else\n emit(CONTACT_X1_ID, energy)\n emit(CONTACT_X2_ID, emit_energy_null)\n try_callback(:on_react_common_l2, self, port, energy)\n end\n when CONTACT_X1_ID\n en = !@state ? energy : emit_energy_null\n callback_name = !@state ? :on_react_l1_common : :on_react_l1_common_null\n emit(CONTACT_L1_ID, energy)\n try_callback(callback_name, self, port, en)\n when CONTACT_X2_ID\n en = @state ? energy : emit_energy_null\n callback_name = @state ? :on_react_l2_common : :on_react_l2_common_null\n emit(CONTACT_L1_ID, energy)\n try_callback(callback_name, self, port, energy)\n end\n end",
"def react(port_id, energy)\n # react from another konekt\n # handle the port_id and act on the given energy value\n port = @port[port_id]\n if port_type_valid?(port_id, :in)\n Konekraft::Konekt2::Base.indent do\n try_vlog { |io| io.puts react_s(\"R +\", energy, port_id, port) }\n react_port(port, energy)\n end\n try_callback(:on_react, self, port, energy)\n @stats[:react_count] += 1\n else\n try_vlog { |io| io.puts react_s(\"R -\", energy, port_id, port) }\n @stats[:react_null_count] += 1\n end\n try_vlog { |io| io.puts react_s(\"R =\", energy, port_id, port) }\n try_callback(:on_react_abs, self, port, energy)\n @stats[:react_abs_count] += 1\n end",
"def react_s(s, energy, port_id, port)\n debug_s(s, energy, port_id, port) + \" / \" + export_s\n end",
"def react_port(port, energy)\n super(port, energy)\n case id = port.id\n when INPUT_CLEAR_SEGS_ID\n if energy.value >= @threshold\n @segments.each_key do |key|\n @segments[key] = false\n end\n end\n try_callback(:on_react_clear, self, port, energy)\n when INPUT_SEG1_ID, INPUT_SEG2_ID, INPUT_SEG3_ID, INPUT_SEG4_ID,\n INPUT_SEG5_ID, INPUT_SEG6_ID, INPUT_SEG7_ID\n @segments[id.to_s.gsub(\"_in\",\"\").to_sym] = energy.value >= @threshold\n try_callback(:on_react_seg, self, port, energy)\n end\n end",
"def write_to_port(port, value)\n value = value.to_i\n @values[port.to_i] = value\n # log.debug \"write bar #{port} value #{value}\"\n client.pwm_write(@ports[port.to_i], value)\n end",
"def switch_on port=-1\n run(:func => \"relayWrite\", :port => port, :value => 1)\n end",
"def data_channel_port\n super\n end",
"def signal(port, val)\n # The derived class needs to implement the value method.\n self.activate\n @inputs[port] = val\n newval = self.value\n if newval != @outval then\n @outval = newval\n @outputs.each { | c | c.signal(newval) }\n end\n self.deactivate\n end",
"def actual_port; end",
"def actual_port; end",
"def connect_pid_velocity (port, dof)\n @port = port\n case dof\n when :SURGE\n @port.connect_to do |sample, _|\n @window.pid_surge_vel.update(sample.linear[0], \"Surge\")\n end \n when :SWAY\n @port.connect_to do |sample, _|\n @window.pid_sway_vel.update(sample.linear[1], \"Sway\")\n end \n when :HEAVE\n @port.connect_to do |sample, _|\n @window.pid_heave_vel.update(sample.linear[2], \"Heave\")\n end\n \n when :YAW\n @port.connect_to do |sample, _|\n @window.pid_yaw_vel.update(sample.angular[2], \"Yaw\")\n end\n end\n end",
"def emit(port_id, energy=emit_energy)\n # default emission action\n port = @port[port_id]\n if port_type_valid?(port_id, :out)\n Konekraft::Konekt2::Base.indent do\n try_vlog { |io| io.puts emit_s(\"E +\", energy, port_id, port) }\n emit_port(port, energy)\n end\n try_callback(:on_emit, self, port, energy)\n @stats[:emit_count] += 1\n else\n try_vlog { |io| io.puts emit_s(\"E -\", energy, port_id, port) }\n @stats[:emit_null_count] += 1\n end\n try_vlog { |io| io.puts emit_s(\"E =\", energy, port_id, port) }\n try_callback(:on_emit_abs, self, port, energy)\n @stats[:emit_abs_count] += 1\n end",
"def port\n @port ||= Port.new(@event.at('@port'), @event.at('@svc_name'), @event.at('@protocol'))\n end",
"def getPort()\n return @port\n\tend",
"def port=(_arg0); end",
"def translate_port_state\n super\n end",
"def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on\n\tend",
"def stp_edge_port_state\n super\n end",
"def set_port port\n @port = port\n end",
"def rport\n\t\t@target_port\n\tend",
"def port=(new_port)\n return if new_port == port\n reset!\n @desired_port = new_port\n start!\n end",
"def port=(_); end",
"def connect_device port\n @transmitter.connect port\n end",
"def send_to_port(message, port)\n s = EventMachine::Synchrony::TCPSocket.new('127.0.0.1', port)\n s.write message\n data = ''\n recv = s.read(1)\n while recv\n data += recv\n recv = s.read(1)\n end\n s.close\n data\nend",
"def install\n # we prefetched also not installed ports so @portorigin may be present\n name = @portorigin || resource[:name]\n do_portupgrade name, install_options, resource[:package_settings]\n end",
"def install\n # we prefetched also not installed ports so @portorigin may be present\n name = @portorigin || resource[:name]\n do_portupgrade name, install_options, resource[:package_settings]\n end",
"def transport_port=(port)\n if port.match /\\//\n\n end\n end",
"def open_serial_port(port = PORT, speed = BAUD, bits = BITS, stopbits = STOPBITS, parity = PARITY)\n begin\n @sp = SerialPort.new(port, speed, bits, stopbits, parity)\n @sp.flow_control = SerialPort::NONE\n @sp.binmode\n @sp.read_timeout = 30000\n #puts \"DTR #{@sp.dtr} DSR #{@sp.dsr} RTS #{@sp.rts} CTS #{@sp.cts} DCD #{@sp.dcd} RI #{@sp.ri}\"\n rescue => error\n STDERR.puts Weather_exception, \"open_serial_port: \" + error.to_s\n @sp = nil\n end\n end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def initialize(port)\n @port = port\n @name = port.name\n @type = port.type\n @lhs = port.lhs \n @rhs = port.rhs \n @direction = port.direction\n end",
"def actual_port\n if !block_given?\n return @j_del.java_method(:actualPort, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling actual_port()\"\n end",
"def add_port(port)\n return port if @ports.has_value? port\n @ports[port.name.to_s] = port\n port.owner= self\n port\n end",
"def connect_predicted_velocity (port, dof)\n @port = port\n case dof\n when :SURGE\n @port.connect_to do |sample, _|\n @window.pred_surge_vel.update(sample.velocity[0], \"Surge\")\n end \n when :SWAY\n @port.connect_to do |sample, _|\n @window.pred_sway_vel.update(sample.velocity[1], \"Sway\")\n end \n when :HEAVE\n @port.connect_to do |sample, _|\n @window.pred_heave_vel.update(sample.velocity[2], \"Heave\")\n end\n when :YAW\n @port.connect_to do |sample, _|\n @window.pred_yaw_vel.update(sample.angular_velocity[2], \"Yaw\")\n end\n end\n end",
"def get_port_interrupt(port)\n send_request(FUNCTION_GET_PORT_INTERRUPT, [port], 'k', 1, 'C')\n end",
"def port\n end",
"def stp_active_edge_port_state\n super\n end",
"def cable; end",
"def standard_port; end",
"def connect_port_to(task_name, port_name, port)\n\n from_port = Orocos::Async.proxy(task_name).port(port_name)\n\n from_port.on_unreachable do\n $stderr.puts \"the port #{port_name} from task #{task_name} it is unreachable\"\n end\n\n from_port.on_reachable do\n begin\n from_port.to_orocos_port.connect_to port\n rescue\n $stderr.puts \"error when try to connect port\"\n end\n end\nend",
"def add_port(port)\n\t\t\tp = Port.new(port,nil,nil)\n\t\t\t@ports << p\n\t\tend",
"def open_port(index)\n Interface::midiin_open_port(@midiin, index)\n end",
"def port\n if !block_given?\n return @j_del.java_method(:port, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling port()\"\n end",
"def display(port=$>) end",
"def update(value)\n @serial_port.puts value\n end",
"def enable_write port=-1\n run(:func => \"enableWrite\", :port => port, :value => 1)\n end",
"def switch_ports\r\n SwitchPortsController.instance\r\n end",
"def port\n @port ||= presenter.port\n end",
"def port\n super\n end",
"def port\n super\n end",
"def connected_ports; end",
"def enable_read port=-1\n run(:func => \"enableRead\", :port => port, :value => 1)\n end",
"def port=(p)\n attributes['port'] = p.to_s\n end",
"def react_to *args; end",
"def value_for_port(number)\n return 0x00 if grounded_port?(number)\n level = @port_level[number]\n level &&= @latch_level[number] if latched_port?(number)\n level ? 0x80 : 0x00\n end",
"def port(p)\n @config[:port] = p\n end",
"def set_port\n\t\tself.port = 389 if self.port == 0\n\tend",
"def connect_thruster_control (port)\n @port = port\n @port.connect_to do |sample, _|\n @window.thruster_1.update(sample.elements[0].raw, \"Thruster 1\")\n @window.thruster_2.update(sample.elements[1].raw, \"Thruster 2\")\n @window.thruster_3.update(sample.elements[2].raw, \"Thruster 3\")\n @window.thruster_4.update(sample.elements[3].raw, \"Thruster 4\")\n end \n \n end",
"def update\n m = MonoMatrix::Switcher.new \"/dev/ttyAMA0\"\n m.switch params[:name], channel_params[:input].to_i\n head :no_content\n end",
"def initialize(port)\n @port = port\n @port.flush_input\n @lock_state = :locked\n @unlock_time = nil\n if !$opensmart\n @color_map = [\n 'white',\n 'blue',\n 'green',\n 'red',\n 'navy',\n 'darkblue',\n 'darkgreen',\n 'darkcyan',\n 'cyan',\n 'turquoise',\n 'indigo',\n 'darkred',\n 'olive',\n 'gray',\n 'grey',\n 'skyblue',\n 'blueviolet',\n 'lightgreen',\n 'darkviolet',\n 'yellowgreen',\n 'brown',\n 'darkgray',\n 'darkgrey',\n 'sienna',\n 'lightblue',\n 'greenyellow',\n 'silver',\n 'lightgray',\n 'lightgrey',\n 'lightcyan',\n 'violet',\n 'azure',\n 'beige',\n 'magenta',\n 'tomato',\n 'gold',\n 'orange',\n 'snow',\n 'yellow'\n ]\n else\n @color_map = [\n 'white',\n 'blue',\n 'green',\n 'red',\n 'navy',\n 'darkgreen',\n 'darkcyan',\n 'cyan',\n 'maroon',\n 'olive',\n 'gray',\n 'grey',\n 'magenta',\n 'orange',\n 'yellow'\n ]\n end\n @last_time = ''\n @green_pressed_at = nil\n @unlocked_at = nil\n @last_status_1 = nil\n @last_status_2 = nil\n @reader = nil\n @temp_status_1 = ''\n @temp_status_2 = ''\n @temp_status_colour = ''\n @temp_status_at = nil\n @who = nil\n end",
"def get_port(port)\n send_request(FUNCTION_GET_PORT, [port], 'k', 1, 'C')\n end",
"def port\n 20000 + ($$ % 40000)\n end",
"def port\n @port\n end",
"def port\n @port\n end",
"def port\n @port\n end",
"def port(port, host = T.unsafe(nil)); end",
"def conceal_port(gear, component)\n args = build_base_gear_args(gear)\n args = build_base_component_args(component, args)\n result = execute_direct(@@C_CONTROLLER, 'conceal-port', args)\n parse_result(result)\n end",
"def send_port(socket, listen_port)\n if $verb\n puts \"Sent port message\"\n end\n socket.write([3, 9, listen_port].pack(\"Ncn\"))\n end",
"def port_params\n params.require(:port).permit(:port_number, :name, :description, :up_rate, :down_rate, :rate_unit, :subscriber_id)\n end",
"def port_spec(name)\n self.class.port_spec[name]\n end",
"def switch_off port=-1\n run(:func => \"relayWrite\", :port => port, :value => 0)\n end",
"def source_port_behavior\n super\n end",
"def source_port_behavior\n super\n end",
"def set_port_monoflop(port, selection_mask, value_mask, time)\n send_request(FUNCTION_SET_PORT_MONOFLOP, [port, selection_mask, value_mask, time], 'k C C L', 0, '')\n end",
"def set_port(port, value_mask)\n send_request(FUNCTION_SET_PORT, [port, value_mask], 'k C', 0, '')\n end",
"def sample port=-1\n data = run(:func => \"powerList\", :port => port)\n unless data.key?(\"value\")\n raise \"No data available\"\n end\n\n data[\"value\"].shift\n number = 0\n data[\"value\"].map { |value| MPowerReading.new(number += 1, value) }\n end",
"def standard_port?; end",
"def port_params\n params.require(:port).permit(:port_number, :name, :description, :up_rate, :down_rate, :rate_unit)\n end",
"def start\n @monitor = SerialPortMonitor.new @dev, @baud, @databits, @stopbits, @parity\n\n # Ye olde reactor loop\n EventMachine.run do\n \n EventMachine.start_server @host, @port, Connection, @monitor\n \n\n @thread = Thread.new {\n @monitor.run\n }\n\n puts \"SerialPortProxy started at #{@dev} serving to #{@host}:#{@port}\"\n end\n\n end",
"def initialize(port, timeout, init=false)\n \n @end_lifetime = Time.at(Time.now + timeout)\n \n #puts \"new port will time out at #{@end_lifetime}\"\n \n if port.respond_to?(:writer)\n @writer = port.writer\n end\n if port.respond_to?(:reader)\n @reader = port.reader(init: init, pull: true)\n end\n \n @port = port\n end",
"def connect(port: nil)\n return if @tcp_socket\n unless port\n @tcp_socket = TCPSocket.new(@host, ENDPOINT_MAPPER_PORT)\n bind(endpoint: Epm)\n begin\n host_port = get_host_port_from_ept_mapper(\n uuid: @endpoint::UUID,\n maj_ver: @endpoint::VER_MAJOR,\n min_ver: @endpoint::VER_MINOR\n )\n rescue RubySMB::Dcerpc::Error::DcerpcError => e\n e.message.prepend(\n \"Cannot resolve the remote port number for endpoint #{@endpoint::UUID}. \"\\\n \"Set @tcp_socket parameter to specify the service port number and bypass \"\\\n \"EPM port resolution. Error: \"\n )\n raise e\n end\n port = host_port[:port]\n @tcp_socket.close\n @tcp_socket = nil\n end\n @tcp_socket = TCPSocket.new(@host, port)\n end",
"def port(port)\n @options[:port] = port\n end",
"def optional_port; end",
"def port_string; end",
"def accel\n @speed += 7\n end",
"def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend",
"def port=(v)\n check_port(v)\n set_port(v)\n port\n end",
"def stunnel_port(port)\n port = port.to_i\n if port < 50000\n return port + 10000\n else\n return port - 10000\n end\n end"
] |
[
"0.86894",
"0.81447214",
"0.78325343",
"0.77473986",
"0.7625689",
"0.7624276",
"0.7611039",
"0.75940025",
"0.6219545",
"0.6185251",
"0.60466623",
"0.6034582",
"0.592604",
"0.5893094",
"0.5803036",
"0.5803036",
"0.5798036",
"0.5765309",
"0.56801206",
"0.5635834",
"0.5610097",
"0.56086856",
"0.55679846",
"0.5560611",
"0.55515075",
"0.5525664",
"0.5525176",
"0.5517613",
"0.5480073",
"0.54771096",
"0.5470467",
"0.5470467",
"0.54148436",
"0.5377127",
"0.53528345",
"0.53528345",
"0.53528345",
"0.53528345",
"0.53528345",
"0.53528345",
"0.53528345",
"0.53528345",
"0.5352177",
"0.5347408",
"0.53461134",
"0.5344133",
"0.5340922",
"0.5331091",
"0.5316437",
"0.5313519",
"0.53080106",
"0.5286646",
"0.52840173",
"0.5277687",
"0.5275332",
"0.5244545",
"0.5223945",
"0.52171963",
"0.5188937",
"0.5182212",
"0.51783323",
"0.51783323",
"0.51632553",
"0.5157948",
"0.5157448",
"0.51480556",
"0.514324",
"0.5128218",
"0.5116067",
"0.51037645",
"0.5102119",
"0.5099351",
"0.5097921",
"0.5040058",
"0.50201863",
"0.50201863",
"0.50201863",
"0.5006572",
"0.50040233",
"0.50012577",
"0.5001197",
"0.49789178",
"0.4978551",
"0.4978494",
"0.4978494",
"0.4974784",
"0.49719152",
"0.49705365",
"0.4966601",
"0.4962208",
"0.49618018",
"0.49616584",
"0.49588668",
"0.49560845",
"0.49474615",
"0.4946258",
"0.4944274",
"0.4935585",
"0.4932045",
"0.49286807"
] |
0.67905515
|
8
|
It should return a pair of days representing the best day to buy and the best day to sell. Days start at 0.
|
def stock_picker(stock_prices)
best_pick = 0
first_index = 0
second_index = 0
stock_prices.each_with_index do |val, idx|
current_pick = stock_prices.slice((idx + 1)..(stock_prices.length - 1))
current_pick.each_with_index do |num, i|
new_pick = num - val
if new_pick > best_pick
best_pick = new_pick
first_index = idx
second_index = idx + i + 1
end
end
end
p "Best day to buy: #{first_index}. Best day to sell: #{second_index}"
p "Profit: #{best_pick}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pick_best_day(optimized, days)\n\tbuy_day = 0\n\tsell_day = 0\n\tprofit = 0\n\tdays.each do |day|\n\t\tdaily_profit = days[optimized[days.index day]] - day\n\t\tif daily_profit > profit\n\t\t\tprofit = daily_profit\n\t\t\tbuy_day = days.index day\n\t\t\tsell_day = optimized[days.index day]\n\t\tend\n\tend\n\t[buy_day, sell_day]\nend",
"def stock_picker(prices) \n min_price = Float::INFINITY\n day_min_cost = 0\n max_price = -Float::INFINITY\n profit = -Float::INFINITY\n best_days = []\n\n prices.each_with_index do |price, day|\n if price < min_price \n min_price = price\n day_min_cost = day\n end\n \n if price - min_price > profit && day > day_min_cost\n max_price = price\n profit = price - min_price\n best_days = [day_min_cost, day]\n end\n end\n\n if best_days.empty?\n # In the case that the prices are decreasing order and there are no duplicates, the best days \n # to buy is the second to last day and the best day to sell is the last day\n best_days = [prices.length - 2, prices.length - 1]\n else\n best_days\n end\nend",
"def stock_picker daily_prices_array\n best_buy_day = 0\n best_sell_day = 0\n best_profit = 0\n for buy_day in 0...daily_prices_array.length\n for sell_day in buy_day...daily_prices_array.length\n if daily_prices_array[sell_day] - daily_prices_array[buy_day] > best_profit\n best_profit = daily_prices_array[sell_day] - daily_prices_array[buy_day]\n best_sell_day = sell_day\n best_buy_day = buy_day\n end\n end\n end\n [best_buy_day, best_sell_day]\nend",
"def stock_picker(array)\n best_buy = 0\n best_sell = 0\n max_profit = 0\n\n #first iterate through the array to find a buy day\n (0..(array.length-2)).each do |buy_date|\n\n #for each possible buy day, iterate through each sell day\n ((buy_date + 1)..array.length - 1).each do |sell_date|\n\n #check the price difference for those two days\n price_difference = array[sell_date] - array[buy_date]\n\n #if price diff is larger than the current max profit, store those days and max profit\n if price_difference > max_profit\n best_buy = buy_date\n best_sell = sell_date\n max_profit = price_difference\n end\n end\n end\n puts \"day #{best_buy}: buy at #{array[best_buy]}\"\n puts \"day #{best_sell}: sell at #{array[best_sell]}\"\n puts \"profit of #{max_profit}\"\n\n return [best_buy, best_sell]\nend",
"def stock_picker(array)\n best_days = Hash.new(0)\n\n array.each_with_index do |buy_price, idx1|\n buy_day = idx1\n (idx1 + 1...array.length).each do |idx2|\n sell_day = idx2\n sell_price = array[idx2]\n if buy_price <= sell_price\n best_days[[buy_day, sell_day]] = sell_price - buy_price\n end\n end\n end\n result = greatest_value_in_hash(best_days)\n\n # Days start at 0, wchich is the very first day of the prices\n return \"Best day to buy: #{result[0]}\\nBest day to sell: #{result[1]}\\nProfit: $#{result[2]}\"\nend",
"def stock_picker(arr)\n \n max = 0\n day1 = 0\n day2 = 0\n\n arr.length.times do |buy|\n arr.length.times do |sell|\n if buy < sell && (arr[sell] - arr[buy] > max)\n day1 = buy\n day2 = sell\n max = arr[day2] - arr[day1]\n end\n end\n end\n\n return [day1, day2]\nend",
"def optimize_days(days)\n\toptimized = {}\n\tdays.each do |day|\n\t\tprofit = 0\n\t\tfor i in (days.index(day)...days.length)\n\t\t\tif days[i]-day > profit\n\t\t\t\tprofit = days[i]-day\n\t\t\t\tbest_day_to_sell = i\n\t\t\tend\n\t\tend\n\t\tbest_day_to_sell = days.index day if best_day_to_sell.nil?\n\t\toptimized[days.index day] = best_day_to_sell\n\tend\n\toptimized\nend",
"def stock_picker prices\n\tbest_days = []\n\tbest_profit = 0\n\n\tprices.length.times do |i|\n\t\tj = i\n\t\tfor j in i...prices.length\n\t\t\tif prices[j] - prices[i] > best_profit\n\t\t\t\tbest_profit = prices[j] - prices[i]\n\t\t\t\tbest_days[0] = i\n\t\t\t\tbest_days[1] = j\n\t\t\tend\n\t\tend\n\tend\n\tbest_days\nend",
"def stock_picker prices\n max_profit = 0-Float::INFINITY\n buy_day = 0\n sell_day = 0\n\n prices.each.with_index do |first_price,first_index|\n profits_for_day = prices.map.with_index do |second_price,second_index|\n if first_index < second_index\n second_price - first_price\n else\n 0-Float::INFINITY\n end\n end\n max_profit_for_day = profits_for_day.max\n if max_profit_for_day > max_profit\n max_profit = max_profit_for_day\n buy_day = first_index\n sell_day = profits_for_day.index(max_profit_for_day)\n end\n end\n\n return [buy_day,sell_day]\nend",
"def stock_picker(input)\n \n best_profit = 0\n buy_sell_days = [0,0]\n \n# Since we need to buy before we can sell, we should only consider\n# buying up until the second-to-last day:\n \n for x in 0..input.length-2\n \n# We'll always sell after we buy, so we use nested 'for' loops to\n# check our sell value against our buy value and store our max profit:\n \n for y in 1+x..input.length-1\n \n profit = (input[y] - input[x])\n \n if profit > best_profit\n best_profit = profit\n buy_sell_days = [x,y]\n end\n \n end\n \n end\n \n return buy_sell_days\n \nend",
"def stock_picker(prices)\n\n\t# Best available [buy, sell] days for each buy day\n\tbest_days = []\n\tprices.each_index do |i|\n\t\tavailable_days = prices[i...prices.size] # only same day or after are valid sell days\n\t\tbest_days << [i, prices.index(available_days.max)]\n\tend\n\n\t# Calculates profit of each best day, same size and index as best_days\n\tprofits = []\n\tbest_days.each {|i| profits << prices[i[1]] - prices[i[0]] }\n\n\t# Returns [buy, sell] day pair matching index of highest profit\n\tbest_days[profits.index(profits.max)]\nend",
"def stock_picker(prices)\n i = 0\n diff = 0\n best_days = []\n (i...prices.length).each do |index_one|\n (i + 1...prices.length).each do |index_two|\n if prices[index_two] - prices[index_one] > diff\n diff = prices[index_two] - prices[index_one]\n best_days = [index_one, index_two]\n end\n end\n end\n best_days\n end",
"def stock_picker(prices)\n\tgreatest_profit = 0\n\tbuy_day, sell_day = nil, nil\n\n\t(prices.length - 1).times do |day|\n\t\t((day+1)..(prices.length - 1)).each do |day2|\n\t\t\tcurrent_profit = prices[day2] - prices[day]\n\n\t\t\tif current_profit > greatest_profit\n\t\t\t\tbuy_sell = [day,day2] \n\t\t\t\tgreatest_profit = profit\n\t\t\tend\n\t\tend\n\tend\n\n\treturn [buy_day, sell_day]\nend",
"def stock_picker(prices)\n\t# Initialize everything to 0\n\tmin = 0\t\t\t# Day with lowest price so far\t\t\t\t\t\n\tbuy = 0\t\t\t# Buy day with best max_diff so far\n\tsell = 0\t\t# Sell day with best max_diff so far\n\tmax_diff = 0\t# Best value of prices[sell]-prices[buy]\n\t(1...prices.length).each do |i|\n\t\t# Go through each day - not necessary to do the first\n\t\tif prices[i] < prices[min]\n\t\t\t# If current price is less than current min:\n\t\t\tmin = i\t\t\t\t\t\t# Set as current min\n\t\tend\n\t\tdiff = prices[i] - prices[min]\t# Compare difference to current min\n\t\tif diff > max_diff\n\t\t\t# If it's better:\n\t\t\tbuy = min\t\t\t\t\t# Record min as day to buy\n\t\t\tsell = i\t\t\t\t\t# Record current day as day to sell\n\t\t\tmax_diff = diff\t\t\t\t# Record new max difference\n\t\tend\n\tend\n\t[buy, sell]\nend",
"def stock_picker(stocks)\n buy_day, sell_day, max_profit = 0, 0, 0\n for i in (0...stocks.length - 1)\n buy, possible_sales = stocks[i], stocks[i+1..-1]\n best_sale = possible_sales.max # Find the best price we can still sell for\n current_profit = best_sale - buy\n if current_profit > max_profit\n max_profit = current_profit # New standard we'll have to beat\n buy_day = i + 1 # If i is 0, we should buy on day 1\n sell_day = sales.index(best_sale) + buy_day + 1 # Add 1 in both cases to correct for indexing\n end\n end\n print [buy_day,sell_day]\nend",
"def stock_picker(prices)\n buy_date = 0\n sell_date = 0\n max_profit = 0\n \n (0...prices.size).each do |buy|\n ((buy + 1)...prices.size).each do |sell|\n \n profit = prices[sell] - prices[buy] \n if max_profit < profit\n max_profit = profit\n buy_date = buy\n sell_date = sell\n end\n end\n end\n [buy_date, sell_date]\nend",
"def stockPicker(prices)\n pair = [0,0]\n profit = 0\n prices.each_with_index do |buy, i|\n # Find highest sell day\n sell = prices[i..-1].max\n if profit < (sell-buy)\n pair[0] = i\n pair[1] = prices[i..-1].index(sell)+i # Find index of that sell day\n profit = sell-buy\n end\n end\n pair\nend",
"def stock_picker(days)\n\tx = 0\n\tsets_of_two = days.permutation(2).to_a\n\tdifference = sets_of_two.map { |a,b| a-b }\n\tdiff_low_to_high = difference.sort\n\tbuy_sell = sets_of_two[difference.index(diff_low_to_high[0])]\n\n\twhile days.find_index(buy_sell[0]) > days.find_index(buy_sell[1])\n\t\tbuy_sell = sets_of_two[difference.index(diff_low_to_high[x])]\n\t\tx += 1\n\tend\n\n\tprint [days.find_index(buy_sell[0]), days.find_index(buy_sell[1])]\t\nend",
"def stock_picker(prices)\n index = 0\n lowest = 0\n best_value = []\n for i in prices\n for j in prices[index..prices.length-1]\n if i - j < lowest\n lowest = i - j # lowest will be equal to the greatest price difference (greatest negative number)\n min = prices.index(i) # index of buy date\n max = prices.index(j) # index of sell date\n end\n end\n index += 1 # increments each iteration to ensure sell dates cannot be past dates\n end \n best_value << min\n best_value << max\n puts \"#{best_value} If you buy on day #{min} and sell on day #{max},\n you will make $#{lowest.abs} profit.\"\nend",
"def stock_picker(prices)\n\n profit = 0\n\n (prices.length - 1).times do |i|\n\n curr_buy_price = prices[0]\n prices.delete_at(0)\n\n if prices.max - curr_buy_price > profit\n profit = prices.max - curr_buy_price\n buy_index = i\n sell_index = i + prices.index(prices.max) + 1\n @best_days = [buy_index, sell_index]\n end\n\n end\n\n p @best_days\n \nend",
"def stock_picker(stock_prices)\n\n max_profit = 0\n best_days = []\n\n stock_prices.each_with_index do |buying_price, index|\n (index+1).upto(stock_prices.length - 1) do |selling_index|\n selling_price = stock_prices[selling_index]\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n best_days = [index, selling_index]\n end\n\n end\n end\n best_days\nend",
"def stock_picker prices\n\tbest_buy_date = nil\n\tbest_sell_date = nil\n\tbest_profit = 0\n\tprices.each_index do |buy_date|\n\t\t(buy_date+1...prices.length).each do |sell_date|\n\t\t\tprofit = prices[sell_date] - prices[buy_date]\n\t\t\tif profit > best_profit\n\t\t\t\tbest_profit = profit\n\t\t\t\tbest_buy_date = buy_date\n\t\t\t\tbest_sell_date = sell_date\n\t\t\tend\n\t\tend\n\tend\n\t[best_buy_date,best_sell_date]\nend",
"def stock_picker(data)\n #setup\n buy_day = 0\n sell_day = 0\n #algorithm\n for i in 0...data.length\n for j in (i+1)...data.length\n if (data[j]-data[i]) > (sell_day-buy_day)\n buy_day = i\n sell_day = j\n end\n end\n end\n #return\n [buy_day,sell_day]\nend",
"def stock_picker(prices)\n\tmax_diffs_for_each_day = []\n\tsecond_days_for_each_max_diff = []\n\t# the - 1 ignores buys on the last day, which can't be sold\n\t# also keeps the remaining_prices range beginning from overshooting its end\n\tfor day in (0...(prices.length - 1)) \n\t\tremaining_prices = prices[(day + 1)...prices.length]\n\t\tmax_remaining_price = remaining_prices.max\n\t\tmax_diffs_for_each_day << (max_remaining_price - prices[day])\n\t\t# for tied maxes, index will return the earliest day, which we want\n\t\t# the + 1 accounts for zero-indexing of remaining_prices\n\t\tsecond_days_for_each_max_diff << (remaining_prices.index(max_remaining_price) + day + 1)\n\tend\n\tmaxest_diff = max_diffs_for_each_day.max\n\t# for tied maxes, index will return the earliest day, which we want\n\tfirst_day = max_diffs_for_each_day.index(maxest_diff)\n\tsecond_day = second_days_for_each_max_diff[first_day]\n\t[first_day, second_day]\nend",
"def stock_picker(stock_values)\n n = stock_values.length\n max_profit = 0;\n start_day = nil\n end_day = nil\n\n for i in (0...n)\n for j in (i + 1...n)\n potential_profit = stock_values[j] - stock_values[i]\n if potential_profit > max_profit\n max_profit = potential_profit\n start_day = i\n end_day = j\n end\n end\n end\n\n [start_day, end_day]\nend",
"def computeBuySellToMaximizeProfit()\n currentStock = \"\"\n i = 0 # Loop counter\n while i < @days.size do # Traverse the data for each date to find price differences\n if i == @days.size - 1 # For the final week\n puts \"#{@days[i]} SELL #{currentStock}\"\n break\n end\n weeklyDifferences = [] # Stores the price differences between closing prices for all stocks in a particular week\n @data.each_with_index do |(key, value), index| # Traverse the data corresponding to current date for each key (stock)\n stockDifferences = {} # Stores the price difference between closing prices for a stock in a particular week\n stockDifferences[:stock] = key\n stockDifferences[:difference] = (value[i+1][:close].to_f - value[i][:close].to_f).round(5) # value[i+1] represents the next date for the stock data\n weeklyDifferences << stockDifferences\n end\n mostProfitableStock = getMostProfitableStock(weeklyDifferences)\n if i == 0 # For week 1\n puts \"#{@days[i]} BUY #{mostProfitableStock}\"\n currentStock = mostProfitableStock\n elsif mostProfitableStock == currentStock # If the stock already bought is more profitable\n puts \"#{@days[i]} HOLD #{mostProfitableStock}\"\n else\n puts \"#{@days[i]} SELL #{currentStock}, BUY #{mostProfitableStock}\"\n currentStock = mostProfitableStock \n end\n i = i + 1\n end\n end",
"def best_profit (stock_prices_yesterday)\n possible_sale_combinations = stock_prices_yesterday.combination(2).to_a\n profits = []\n possible_sale_combinations.each do |pair|\n buy_price = pair[0]\n sell_price = pair[1]\n profit = sell_price - buy_price\n profits << profit\n end\n profits.sort!\n profits.count\n max_profit = profits[-1]\n if max_profit < 0\n return 0\n else\n return max_profit\n end\nend",
"def stock_picker(array)\n max_profit = 0\n buy_sell_days = [0,0]\n array.each_with_index do |buy_price, buy_day|\n array.each_with_index do |sell_price, sell_day|\n if buy_day > sell_day\n next\n end\n if sell_price - buy_price > max_profit\n max_profit = sell_price - buy_price\n buy_sell_days = [buy_day, sell_day]\n end\n end \n end \n p buy_sell_days\nend",
"def stock_picker(arr)\n\tbuy_day = 0\n\tsell_day = 0\n\told_profit = -999\n\n\tarr.each_with_index do |buy_price, buy_index|\n\t\tarr.each_with_index do |sell_price, sell_index|\n\t\t\tif sell_index <= buy_index\n\t\t\t\tnext\n\t\t\tend\n\t\t\tnew_profit = sell_price - buy_price\n\t\t\tif new_profit > old_profit\n\t\t\t\told_profit = new_profit\n\t\t\t\tbuy_day = buy_index\n\t\t\t\tsell_day = sell_index\n\t\t\tend\n\t\tend\n\tend\n\treturn [buy_day,sell_day]\nend",
"def stock_picker(arr)\n profit = 0\n bestdays = []\n\n arr.each_with_index do |buyp, buyi|\n arr.each_with_index do |sellp, selli|\n next unless buyi < selli && (sellp - buyp) > profit\n\n profit = sellp - buyp\n bestdays[0] = buyi\n bestdays[1] = selli\n end\n end\n puts \"#{bestdays[0]} and #{bestdays[1]}\"\nend",
"def stock_picker(stocks)\n biggest_price = 0\n profitable_days = []\n (0...stocks.length).each do |i|\n (i + 1...stocks.length).each do |j|\n day = stocks[i][0]\n price = stocks[i][1]\n other_day = stocks[j][0]\n other_price = stocks[j][1]\n stock_price = price - other_price\n if stock_price.abs > biggest_price\n biggest_price = stock_price\n profitable_days = [day, other_day]\n end\n end\n end\n\n profitable_days\nend",
"def stock_picker(stocks)\n profit = 0\n\n for i in 0...stocks.length\n # ensures when looping through the prices, sell date comes after buy date\n for j in (i + 1)...stocks.length\n if (stocks[j] - stocks[i]) > profit\n profit = stocks[j] - stocks[i]\n buy_date = i\n sell_date = j\n end\n end\n end\n\n days = [buy_date, sell_date]\n p days\n p \"Total profit would be $#{profit}\"\nend",
"def stock_picker(prices)\n price_diff = 0\n count = 0\n best_days_array = []\n\n prices.each do |price1|\n count += 1\n prices.each do |price2|\n if count > prices.index(price2)\n next\n else\n if (price2 - price1) > price_diff\n price_diff = (price2 - price1)\n best_days_array = [prices.index(price1), prices.index(price2)]\n end\n end\n end\n end\n puts best_days_array\nend",
"def stock_picker(arr)\n best_days = []\n arr.each do |i|\n arr.each do |x|\n if arr.index(x) > arr.index(i)\n if x - i > 0\n best_days.insert(x - i, \"Buying day #{arr.index(i)} and selling day #{arr.index(x)} gives the highest possible profit of #{x - i}\")\n end\n end\n end\n end\n best_days.last\nend",
"def stock_picker(arr)\n\thighestGain = 0\n\tbuyDay = 0\n\tsellDay = 0\n\n\tarr.each_index do |i|\n\t\tbiggestGainDayFrom = findDayWithHighestGainFrom(i, arr)\n\t\tif arr[biggestGainDayFrom] - arr[i] > highestGain\n\t\t\thighestGain = arr[biggestGainDayFrom] - arr[i]\n\t\t\tbuyDay = i\n\t\t\tsellDay = biggestGainDayFrom\n\t\tend\n\tend\n\treturn [buyDay,sellDay]\nend",
"def sell(stonks)\n \nreversed = stonks.reverse\nstocks_you_can_sell = stonks.slice(selling_array(stonks),100)\nbiggest = stocks_you_can_sell.max\nsell_day = stocks_you_can_sell.find {|stock| stock <= biggest}\n \nreturn sell_day\n\nend",
"def stock_picker(stock_arr)\n highest_profit = 0 \n best_day_to_buy = 0 \n best_day_to_sell = 0 \n\n # Return 0- 9 but due to \"...\" it means it will exclude running the last number \n for i in 0...stock_arr.length \n #I am using a nested array so I can keep track of one number and use the other to iterate \n # Ex. [0, 1-8],[1, 2-8], [2, 3-8], .. [8, 8-8] and so on \n #I am doing this so I can use the i index postion to keep track of each day \n # Then I will use the second for loop to iterate through the stock_arr again and compare and calculate\n # those value to what I have in i(the tracked day) \n # I keep the calculation in profit_calculating until I find the profit_calculating becomes a number with the highest_profit \n for j in i+1...stock_arr.length do \n profit_calculating = stock_arr[j] - stock_arr[i]\n if highest_profit < profit_calculating\n highest_profit = profit_calculating\n best_day_to_buy = i \n best_day_to_sell = j \n end\n end \n end\n return \"[#{best_day_to_buy}, #{best_day_to_sell}] with a profit of #{highest_profit}\"\n\nend",
"def stock_picker(prices)\n acc_profit = 0\n acc_buy_date = 0\n acc_sell_date = 0\n \n profits = prices.map.with_index do |price, index|\n remaining_days = prices[index..-1] # to create an array that becomes smaller each iteration from index 0\n maximum = remaining_days.max # to identify the maximum number in that iteration's array\n highest_value = maximum - price # price is at index 0, so maximum minus minimum for each one will help identify the best buy/sell dates\n \n # create accumilator for index and value of highest profit\n if highest_value > acc_profit\n acc_profit = highest_value\n acc_buy_date = prices.index(price)\n acc_sell_date = prices.index(maximum)\n end\n\n end\n \n p \"Buy on day #{acc_buy_date} and sell on day #{acc_sell_date} for a profit of $#{acc_profit}.\"\n end",
"def stock_picker(array)\n sorted_stocks = array.sort.reverse\n profit = 0\n days_buy_sell = []\n sorted_stocks.each do |price_sell|\n array.each do |price_buy|\n if price_buy < price_sell && array.index(price_sell) > array.index(price_buy) && price_sell - price_buy > profit\n days_buy_sell = [array.index(price_buy), array.index(price_sell)]\n profit = price_sell - price_buy\n end\n end\n end\n days_buy_sell\nend",
"def stock_picker(stock_prices)\n buying_price = 0\n buying_index = 0\n selling_price = 0\n max_profit = -1\n max_buy_index = 0\n max_sell_index = 0\n\n change_buy = true\n\n stock_prices.each_with_index do |price, day|\n selling_price = stock_prices[day + 1].to_i\n\n if change_buy\n buying_price = price.to_i\n buying_index = day\n end\n\n if buying_price > selling_price\n change_buy = true;\n else\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n max_sell_index = day + 1\n max_buy_index = buying_index\n end\n change_buy = false;\n end\n\n end\n\n [max_buy_index, max_sell_index]\n\nend",
"def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = data[day2] - data[day1] #update these variables if profit margin is larger than existing\n\t\t\t\tsellDate = day2\n\t\t\t\tbuyDate = day1\n\t\t\tend\n\t\t\tday2 += 1\n\t\tend\n\t\tday1 += 1\n\tend\n\treturn [buyDate, sellDate] \nend",
"def stock_picker(prices)\n combinations = prices.combination(2).to_a\n profits = combinations.map { |days| days[1] - days[0] }\n (0...prices.size).to_a.combination(2).to_a[profits.index(profits.max)]\nend",
"def stock_picker(arr)\n\n max_profit = 0 \n\n days = []\n\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx1 < idx2 && (num2 - num1) > max_profit\n max_profit = num2 - num1\n days = [idx1, idx2]\n end\n end\n end\n\n # return most profitable days \n days \n \n end",
"def stock_picker(prices)\n\t# Storing variables what I use later\n\t$d = 0\n\t$small = 0\n\t$big = 0\n\tprices.each do |x|\t\t\t# iterating through all prices elements\n\t\ty = prices.index(x)+1 \t# y is the next element in prices array\n\t\twhile y < (prices.length)\t# it runs till we have something in the array\n\t\t\tif (x-prices[y]) < $d \t# only runs when the difference of x element and the next one is lower than the previous pair's (which is stored in $d)\n\t\t\t\t$d = x-prices[y] \t# so we store the lowest difference in $d\n\t\t\t\t$small = prices.index(x) \t# we store in $small the index number of x in the array, that is the day when we need to buy, the lowest price\n\t\t\t\t$big = y \t\t\t\t\t# y is the index number in the array of the number, which is the highest, and have the biggest difference with x\n\t\t\t\ty += 1 \t\t\t\t\t\t# add +1 to y so we can loop through the array\n\t\t\telse\n\t\t\t\ty += 1 \t\t\t\t\t\t# if the difference of the following pair is not smaller than the previous ones then we just move on and don't change $small and $big and $d\n\t\t\tend\n\t\tend\n\tend\n\tresult = []\n\tresult.push($small, $big) \t\t\t# pushing the results into result array\n\tputs result\nend",
"def pick_stocks(prices)\n profits = []\n pairs = []\n prices.each_with_index do |price_b, buy_date|\n prices.each_with_index do |price_s, sell_date|\n if sell_date > buy_date\n profits << price_s - price_b\n pairs << [buy_date, sell_date]\n end\n end\n end\n pairs[profits.index(profits.max)]\nend",
"def stock_picker(stock_array)\n\n day_hash = Hash.new(0)\n day_index = 0\n stock_array.each { |day_number|\n day_hash[day_index] = day_number\n day_index += 1\n }\n\n day_hash_sell = day_hash.clone\n profit_best = Hash.new(0)\n profit_best_counter = nil\n day_hash.each do |key, value|\n\n buy = -value \n day_hash_sell.each do |key_sell, value_sell|\n\n #ensure day is only in futue\n if key_sell <= key then \n next\n end\n\n profit = buy + value_sell \n if profit_best_counter == nil || profit > profit_best_counter then \n #reset hash to ensure only 1 answer given\n profit_best = Hash.new(0)\n\n #track best days to buy/sell in array\n profit_best[key] = key_sell\n\n #keep track of best profit so far\n profit_best_counter = profit\n end \n end \n end\n puts profit_best\nend",
"def stock_picker(prices)\n profits_per_day = {}\n prices.each_with_index do |value, index|\n break if index == prices.length - 1\n profit = prices[index + 1] - value\n if (index + 1 == prices.length - 1)\n profits_per_day[profit] = [index, index + 1]\n break\n end\n for i in (index + 2..prices.length - 1)\n profit = prices[i] - value > profit ? prices[i] - value : profit\n end\n profits_per_day[value] = profit\n end\n return profits_per_day.max_by{|k,v| v}\nend",
"def stock_picker(stock_prices)\n best_margin = 0\n\n #require \"pry\"; binding.pry\n\n for day in 0..stock_prices.length - 1\n lowest_price = stock_prices[day]\n highest_price = stock_prices[day..-1].max\n margin = highest_price - lowest_price\n\n if best_margin < margin\n best_margin = margin\n best = [lowest_price, highest_price]\n end\n end\n\n lowest_day = stock_prices.index(best[0])\n highest_day = stock_prices.index(best[1])\n [lowest_day, highest_day]\nend",
"def find_best_day\n day_array = @days.map do |day|\n day.strftime('%A')\n end\n\n day_hash = day_array.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }\n day_hash.max_by { |_, v| v }\n end",
"def bestonetradeprofit(prices)\n # find highest difference between price and subsequent price\n # starting best is second - first\n max = prices[1] - prices[0]\n while prices.length > 1\n e = prices.shift\n prices.each {|v| \n if (v - e) > max \n max=(v-e)\n end\n }\n end\n return max\nend",
"def stock_picker(number_array)\n #Stores current profit to be gained\n profit = 0\n #Stores the maximum profit from the combination of previous days\n max_profit = 0\n #Stores the days in which max profit can be had. stored_days[0] is buy day. stored_days[1] is sell day\n stored_days = [0, 0]\n\n #Loops through all numbers in array. Compares each iteration against all numbers from the iteration to the end of the array for max profit\n for i in 0..number_array.length-1\n # p \"Day #{i}: \"\n for j in i..number_array.length-1\n if number_array[j] < number_array[i]\n break\n else\n profit = number_array[j] - number_array[i]\n # p \"buy: \" + number_array[i].to_s + \" sell: \" + number_array[j].to_s + \" profit: \" + profit.to_s\n if profit > max_profit\n max_profit = profit\n stored_days[0] = i\n stored_days[1] = j\n end\n end\n end\n end\n return stored_days\nend",
"def stock_picker(arr)\n buy = \"\"\n sell = \"\"\n biggest_difference = 0\n profit = 0\n arr.each_with_index do |day, index|\n #no days after last day so last day can't be the buy day\n if (day != arr[-1])\n #sell date must be after purchase date, therefore only want indicies after current\n future_date = (index +1)\n while future_date < arr.length\n profit = arr[future_date] - arr[index]\n if profit > biggest_difference\n buy = index\n sell = future_date\n biggest_difference = profit\n end\n future_date += 1\n end\n end\n end\n [buy,sell]\nend",
"def stock(prices)\n\n all_choices = []\n\n prices.each_with_index do |buy, i1|\n prices.each_with_index do |sell, i2|\n next if i1 >= i2 \n all_choices << [buy, sell]\n end\n end\n\n best_choice = 0 # []\n\n all_choices.each do |combination| # [ [] ] \n buy_price, sell_price = combination\n profit = sell_price - buy_price\n if profit > best_choice[1] - best_choice[0]\n best_choice = [buy_price, sell_price]\n end\n end\n best_choice\nend",
"def stock_picker(prices)\n\t# Empty hash for saving the buy & sell days (key) and the proffit (value)\n\tbuy_sell = Hash.new\n\n\tprices.each do |buy|\n\t\t# loop inside the loop that caluclates proffit ONLY IF the sell date has higher index than the buy date in the array.\n\t\tprices.each do |sell|\n\t\t\tif prices.index(sell) > prices.index(buy)\n\t\t\t\tproffit = sell - buy\n\t\t\t\t# Saves the buy index, sell index and proffit into our hash\n\t\t\t\tbuy_sell[\"#{prices.index(buy)}, #{prices.index(sell)}\"] = proffit\n\t\t\tend\n\t\tend\n\tend\n\t# lists the hash key (buy & sell day) that had the highest proffit value.\n\tputs buy_sell.key(buy_sell.values.max)\nend",
"def buy_and_sell_price(prices)\n return if prices.length < 2\n\n buy_price = prices[0]\n current_buy_price = buy_price\n max_profit = (prices[1] - buy_price)\n\n for i in 2..prices.length - 1\n profit = prices[i] - current_buy_price\n\n if profit > max_profit\n buy_price = current_buy_price\n max_profit = profit\n else\n current_buy_price = [current_buy_price, prices[i]].min\n end\n end\n\n [buy_price, max_profit + buy_price]\nend",
"def stock_picker(prices)\n days = [0,0]\n profit = 0\n i = 0\n\n while i < prices.size\n n = i + 1\n while n < prices.size\n dividend = (prices[n].to_i - prices[i].to_i)\n if dividend > profit\n profit = dividend\n days[0] = prices.index(prices[i])\n days[1] = prices.index(prices[n])\n end\n n += 1\n end\n i += 1\n end\n print \"Buy at $#{prices[days[0]]} and sell at $#{prices[days[1]]}\"\n puts \" on days #{days} for a profit of $#{prices[days[1]] - prices[days[0]]}!\"\nend",
"def stock_prices(array)\n i = 0\n \n max_profit = -1\n buy_day = nil\n sell_day = nil\n \n length = array.length\n \n while i < length - 1\n j = i + 1\n \n while j < length\n profit = array[j] - array[i]\n \n if profit > max_profit\n max_profit = profit\n buy_day = i\n sell_day = j\n end\n \n j += 1\n end\n \n i += 1\n end\n \n return \"Buy day: #{buy_day}. Sell day: #{sell_day}.\"\nend",
"def stock_picker stock_prices\n coll = Hash.new \n stock_prices.each_index do |i|\n stock_prices.map.with_index(i) do |e, j|\n if stock_prices[j] && stock_prices[j] > stock_prices[i]\n coll[[i, j]] = stock_prices[j] - stock_prices[i]\n end\n end\n end\n\n coll = coll.key(coll.values.max)\n puts \"Buy on day:\\t#{coll[0]} \\nSell on day:\\t#{coll[1]}\"\n puts \"Profit ($):\\t#{stock_prices[coll[1]] - stock_prices[coll[0]]}\"\nend",
"def max_profit(prices)\n sell_one, sell_two = 0, 0\n buy_one, buy_two = Float::INFINITY, Float::INFINITY\n \n prices.each do |price|\n buy_one = [buy_one, price].min\n sell_one = [sell_one, price - buy_one].max\n buy_two = [buy_two, price - sell_one].min\n sell_two = [sell_two, price - buy_two].max\n end\n sell_two\nend",
"def stock_picker(arr)\n days = Array.new(2,0)\n profit = 0\n min_index = 0\n cost = arr.first\n\n arr.each_with_index do |price, index|\n if price < cost\n cost = price\n min_index = index\n next\n end\n if (price - cost) > profit\n days = [min_index, index] \n profit = price - cost\n end\n end\n days\nend",
"def stock_picker(stock_prices)\n\n\tstock_prices.map!{|price| price.to_i}\t#Convert array values to integers\n\n#Empty array for buy-low and sell-high differences\n\tdifference = []\n\n#Each day is considered a (low_price) and respective (high_price) is determined\n\tstock_prices.map.with_index do |price, i|\n\t\tlow_price = price\n\t\thigh_price = stock_prices[i+1..-1].max\n#The differnces array collects all high-low differences\t\t\n\t\tdifference.push(high_price.to_i - low_price.to_i)\n\tend\n\n\tday_1 = difference.index(difference.max)\t#Get day of highest difference possible\n\tday_2 = stock_prices.index(stock_prices[day_1+1..-1].max)\t#Calculate correspoinding high value\n\n\ta = [day_1]\n\tb = [day_2]\n\n\tprint a + b\nend",
"def stock_picker(arr)\n final_profit = 0\n current_profit = 0\n final_dates = []\n\n arr.each do |buy_price|\n buy_date = arr.index(buy_price)\n \n arr.each do |sell_price| \n sell_date = arr.index(sell_price)\n \n if (sell_date > buy_date && sell_price > buy_price) \n current_profit = sell_price - buy_price\n if current_profit > final_profit\n final_profit = current_profit\n final_dates = [buy_date, sell_date]\n end\n end \n end\n end\n puts final_dates\nend",
"def best_day\n\n end",
"def stock_picker(prices)\n current_max = 0\n buy_index = 0\n sell_index = 1\n (0...prices.length - 1).each do |buy|\n (buy + 1...prices.length).each do |sell|\n if prices[sell] - prices[buy] > current_max\n current_max = prices[sell] - prices[buy]\n buy_index = buy\n sell_index = sell\n end\n end\n end\n [buy_index, sell_index]\nend",
"def stock_picker(prices)\n\n buy = 0\n sell = 0\n max = 0\n \n prices.each_index do |x|\n prices.each_index do |y|\n if prices[y] - prices[x] > 0 and prices[y] - prices[x] > max and y > x\n buy = x\n sell = y\n max = prices[y] - prices[x]\n end\n end\n end\n \n [buy, sell]\nend",
"def get_max_profit(stock_prices_yesterday)\n # check for at least 2 prices\n if stock_prices_yesterday.length < 2\n raise IndexError, 'Need at least 2 prices to test.'\n end\n # initialize first price and the first possible profit\n min_price = stock_prices_yesterday[0]\n max_profit = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n\n stock_prices_yesterday.each_with_index do |current_price, index|\n if index == 0 then next end\n # see what our profit would be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n # update max_profit\n max_profit = [max_profit, potential_profit].max\n # update min_price\n min_price = [min_price, current_price].min\n end\n return max_profit\nend",
"def best_profit (stock_prices_yesterday)\n min_price = stock_prices_yesterday[0]\n max_profit = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n\n stock_prices_yesterday.each do |stock_price|\n if stock_price <= min_price\n min_price = stock_price\n elsif (stock_price - min_price) > max_profit\n max_profit = stock_price - min_price\n end\n end\n max_profit\nend",
"def highest_possible_profit(prices)\n best_profit = 0\n # iterate over the dataset\n prices.each_with_index do |price, index|\n # in each hour compare with the future hours to find difference\n\n # check if difference is positive\n # check if difference is greater than current best\n # keep best difference\n # check next hour\n\n end\n # end return the best difference\n\nend",
"def stock_picker(prices)\r\n\tprice_to_buy = 0\r\n\tprice_to_sell = 0\r\n\tprofit = 0\r\n\r\n\tprices[0..-2].each_with_index do |buy, index_buy|\r\n\t\tprices[(index_buy + 1)..-1].each_with_index do |sell, index_sell|\r\n\t\t\tif profit < sell - buy\r\n\t\t\t\tprofit = sell - buy\r\n\t\t\t\tprice_to_buy = index_buy\r\n\t\t\t\tprice_to_sell = index_sell + (index_buy + 1)\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t[price_to_buy, price_to_sell]\r\nend",
"def stock_picker(price_arr)\n profit = 0\n trade_days = [0,0]\n price_arr.each_with_index do |buy_value, buy_day|\n price_arr.each_with_index do |sell_value, sell_day|\n if (sell_value - buy_value) > profit\n profit = (sell_value - buy_value)\n trade_days[0] = buy_day\n trade_days[1] = sell_day\n end\n end\n end\n \"buy on #{trade_days[0]} and sell on #{trade_days[1]} for a profit of #{profit}\"\nend",
"def best_profit_from_yesterday_greedy(prices_array)\n\n lowest_thus_far = prices_array[0]\n max_profit = 0\n\n prices_array.each do |price|\n if price < lowest_thus_far\n lowest_thus_far = price\n end\n\n potential_profit = price - lowest_thus_far\n if(potential_profit > max_profit)\n max_profit = potential_profit\n end\n end\n max_profit\nend",
"def stock_picker(stock_arr)\n\tdiff=0\n\tbuy_date=0\n\tsell_date=0\n\tcombo=(0...30).to_a.combination(2).to_a\n\tprint combo\n\tputs \"\"\n\tcombo.each do |x,y|\n\t\tif (stock_arr[y] - stock_arr[x]) > diff\n\t\t\tdiff = (stock_arr[y] - stock_arr[x])\n\t\t\tsell_date=y\n\t\t\tbuy_date=x\n\t\tend\n\tend\n\n\tputs \"Buy date: #{buy_date}, Sell date: #{sell_date}, Profit: #{diff}\"\nend",
"def stock_picker(array)\n # loop through array twice. Once to take value, 2nd to compare, store index into result\n result = []\n profit, buy_day, sell_day = 0, 0, 0\n\n array.size.times do |n|\n (n + 1).upto (array.size - 1) do |i|\n if (array[n] - array[i]) > profit\n profit = array[n] - array[i]\n buy_day = n\n sell_day = i\n end\n end\n end\n [buy_day, sell_day]\nend",
"def stock_picker(arr)\n\tdifference = 0\n\tstart_index = 0\n\tend_index = 0\n\ti=0\n\twhile i < arr.length #outer loop starts on the 1st day\n\t\tj=i+1 #increment should be 1 greater than the 1st day\n\t\twhile j < arr.length #inner loop goes through all values after i day\n\t\t\tjelly = [arr[j], arr[i]].inject(:-) #calculate largest difference\n\t\t\tif jelly > difference\n\t\t\t\tdifference = jelly #update values if the difference is larger\n\t\t\t\tstart_index = i\n\t\t\t\tend_index = j\n\t\t\tend\n\t\t\tj=j+1\n\t\tend\n\t\ti=i+1\n\tend\n\tanswer=[]\n\tanswer << start_index\n\tanswer << end_index\n\treturn answer #return array of first day followed by second day\nend",
"def stock_picker(prices)\n #results array indicates the best time to buy and then sell the stock\n results = [0, 0]\n #this variable keeps tabs of the best positive price difference\n greatest_price_difference = 0\n prices.each_with_index do |price, current_index|\n #index_counter keeps track of the index in the array as it's being\n #looped in the while loop\n \n index_counter = current_index + 1\n #the while loop loops through the array starting with the first \n #potential day to buy and compares the potential difference\n #each day going forward to determine which day would be best to sell on\n #should they buy the stock today\n while index_counter < prices.length\n \n price_difference = prices[index_counter] - prices[current_index]\n if price_difference > greatest_price_difference\n #price difference is updated if a greater difference is found\n greatest_price_difference = price_difference\n results[0] = current_index \n results[1] = index_counter \n end\n index_counter += 1\n end\n end\n\n\n\n puts results\nend",
"def stock_picker(prices, best_profit = -(2**(0.size * 8 -2)) )\t\n\tabs_max_sell = prices[1..-1].max\n\n\tmin_buy = prices[0..-2].min\n\tmin_buy_index = prices.index(min_buy)\n\n\tmax_sell = prices[(min_buy_index+1)..-1].max\n\tmax_sell_index = (min_buy_index + 1) + prices[(min_buy_index+1)..-1].index(max_sell)\n\n\tprofit = max_sell - min_buy\n\t\n\tif (profit > best_profit)\n\t\tbest_profit = profit\n\tend\n\tif (max_sell == abs_max_sell || prices[0..(min_buy_index-1)].length == 1)\n\t\tputs \"Best profit is #{best_profit}, buying on day #{min_buy_index} and selling on day #{max_sell_index}\"\n\telse\n\t\tprices = prices[0..(min_buy_index-1)]\n\t\tstock_picker(prices, best_profit)\n\tend\nend",
"def price_is_right(bids, actual_retail_price)\n diff = actual_retail_price\n best_bid = nil\n bids.each do |bid|\n\n highest = actual_retail_price - bid\n\n if highest > 0 && highest <= diff\n diff, best_bid = highest, bid\n end\n end\n\n best_bid\nend",
"def stock_picker(array)\n result = 0\n largest = 0\n# count is the value of the array to check against the arrays proceeding values, which are represented by step\n count = 0\n step = 1\n while count < array.length - 1\n while step < array.length\n result = array[step] - array[count]\n if result > largest && result > 0\n largest = result\n low = count\n high = step\n end\n step += 1\n end\n count += 1\n step = count + 1\n end\n if low == nil\n puts \"There was never a good day to buy and sell the stock\"\n else\n puts \"The best day to buy the stock was day #{low.to_s} at #{array[low].to_s}, and the best day to sell was day #{high.to_s} at #{array[high].to_s}\"\n end\nend",
"def stock_picker(arr)\n profits = []\n arr.each_with_index do |price, day|\n arr[day + 1..-1].each do |price2, day2|\n profit = price - price2\n profits << profit.abs if profit.negative?\n end\n end\n profits.empty? ? -1 : profits.max\nend",
"def stock_picker(stock_prices)\n lowest, highest = 9999999999, 0\n index_of_highest, index_of_lowest = 0\n\n stock_prices.each_with_index do |price, index|\n \n if price > highest\n highest, index_of_highest = price, index\n end\n\n end\n\n index = 0\n while index < index_of_highest\n\n if stock_prices[index] < lowest\n lowest, index_of_lowest = stock_prices[index], index\n end\n\n index += 1\n end\n \n\n\n\n puts \"You bought stock on Day #{index_of_lowest + 1}, for $#{lowest}, and sold it on Day #{index_of_highest + 1} for $#{highest}. Your profit is $#{highest - lowest}.\"\nend",
"def stock_picker(array)\n\n#store 2 numbered arrays that consist of every combination of numbers in the passed array\n manipulate_array = array.combination(2).to_a\n\n# change each array's 2 index to contain the difference of the two numbers\n manipulate_array.each do |i|\n i.push(i.max - i.min) \n end\n \n# sort the array by thier difference from largest to smalles \n sorted_array = manipulate_array.sort {|a,b| b[2] <=> a[2]}\n \n sorted_array.each do |i|\n# delete the sum from each combonation \n i.delete_at(2)\n# return the position of the smallest price that comes before the postion of the highest price (returning day to buy low then return the day to buy high)\n if array.index(i.min) < array.index(i.max)\n return [array.index(i.min),array.index(i.max)]\n break\n elsif i == sorted_array.last\n return \"There are no buy opportunities in this set of stock prices\"\n end\n end\nend",
"def getMoneySpent(keyboards, drives, b)\n\n# pair_sum stores the possible pair prices\n pair_sum= []\n \n# The product method does the combining for us \n combinations = keyboards.product(drives)\n \n# Then we reduce(:+) each pair subarray and push it to the sum array if it's not above our budget\n combinations.each { |pair| pair_sum << pair.reduce(:+) if pair.reduce(:+) <= b } \n\n# Finally we return -1 if the sum array is empty, meaning all pairs are above budget.\n# Otherwise we return the max\n pair_sum.empty? ? -1 : pair_sum.max\nend",
"def minCostTravel( days, costs)\n\tn = days.length\n\tmax = days[n - 1]\n\tdp = Array.new(max + 1){0}\n\tj = 0\n\ti = 1\n\twhile (i <= max)\n\t\tif (days[j] == i)\n\t\t\t# That days is definitely travelled.\n\t\t\tj += 1\n\t\t\tdp[i] = dp[i - 1] + costs[0]\n\t\t\tdp[i] = min(dp[i],dp[max(0,i - 7)] + costs[1])\n\t\t\tdp[i] = min(dp[i],dp[max(0,i - 30)] + costs[2])\n\t\telse\n\t\t\tdp[i] = dp[i - 1]\n\t\tend\n\t\ti += 1\n\tend\n\treturn dp[max]\nend",
"def get_max_profit(stock_prices_yesterday)\n min_price = stock_prices_yesterday.first\n max_profit = stock_prices_yesterday[1] - min_price\n stock_prices_yesterday.each.with_index do |price, idx|\n next if idx == 0\n potential_profit = price - min_price\n max_profit = potential_profit if potential_profit > max_profit\n min_price = price if price < min_price\n end\n max_profit\nend",
"def get_max_profit(prices)\n raise IndexError(\"Must be at least 2 prices\") if prices.length < 2\n #initialize a current_max_profit and current_min\n current_min = prices[0]\n current_max_profit = prices[1] - prices[0]\n\n prices.each do |price|\n #calculate the potential profit and check if it's larger than current max profit\n potential_profit = price - current_min\n current_max_profit = [potential_profit, current_max_profit].max\n #update current_min\n current_min = [current_min, price].min\n end\n current_max_profit\nend",
"def getMoneySpent(keyboards, drives, b)\n prices = Hash.new(0)\n keyboards.sort.reverse.each do |most_expensive_keyboard|\n drives.sort.reverse.each do |most_expensive_drive|\n prices[most_expensive_keyboard+most_expensive_drive] = [most_expensive_keyboard, most_expensive_drive]\n end\n end\n\n prices.keys.sort.reverse.each do |value|\n return value if value <= b\n end\n -1\nend",
"def pick_stocks(stocks)\n stocks = stocks[0]\n max_profit = 0\n min_stock = stocks[0]\n index1_temp = 0\n index1_lock = 0\n index2 = 0\n for i in 1...stocks.length()\n if stocks[i] < min_stock\n min_stock = stocks[i]\n index1_temp = i\n else\n if max_profit < (stocks[i]-min_stock)\n max_profit = stocks[i]-min_stock\n index2 = i\n index1_lock = index1_temp\n end\n end\n end\n if index1_lock == index2\n puts \"Not a good time to invest\"\n else\n puts \"I would recommend buying on Day #{index1_lock + 1} and selling on Day #{index2 + 1}.\"\n end\nend",
"def get_max_profit(stocks)\n min_price = stocks[0]\n biggest_diff = stocks[1] - min_price\n\n # keep track of biggest difference, and smallest price\n stocks.each_with_index do |stock, i|\n next if i == 0 # skip first\n curr_diff = stock - min_price\n biggest_diff = curr_diff if curr_diff > biggest_diff\n\n min_price = stock if stock < min_price\n end\n\n biggest_diff\nend",
"def stock_picker(arr)\n answer = []\n highest_value = 0\n buy = 0\n sell = 0\n\n for i in 0..(arr.length-1) do\n for j in (i+1)..(arr.length-1) do\n if arr[j] - arr[i] > highest_value\n highest_value = arr[j] - arr[i]\n buy = i\n sell = j\n end\n end\n end\n\n answer.push(buy)\n answer.push(sell)\n\n puts answer\nend",
"def max_profit(prices)\n max_profit = 0\n min_price = prices[0]\n \n prices.each do |price|\n min_price = [min_price, price].min\n max_profit = [max_profit, price - min_price].max\n end\n \n max_profit\nend",
"def max_profit(prices)\n max = 0\n min = (2**(0.size * 8 -2) -1)\n\n prices.each do |price|\n if price < min\n min = price\n else\n max = [max, price - min].max\n end\n end\n\n max\nend",
"def max_profit(prices)\n profit = 0\n 0.upto(prices.size - 2) do |current_pointer|\n next_pointer = current_pointer + 1\n diff = prices[next_pointer] - prices[current_pointer]\n profit += diff > 0 ? diff : 0\n end\n profit\nend",
"def stock_picker(stocks)\n\traise \"You are suck, use array!\" unless stocks.is_a? Array\n\traise \"You are a sock, use numbers!\" unless stocks.all? {|num|num.is_a? Numeric}\n\n buy = 0\n sell = 0\n difference = 0\n\n stocks.each_with_index do |first_number, first_index|\n first_index.upto(stocks.size - 1 ) do |second_index|\n second_number = stocks[second_index]\n\n if second_number - first_number > difference\n difference = second_number - first_number\n buy, sell = first_index, second_index\n end\n\n end\n end\n\n [buy, sell]\n\nend",
"def a_second_failed_stock_picker(array)\n high_stock_price = array.max\n low_stock_price = array.min\n hash = Hash[array.map.with_index.to_a]\n day_to_sell = hash[high_stock_price]\n day_to_buy = hash[low_stock_price]\n if day_to_buy < day_to_sell\n \"on day #{day_to_buy} buy at #{low_stock_price} then on day #{day_to_sell} sell at #{high_stock_price}\"\n else\n p \"you can't buy on day #{day_to_buy} sell on day #{day_to_sell}\"\n p hash\n #so i have a hash, presumably I should be able to pick from it, the next lowest\n end\nend",
"def on_2(prices)\n max_profit = 0\n min_valley = prices.max\n\n prices.each do |number|\n if number < min_valley\n min_valley = number\n elsif number - min_valley > max_profit\n max_profit = number - min_valley\n end\n end\n\n max_profit\n end",
"def find_greatest_profit\n\n @stock_prices_yesterday.each.with_index do |buy_amount, index|\n\n #Set biggest profit to the first transaction to avoid errors caused by a comparision with nil.\n @biggest_profit ||= @stock_prices_yesterday[0] - @stock_prices_yesterday[1]\n\n counter = 1\n while index + counter < 480\n if (@stock_prices_yesterday[index + counter] - buy_amount) > @biggest_profit\n @biggest_profit = @stock_prices_yesterday[index + counter] - buy_amount\n @buy_price = @stock_prices_yesterday[index]\n @buy_time = index\n @sell_price = @stock_prices_yesterday[index + counter]\n @sell_time = index + counter\n counter += 1\n puts counter\n else\n counter +=1\n puts counter\n end\n end\n end\n @biggest_profit\n end",
"def max_profit(prices)\n buy1 = Float::INFINITY\n buy2 = Float::INFINITY\n profit1 = 0\n prices.reduce(0) do |total_profit, price|\n buy1 = [buy1, price].min\n profit1 = [profit1, price - buy1].max\n buy2 = [buy2, price - profit1].min\n [total_profit, price - buy2].max\n end\nend",
"def high_cost_travel_days\n @high_cost_travel_days ||= count_days(:high, :travel)\n end",
"def days_on_market\n return 0 if Time.now < @available_at\n day = 1*24*60*60\n ((Time.now - @available_at)/ day).floor\n end",
"def spread\n best_ask.fetch(:price) - best_bid.fetch(:price)\n end"
] |
[
"0.80740863",
"0.7687703",
"0.74781924",
"0.74291193",
"0.7358535",
"0.73476434",
"0.73292494",
"0.7243231",
"0.71886474",
"0.71795917",
"0.717516",
"0.71716034",
"0.7134846",
"0.7111988",
"0.7110159",
"0.7081622",
"0.7058404",
"0.702956",
"0.7027008",
"0.7022063",
"0.70012134",
"0.6941333",
"0.6939342",
"0.69035524",
"0.68997014",
"0.6886737",
"0.6885251",
"0.6882459",
"0.6870541",
"0.6868524",
"0.68631524",
"0.6806067",
"0.68058676",
"0.68037933",
"0.6762252",
"0.67230165",
"0.6711873",
"0.6679809",
"0.66748893",
"0.6667218",
"0.66639566",
"0.6639416",
"0.6632354",
"0.6629169",
"0.6625408",
"0.662198",
"0.6598518",
"0.65951365",
"0.6593128",
"0.65529525",
"0.6551298",
"0.65264887",
"0.65235436",
"0.6518585",
"0.6517566",
"0.651451",
"0.6512746",
"0.65013635",
"0.6497157",
"0.6470222",
"0.64534885",
"0.6407875",
"0.6407534",
"0.6354283",
"0.63244516",
"0.63173884",
"0.6315287",
"0.6306523",
"0.62924945",
"0.6269322",
"0.6244252",
"0.6217238",
"0.6176576",
"0.61711216",
"0.61690664",
"0.6163624",
"0.6130678",
"0.6127076",
"0.6117795",
"0.60855174",
"0.6072892",
"0.6070484",
"0.604952",
"0.60411286",
"0.6036029",
"0.6030866",
"0.600828",
"0.5988635",
"0.59863204",
"0.59816027",
"0.5979815",
"0.595836",
"0.5954369",
"0.59339607",
"0.5919983",
"0.5915372",
"0.5908284",
"0.59079444",
"0.58988935",
"0.5892304"
] |
0.6844025
|
31
|
Identifies the orionvm cloud === Return true:: If the orionvm cloud can be identified false:: Otherwise
|
def looks_like_orionvm?
hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end",
"def exists?\n vnic\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def multivm?\n vms.length > 1\n end",
"def vm_exists?(uuid)\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def validic_user_provisioned?\n return (!self.validic_id.nil? && !self.validic_access_token.nil?)\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def ready?\n q = get_connection(\"neutron\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend",
"def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end",
"def valid_target_url?\n return false unless cloud_info = cloud_info()\n return false unless cloud_info[:name]\n return false unless cloud_info[:build]\n return false unless cloud_info[:support]\n return false unless cloud_info[:version]\n true\n rescue\n false\n end",
"def can_compute?(user)\n if user.nil? || !user.registered_for_firecloud?\n false\n else\n # don't check permissions if API is not 'ok'\n if ApplicationController.firecloud_client.services_available?(FireCloudClient::SAM_SERVICE, FireCloudClient::RAWLS_SERVICE, FireCloudClient::AGORA_SERVICE)\n begin\n workspace_acl = ApplicationController.firecloud_client.get_workspace_acl(self.firecloud_project, self.firecloud_workspace)\n if workspace_acl['acl'][user.email].nil?\n # check if user has project-level permissions\n user.is_billing_project_owner?(self.firecloud_project)\n else\n workspace_acl['acl'][user.email]['canCompute']\n end\n rescue => e\n ErrorTracker.report_exception(e, user, { study: self.attributes.to_h})\n Rails.logger.error \"Unable to retrieve compute permissions for #{user.email}: #{e.message}\"\n false\n end\n else\n false\n end\n end\n end",
"def remotely_useful?\n plan&.remotely_useful? || super\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def ready?\n q = get_connection(\"network\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def provision?\n true\n end",
"def virtual?\n card&.virtual?\n end",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def looks_like_orionvm_v3?\n File.exists?('/etc/udev/rules.d/70-contextdrive.rules')\n end",
"def visa_exists?\n schengen_visa.nil? == false\n end",
"def check_fusion_natd(options,if_name)\n if options['vmnetwork'].to_s.match(/hostonly/)\n check_fusion_hostonly_network(options,if_name)\n end\n return options\nend",
"def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def is_online?\n begin\n dc_version = crm_attribute '-q', '--type', 'crm_config', '--query', '--name', 'dc-version'\n return false unless dc_version\n return false if dc_version.empty?\n return false unless cib_section_nodes_state\n true\n rescue Puppet::ExecutionFailure\n false\n end\n end",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def internal_or_core?(pin); end",
"def check_ci\n vm = @uri.vm\n ncp = 0\n\n if vm.is_ci\n vm.toggle_ci(false)\n\n # HACK wait max 10min to let ci finish his work\n while vm.checkci do\n break if ncp == 5\n sleep(120)\n ncp += 1\n end\n vm.clearci\n end\n\n return true\n end",
"def already_used?\n p \"Checking already used\"\n vehicle.present? and state == 1\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end",
"def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend",
"def valid_fc_target?\n dell_server? &&\n !brownfield? &&\n has_related_storage? &&\n related_storage_volumes.map(&:fc?).all?\n end",
"def service_nasi?()\n return true if (@service == TAC_PLUS_AUTHEN_SVC_NASI)\n return false\n end",
"def is_intronic?\n genes = Ensembl::Core::Gene.find(:all, :conditions => [\"biotype = ? AND seq_region_start < ? and seq_region_end > ? and seq_region_strand = ? and seq_region_id = ?\",\"protein_coding\",self.start,self.start,self.strand,self.seq_region_id]) \n genes.empty? ? answer = false : answer = true\n return answer\n #ncrna = self.slice\n #genes = ncrna.genes(true)\n #genes.select{|g| g.biotype == \"protein_coding\"}.each do |gene|\n # unless gene.stable_id == self.stable_id\n # gene_slice = Slice.fetch_by_gene_stable_id(gene.stable_id)\n # return true if ncrna.within?(gene_slice)\n # end\n #end\n #return false\n end",
"def check_me\n isme = false\n vm = nil\n\n if @uri\n vm = @uri.vm\n elsif params[:uri][:vm]\n vm = Vm.find(params[:uri][:vm])\n else\n return false\n end\n\n if @user.lead?\n isme = @user.projects.any? { |project| project.id == vm.project.id }\n else\n isme = (@user.id == vm.user.id)\n end\n\n raise Exceptions::NextDeployException.new(\"Access forbidden for this user\") unless isme\n end",
"def on_ec2?\n ec2 != nil\nend",
"def checkvrtlpc(session)\n vm = false\n vpcprocs = [\n \"vmusrvc.exe\",\n \"vmsrvc.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vpcprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vpc-s3\")\n vm = true\n elsif srvvals and srvvals.include?(\"vpcuhub\")\n vm = true\n elsif srvvals and srvvals.include?(\"msvmmouf\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualPC\" },\n :update => :unique_data\n )\n print_good(\"This is a VirtualPC Virtual Machine\")\n return \"VirtualPC\"\n end\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def on_azure?\n azure != nil\n end",
"def on_azure?\n azure != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def virtual_network_match_plan\n errors.add(:base, 'plan virtual_network mismatch') if virtual_network.cloud != plan.cloud && virtual_network.region.start_with?(cloud_profile.region)\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def available?\n @vpc.state == 'available'\n end",
"def vm_guest_ip?(vm)\n vm.guest.guestState == 'running' && vm.guest.toolsRunningStatus == 'guestToolsRunning' && !vm.guest.ipAddress.nil? && IPAddr.new(vm.guest.ipAddress).ipv4?\n end",
"def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend",
"def provisioning?\n status == \"PROVISIONING\"\n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def is_vaccine?\n vaccine\n end",
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def vms_in_host?(host_id)\n\n host = OpenNebula::Host.new_with_id(host_id,get_one_client)\n\n rc = host.info\n\n if OpenNebula::is_error?(rc)\n puts rc.message\n exit -1\n end\n \n host['host_share/running_vms'].to_i\n\nend",
"def not_cloud_start(cloud_type, vm_ips, vm_ip_roles, vm_img_roles, pm_up)\n \n # Try to find one virtual machine that is already running\n vm_ips.each do |vm|\n if alive?(vm)\n # This machine is running\n puts \"#{vm} is up\"\n vm_leader = vm\n\n # Inform the user of this machine\n puts \"#{vm_leader} is already running\"\n puts \"Do 'puppet apply manifest.pp' on #{vm_leader}\"\n return\n end\n end\n \n # No machines are running\n puts \"All virtual machines are stopped\"\n puts \"Starting one of them...\"\n \n # Start one of the virtual machines\n vm = vm_ips[rand(vm_ips.count)] # Choose one randomly\n puts \"Starting #{vm} ...\"\n \n @vm_manager.start_vm(vm, vm_ip_roles, vm_img_roles, pm_up)\n \n # That virtual machine will be the \"leader\" (actually the chosen one)\n vm_leader = vm\n \n # Copy important files to it\n #copy_cloud_files(vm_leader, cloud_type)\n \n puts \"#{vm_leader} is being started\"\n puts \"Once started, do 'puppet apply manifest.pp' on #{vm_leader}\"\n\n end",
"def deployable?\n self.grid_service_id && self.pending? && !expired?\n end",
"def physical?\n return data.atk_class == 1\n end",
"def invm?\n @is_invm\n end",
"def provisional?\n registered? && @provisional\n end",
"def able_to_operate?(_entity, _train, _name)\n true\n end",
"def vlanid_set?\n shell_out = Mixlib::ShellOut.new(\"powershell.exe -Command \\\"(Get-NetlbfoTeamNic -Name '#{new_resource.device}').VlanID -eq #{new_resource.vlan}\\\"\")\n shell_out.run_command\n\n return false if shell_out.error?\n shell_out.stdout.chomp == 'True'\n end",
"def tvc_address?\n self.id == Rails.application.config.fedex_vc_address_id || (self.first_name == \"The Visible\" && self.last_name == \"Closet\")\n end",
"def baremetal?\n if dell_server?\n !related_switches.empty? && related_volumes.empty? && related_clusters.empty?\n else\n related_volumes.empty? && related_clusters.empty?\n end\n end",
"def vip_member\n is_admin != true\n end",
"def attacking_vertical?\n false\n end",
"def esxi_installed?\n os_image_type == \"vmware_esxi\" && os_installed?\n end",
"def is_hyperv?\n return false if os_image_type.nil?\n\n \"hyperv\" == os_image_type.downcase\n end",
"def operable?\n initialize_description!\n return false if !reachable? || description.hidden?\n description.primary? || description.secondary?\n end",
"def is_primary?\n !is_regional?\n end",
"def default_tenancy?\n @vpc.instance_tenancy == 'default'\n end",
"def test_multicloud\n cid = VirtualMonkey::Toolbox::determine_cloud_id(s_one)\n if cid == 232\n test_cloud_files\n else\n if @storage_type == \"ros\"\n test_s3\n elsif @storage_type == \"volume\"\n test_ebs\n end\n end\n end",
"def is?(match)\n match === RbConfig::CONFIG[\"host_os\"]\n end",
"def remote_plan_needed?\n return false if dont_create_remote\n if Rails.env.test? || Rails.env.development?\n !self.id.in?(1..3)\n else\n true\n end\n end",
"def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def hyperv_with_dedicated_intel_iscsi?(network, server)\n return false unless network.type == \"STORAGE_ISCSI_SAN\"\n return false unless server.is_hyperv?\n\n iscsi_card = server.network_cards[1]\n\n iscsi_card && iscsi_card.nic_info.product =~ /Intel/\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 vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end",
"def soldiership_vagabondizer_clownish?()\n end",
"def vt_current?\n vt_intersects?(Time.zone.now)\n end",
"def has_vm?(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"has_vm?(#{vm_cid})\") do\n @telemetry_manager.monitor('has_vm?', id: vm_cid) do\n vm = @vm_manager.find(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n !vm.nil? && vm[:provisioning_state] != 'Deleting'\n end\n end\n end",
"def netcore?\n ! @proj_xml_node.css('Project').attr('Sdk').nil?\n end",
"def is_cesia?\n CESIA_UPN.include?(self.upn)\n end"
] |
[
"0.6731178",
"0.65344596",
"0.64719707",
"0.6430523",
"0.63247144",
"0.6225154",
"0.61882967",
"0.61516964",
"0.6135572",
"0.6129361",
"0.61072576",
"0.6083947",
"0.6081457",
"0.6072907",
"0.6061748",
"0.60019016",
"0.5980817",
"0.59437996",
"0.5930491",
"0.5917122",
"0.59110135",
"0.5895604",
"0.58909",
"0.58775294",
"0.58660823",
"0.5854497",
"0.5854497",
"0.5832935",
"0.5832935",
"0.5831229",
"0.58290523",
"0.5797987",
"0.578946",
"0.5785386",
"0.57781214",
"0.5774107",
"0.57701236",
"0.57674897",
"0.5734022",
"0.5718109",
"0.57146704",
"0.5708817",
"0.5708817",
"0.5705298",
"0.5687728",
"0.5681326",
"0.5678633",
"0.56720155",
"0.56715435",
"0.5663568",
"0.56627923",
"0.56606007",
"0.5657295",
"0.5657295",
"0.56493676",
"0.56493676",
"0.5644328",
"0.56425256",
"0.563746",
"0.56322575",
"0.56322575",
"0.5629072",
"0.5629016",
"0.5628405",
"0.56237894",
"0.56187075",
"0.5615513",
"0.5613418",
"0.5603177",
"0.56005746",
"0.5599462",
"0.5582531",
"0.5576854",
"0.55743957",
"0.5556486",
"0.55545115",
"0.55474204",
"0.55371886",
"0.5523018",
"0.5522276",
"0.5521862",
"0.5521195",
"0.5515404",
"0.55141115",
"0.55120105",
"0.55025965",
"0.5500617",
"0.55001444",
"0.54990596",
"0.5496456",
"0.5492727",
"0.5492727",
"0.54926115",
"0.548319",
"0.5481519",
"0.54797155",
"0.547953",
"0.54765767",
"0.54747033",
"0.54744595"
] |
0.6617936
|
1
|
Identifies the orionvm v2 cloud === Return true:: If the orionvm v2 cloud can be identified false:: Otherwise
|
def looks_like_orionvm_v2?
File.exists?('/etc/orion_base')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def looks_like_orionvm?\n hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3?\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def multivm?\n vms.length > 1\n end",
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def exists?\n vnic\n end",
"def on_ec2?\n ec2 != nil\nend",
"def looks_like_orionvm_v3?\n File.exists?('/etc/udev/rules.d/70-contextdrive.rules')\n end",
"def v2?\n version == 2\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def vm_exists?(uuid)\n end",
"def test_multicloud\n cid = VirtualMonkey::Toolbox::determine_cloud_id(s_one)\n if cid == 232\n test_cloud_files\n else\n if @storage_type == \"ros\"\n test_s3\n elsif @storage_type == \"volume\"\n test_ebs\n end\n end\n end",
"def ready?\n q = get_connection(\"neutron\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def valid_target_url?\n return false unless cloud_info = cloud_info()\n return false unless cloud_info[:name]\n return false unless cloud_info[:build]\n return false unless cloud_info[:support]\n return false unless cloud_info[:version]\n true\n rescue\n false\n end",
"def ec2_instance?\n Net::HTTP.get_response(URI.parse(metadata_url)) && true\n rescue\n false\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def ec2?(node)\n node.key?('ec2')\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend",
"def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end",
"def provision?\n true\n end",
"def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end",
"def validic_user_provisioned?\n return (!self.validic_id.nil? && !self.validic_access_token.nil?)\n end",
"def virtual_network_match_plan\n errors.add(:base, 'plan virtual_network mismatch') if virtual_network.cloud != plan.cloud && virtual_network.region.start_with?(cloud_profile.region)\n end",
"def cvv2_resp_code_matches?\n return ['M'].include? cvv2_resp_code\n end",
"def sdk_version_2?\n sdk_version.to_s == '2'\n end",
"def virtual?\n card&.virtual?\n end",
"def ready?\n q = get_connection(\"network\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def available?\n @vpc.state == 'available'\n end",
"def is_online?\n begin\n dc_version = crm_attribute '-q', '--type', 'crm_config', '--query', '--name', 'dc-version'\n return false unless dc_version\n return false if dc_version.empty?\n return false unless cib_section_nodes_state\n true\n rescue Puppet::ExecutionFailure\n false\n end\n end",
"def not_cloud_start(cloud_type, vm_ips, vm_ip_roles, vm_img_roles, pm_up)\n \n # Try to find one virtual machine that is already running\n vm_ips.each do |vm|\n if alive?(vm)\n # This machine is running\n puts \"#{vm} is up\"\n vm_leader = vm\n\n # Inform the user of this machine\n puts \"#{vm_leader} is already running\"\n puts \"Do 'puppet apply manifest.pp' on #{vm_leader}\"\n return\n end\n end\n \n # No machines are running\n puts \"All virtual machines are stopped\"\n puts \"Starting one of them...\"\n \n # Start one of the virtual machines\n vm = vm_ips[rand(vm_ips.count)] # Choose one randomly\n puts \"Starting #{vm} ...\"\n \n @vm_manager.start_vm(vm, vm_ip_roles, vm_img_roles, pm_up)\n \n # That virtual machine will be the \"leader\" (actually the chosen one)\n vm_leader = vm\n \n # Copy important files to it\n #copy_cloud_files(vm_leader, cloud_type)\n \n puts \"#{vm_leader} is being started\"\n puts \"Once started, do 'puppet apply manifest.pp' on #{vm_leader}\"\n\n end",
"def cvv2_resp_code_matches?\n return ['M'].include? cvv2_resp_code\n end",
"def check_ci\n vm = @uri.vm\n ncp = 0\n\n if vm.is_ci\n vm.toggle_ci(false)\n\n # HACK wait max 10min to let ci finish his work\n while vm.checkci do\n break if ncp == 5\n sleep(120)\n ncp += 1\n end\n vm.clearci\n end\n\n return true\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def remotely_useful?\n plan&.remotely_useful? || super\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def cavv_matches?\n ['','2','8'].include? cavv_response\n end",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def cavv_matches?\n ['','2','8'].include? cavv_response\n end",
"def allow_auth_failures?\n return true if node.key?('virtualization') && node['virtualization']['system'] == 'vbox'\n return true if ::File.exist?('/.dockerenv')\n return true if ENV['CI']\n false\n end",
"def check_me\n isme = false\n vm = nil\n\n if @uri\n vm = @uri.vm\n elsif params[:uri][:vm]\n vm = Vm.find(params[:uri][:vm])\n else\n return false\n end\n\n if @user.lead?\n isme = @user.projects.any? { |project| project.id == vm.project.id }\n else\n isme = (@user.id == vm.user.id)\n end\n\n raise Exceptions::NextDeployException.new(\"Access forbidden for this user\") unless isme\n end",
"def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend",
"def attacking_vertical?\n false\n end",
"def checkvrtlpc(session)\n vm = false\n vpcprocs = [\n \"vmusrvc.exe\",\n \"vmsrvc.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vpcprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vpc-s3\")\n vm = true\n elsif srvvals and srvvals.include?(\"vpcuhub\")\n vm = true\n elsif srvvals and srvvals.include?(\"msvmmouf\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualPC\" },\n :update => :unique_data\n )\n print_good(\"This is a VirtualPC Virtual Machine\")\n return \"VirtualPC\"\n end\n end",
"def valid_fc_target?\n dell_server? &&\n !brownfield? &&\n has_related_storage? &&\n related_storage_volumes.map(&:fc?).all?\n end",
"def default_tenancy?\n @vpc.instance_tenancy == 'default'\n end",
"def c2_task?\n product.c2_test || (product.c3_test && ep_measures?)\n end",
"def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend",
"def is_vaccine?\n vaccine\n end",
"def on_openstack?\n openstack != nil\n end",
"def on_openstack?\n openstack != nil\n end",
"def api_version_v2?\n client.url_prefix.to_s =~ /v2\\.0/\n end",
"def provisioning?\n status == \"PROVISIONING\"\n end",
"def remote_plan_needed?\n return false if dont_create_remote\n if Rails.env.test? || Rails.env.development?\n !self.id.in?(1..3)\n else\n true\n end\n end",
"def check_fusion_natd(options,if_name)\n if options['vmnetwork'].to_s.match(/hostonly/)\n check_fusion_hostonly_network(options,if_name)\n end\n return options\nend",
"def i2c_exists?\n\tFile.exist?('/dev/i2c-0') || File.exist?('/dev/i2c-1')\nend",
"def ec2?(node = __getnode)\n node.key?(\"ec2\")\n end",
"def check_if_native(entity) #volumes or snapshots\n native = extension = false\n #check if 'native' volume API present:\n begin\n response = @connection.req(\"GET\", \"/#{entity}\")\n native = true if response.code.match(/^20.$/)\n return true, entity\n rescue OpenStack::Exception::ItemNotFound => not_found\n native = false\n end\n #check if available as extension:\n begin\n response = @connection.req(\"GET\", \"/os-#{entity}\")\n extension = true if response.code.match(/^20.$/)\n return false, \"os-#{entity}\"\n rescue OpenStack::Exception::ItemNotFound => not_found\n extension = false\n end\n raise OpenStack::Exception::NotImplemented.new(\"No Volumes support for this provider\", 501, \"No #{entity} Support\") unless (native || extension)\n end",
"def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end",
"def vip_member\n is_admin != true\n end",
"def provisioned?(vm_name=\"default\", provider=\"virtualbox\")\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend",
"def can_compute?(user)\n if user.nil? || !user.registered_for_firecloud?\n false\n else\n # don't check permissions if API is not 'ok'\n if ApplicationController.firecloud_client.services_available?(FireCloudClient::SAM_SERVICE, FireCloudClient::RAWLS_SERVICE, FireCloudClient::AGORA_SERVICE)\n begin\n workspace_acl = ApplicationController.firecloud_client.get_workspace_acl(self.firecloud_project, self.firecloud_workspace)\n if workspace_acl['acl'][user.email].nil?\n # check if user has project-level permissions\n user.is_billing_project_owner?(self.firecloud_project)\n else\n workspace_acl['acl'][user.email]['canCompute']\n end\n rescue => e\n ErrorTracker.report_exception(e, user, { study: self.attributes.to_h})\n Rails.logger.error \"Unable to retrieve compute permissions for #{user.email}: #{e.message}\"\n false\n end\n else\n false\n end\n end\n end",
"def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend",
"def internal_or_core?(pin); end",
"def visa_exists?\n schengen_visa.nil? == false\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 vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend",
"def not_ovs_ind?\n ovs_ind.nil?\n end",
"def doi_server_reachable?\n # Invoke the API and get response\n true\n end",
"def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end",
"def vserver= vserver_name\n if(@major_version >= 1 and @minor_version >= 15)\n @vfiler = vserver_name\n true\n else\n puts \"\\nONTAPI version must be at least 1.15 to send API to a vserver\\n\"\n false\n end\n end",
"def has_vm?(server_id)\n with_thread_name(\"has_vm?(#{server_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n !server.nil? && !%i[terminated deleted].include?(server.state.downcase.to_sym)\n end\n end",
"def on_azure?\n azure != nil\n end",
"def on_azure?\n azure != nil\n end",
"def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end"
] |
[
"0.66103345",
"0.65742433",
"0.6462222",
"0.64200187",
"0.6402527",
"0.6305493",
"0.6215357",
"0.6175751",
"0.6167907",
"0.6159091",
"0.6142463",
"0.6142463",
"0.6125003",
"0.6111821",
"0.6061957",
"0.60480857",
"0.60310775",
"0.6003999",
"0.59799635",
"0.5974892",
"0.5940216",
"0.58712137",
"0.58392006",
"0.58279556",
"0.57994807",
"0.5787203",
"0.5777724",
"0.5764307",
"0.5749096",
"0.5718302",
"0.5718302",
"0.5710452",
"0.5702204",
"0.5689717",
"0.5675855",
"0.56547785",
"0.5653105",
"0.5648105",
"0.5646244",
"0.5644321",
"0.5637261",
"0.56353503",
"0.56206834",
"0.5590279",
"0.5585736",
"0.5575355",
"0.5568593",
"0.5555763",
"0.5554371",
"0.55461156",
"0.5538199",
"0.5538199",
"0.55092794",
"0.550043",
"0.54993916",
"0.5498693",
"0.5496883",
"0.54884183",
"0.54760426",
"0.5469637",
"0.5469637",
"0.5469425",
"0.5462512",
"0.5459622",
"0.5458801",
"0.5455071",
"0.54530126",
"0.5443562",
"0.5430046",
"0.5427433",
"0.5410868",
"0.54003817",
"0.53944826",
"0.53944826",
"0.53893954",
"0.53841966",
"0.5381766",
"0.5379508",
"0.5374195",
"0.5365446",
"0.5364741",
"0.5355406",
"0.53513193",
"0.53493875",
"0.534783",
"0.5344406",
"0.53325796",
"0.532807",
"0.5322274",
"0.53205365",
"0.53205365",
"0.531818",
"0.5317824",
"0.5317799",
"0.5314277",
"0.53127366",
"0.5312165",
"0.5310454",
"0.5310454",
"0.53098416"
] |
0.6558422
|
2
|
Identifies the orionvm v3 cloud === Return true:: If the orionvm v3 cloud can be identified false:: Otherwise
|
def looks_like_orionvm_v3?
File.exists?('/etc/udev/rules.d/70-contextdrive.rules')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cloud?(node)\n node.key?('cloud')\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end",
"def looks_like_orionvm?\n hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3?\n end",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def multivm?\n vms.length > 1\n end",
"def exists?\n vnic\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:torque_yaml_ips),\n # method(:torque_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:torque_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"torque\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n\n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:torque_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def valid_target_url?\n return false unless cloud_info = cloud_info()\n return false unless cloud_info[:name]\n return false unless cloud_info[:build]\n return false unless cloud_info[:support]\n return false unless cloud_info[:version]\n true\n rescue\n false\n end",
"def resolve_cloud_type\n cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil\n @ec2 = false\n @rackspace = false\n @eucalyptus = false\n case cloud_type\n when 'ec2' then ec2 = true\n when 'rackspace' then @rackspace = true\n when 'eucalyptus' then eucalyptus = true\n end\n end",
"def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def test_multicloud\n cid = VirtualMonkey::Toolbox::determine_cloud_id(s_one)\n if cid == 232\n test_cloud_files\n else\n if @storage_type == \"ros\"\n test_s3\n elsif @storage_type == \"volume\"\n test_ebs\n end\n end\n end",
"def sdk_version_3?\n sdk_version.to_s == '3'\n end",
"def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"def is_cloudfront?\n type.downcase == \"cloudfront\"\n end",
"def start\n \n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:web_yaml_ips),\n # method(:web_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:web_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"web\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:web_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def active?\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a #{@cloud_id}, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n begin\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n if instance.state.name == \"terminated\" or\n instance.state.name == \"terminating\"\n return false\n end\n return true\n }\n end\n }\n rescue Aws::EC2::Errors::InvalidInstanceIDNotFound\n return false\n end\n return false\n end",
"def c3_cat3_task?\n product.c3_test && ep_measures?\n end",
"def ready?\n q = get_connection(\"neutron\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end",
"def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end",
"def google_cloud_environment?(url = nil)\n url ||= self.url\n !!url.match(/\\.c4d\\.devops\\.fds\\.com/) || !!url.match(/\\.gce\\.c4d\\.griddynamics\\.net/)\n end",
"def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end",
"def vm_exists?(uuid)\n end",
"def cloudstack?(node)\n node.key?('cloudstack')\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def virtual?\n card&.virtual?\n end",
"def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend",
"def on_gce?\n gce != nil\n end",
"def on_gce?\n gce != nil\n end",
"def can_compute?(user)\n if user.nil? || !user.registered_for_firecloud?\n false\n else\n # don't check permissions if API is not 'ok'\n if ApplicationController.firecloud_client.services_available?(FireCloudClient::SAM_SERVICE, FireCloudClient::RAWLS_SERVICE, FireCloudClient::AGORA_SERVICE)\n begin\n workspace_acl = ApplicationController.firecloud_client.get_workspace_acl(self.firecloud_project, self.firecloud_workspace)\n if workspace_acl['acl'][user.email].nil?\n # check if user has project-level permissions\n user.is_billing_project_owner?(self.firecloud_project)\n else\n workspace_acl['acl'][user.email]['canCompute']\n end\n rescue => e\n ErrorTracker.report_exception(e, user, { study: self.attributes.to_h})\n Rails.logger.error \"Unable to retrieve compute permissions for #{user.email}: #{e.message}\"\n false\n end\n else\n false\n end\n end\n end",
"def ready?\n q = get_connection(\"network\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end",
"def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"def check_ci\n vm = @uri.vm\n ncp = 0\n\n if vm.is_ci\n vm.toggle_ci(false)\n\n # HACK wait max 10min to let ci finish his work\n while vm.checkci do\n break if ncp == 5\n sleep(120)\n ncp += 1\n end\n vm.clearci\n end\n\n return true\n end",
"def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend",
"def actually_has_id3v2_tag?\n nil != defined?(@id3v2_tag) && nil != @id3v2_tag\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def vector?(obj)\n obj.instance_of?(Rus3::Vector)\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def validic_user_provisioned?\n return (!self.validic_id.nil? && !self.validic_access_token.nil?)\n end",
"def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"def netcore?\n ! @proj_xml_node.css('Project').attr('Sdk').nil?\n end",
"def not_cloud_start(cloud_type, vm_ips, vm_ip_roles, vm_img_roles, pm_up)\n \n # Try to find one virtual machine that is already running\n vm_ips.each do |vm|\n if alive?(vm)\n # This machine is running\n puts \"#{vm} is up\"\n vm_leader = vm\n\n # Inform the user of this machine\n puts \"#{vm_leader} is already running\"\n puts \"Do 'puppet apply manifest.pp' on #{vm_leader}\"\n return\n end\n end\n \n # No machines are running\n puts \"All virtual machines are stopped\"\n puts \"Starting one of them...\"\n \n # Start one of the virtual machines\n vm = vm_ips[rand(vm_ips.count)] # Choose one randomly\n puts \"Starting #{vm} ...\"\n \n @vm_manager.start_vm(vm, vm_ip_roles, vm_img_roles, pm_up)\n \n # That virtual machine will be the \"leader\" (actually the chosen one)\n vm_leader = vm\n \n # Copy important files to it\n #copy_cloud_files(vm_leader, cloud_type)\n \n puts \"#{vm_leader} is being started\"\n puts \"Once started, do 'puppet apply manifest.pp' on #{vm_leader}\"\n\n end",
"def is_online?\n begin\n dc_version = crm_attribute '-q', '--type', 'crm_config', '--query', '--name', 'dc-version'\n return false unless dc_version\n return false if dc_version.empty?\n return false unless cib_section_nodes_state\n true\n rescue Puppet::ExecutionFailure\n false\n end\n end",
"def check_fusion_natd(options,if_name)\n if options['vmnetwork'].to_s.match(/hostonly/)\n check_fusion_hostonly_network(options,if_name)\n end\n return options\nend",
"def already_used?\n p \"Checking already used\"\n vehicle.present? and state == 1\n end",
"def available?\n @vpc.state == 'available'\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def credentials_valid?\n zone_load_multi['result'] == 'success' rescue false\n end",
"def provision?\n true\n end",
"def checkvrtlpc(session)\n vm = false\n vpcprocs = [\n \"vmusrvc.exe\",\n \"vmsrvc.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vpcprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vpc-s3\")\n vm = true\n elsif srvvals and srvvals.include?(\"vpcuhub\")\n vm = true\n elsif srvvals and srvvals.include?(\"msvmmouf\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualPC\" },\n :update => :unique_data\n )\n print_good(\"This is a VirtualPC Virtual Machine\")\n return \"VirtualPC\"\n end\n end",
"def gce?(node)\n node.key?('gce')\n end",
"def valid_fc_target?\n dell_server? &&\n !brownfield? &&\n has_related_storage? &&\n related_storage_volumes.map(&:fc?).all?\n end",
"def cavv_matches?\n ['','2','8'].include? cavv_response\n end",
"def cavv_matches?\n ['','2','8'].include? cavv_response\n end",
"def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"def on_azure?\n azure != nil\n end",
"def on_azure?\n azure != nil\n end",
"def remotely_useful?\n plan&.remotely_useful? || super\n end",
"def physical?\n return data.atk_class == 1\n end",
"def vcr?\n self['recorded'].include?('VCR')\n end",
"def remote_plan_needed?\n return false if dont_create_remote\n if Rails.env.test? || Rails.env.development?\n !self.id.in?(1..3)\n else\n true\n end\n end",
"def status?\n return data.atk_class == 3\n end",
"def should_contract_cloud?(force=false)\n valid_rules?(:contract_when) || force || false\n end",
"def allow_auth_failures?\n return true if node.key?('virtualization') && node['virtualization']['system'] == 'vbox'\n return true if ::File.exist?('/.dockerenv')\n return true if ENV['CI']\n false\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 virtual_network_match_plan\n errors.add(:base, 'plan virtual_network mismatch') if virtual_network.cloud != plan.cloud && virtual_network.region.start_with?(cloud_profile.region)\n end",
"def vip_required?\n !config.wordpress.vip.nil?\n end",
"def vimeo?\n website.url.host =~ /vimeo/\n end",
"def on_softlayer?\n softlayer != nil\n end",
"def on_softlayer?\n softlayer != nil\n end",
"def fog_public\n true # or false\n end",
"def fetch_cloud\n @cloud ||= Cloud.find(params[:cloud_id])\n authorize @cloud, :show?\n end",
"def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend",
"def soldiership_vagabondizer_clownish?()\n end",
"def passes_consistency_check?(user)\n if private?\n if independent?\n project == user.private_files_project\n else\n project == user.private_comparisons_project\n end\n elsif public?\n project == user.public_files_project\n elsif ![STATE_CLOSED, STATE_COPYING].include?(state)\n project == space_object.project_for_user(user)\n else\n true\n end\n end",
"def on_ec2?\n ec2 != nil\nend",
"def trusted?\n @trusted ||= IPs.list.any? { |range| range.include? cloudflare_ip }\n end",
"def check_cve_2013_0632\r\n if datastore['USERDS']\r\n # the vulnerability for CVE-2013-0632 is that if RDS is disabled during install but\r\n # subsequently *enabled* after install, the password is unset so we simply must\r\n # check that and only that.\r\n cf_cookies = adminapi_login 'foo', 'bar', true\r\n if cf_cookies.empty?\r\n print_status \"#{datastore['RHOST']} is not vulnerable to CVE-2013-0632\"\r\n else\r\n print_status \"#{datastore['RHOST']} is vulnerable to CVE-2013-0632\"\r\n return true\r\n end\r\n else\r\n print_error \"Cannot test #{datastore['RHOST']} CVE-2013-0632 with USERDS off\"\r\n end\r\n false\r\n end",
"def ec2_instance?\n Net::HTTP.get_response(URI.parse(metadata_url)) && true\n rescue\n false\n end",
"def on_ec2?\n ec2 != nil\n end",
"def on_ec2?\n ec2 != nil\n end",
"def check_me\n isme = false\n vm = nil\n\n if @uri\n vm = @uri.vm\n elsif params[:uri][:vm]\n vm = Vm.find(params[:uri][:vm])\n else\n return false\n end\n\n if @user.lead?\n isme = @user.projects.any? { |project| project.id == vm.project.id }\n else\n isme = (@user.id == vm.user.id)\n end\n\n raise Exceptions::NextDeployException.new(\"Access forbidden for this user\") unless isme\n end",
"def visa_exists?\n schengen_visa.nil? == false\n end",
"def active?\n (not node_type_id.nil?) && (node_type_id != 3) && ( (not datacenter_id.nil?) or (not location_id.nil?) )\n end",
"def default_tenancy?\n @vpc.instance_tenancy == 'default'\n end",
"def c3_cat1_task?\n product.c3_test && eh_measures?\n end",
"def is_cesia?\n CESIA_UPN.include?(self.upn)\n end",
"def can_create_cluster?(project)\n project.clusters.empty?\n end",
"def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end",
"def is_cloudfront_alias?\n !@alias_target.nil? and @alias_target.is_cloudfront?\n end",
"def ubuntu?\n @flavor =~ /ubuntu/\n end",
"def is_vaccine?\n vaccine\n end"
] |
[
"0.6934454",
"0.68639785",
"0.61691487",
"0.61477035",
"0.61403996",
"0.60824776",
"0.6047192",
"0.6014773",
"0.601393",
"0.60110945",
"0.5905977",
"0.5862849",
"0.5858454",
"0.5847134",
"0.58408374",
"0.58385897",
"0.58172905",
"0.5809941",
"0.5808789",
"0.5802744",
"0.5797359",
"0.57872015",
"0.57806414",
"0.5751354",
"0.5744731",
"0.5740242",
"0.57378906",
"0.5715934",
"0.5710138",
"0.5708972",
"0.56721795",
"0.5652017",
"0.5652017",
"0.56510144",
"0.565076",
"0.5635176",
"0.5617103",
"0.5613164",
"0.56096154",
"0.5597612",
"0.5579588",
"0.5560155",
"0.5557641",
"0.5557641",
"0.55558485",
"0.55511975",
"0.5517762",
"0.5513725",
"0.5507162",
"0.550323",
"0.5502713",
"0.54974794",
"0.54968363",
"0.54968363",
"0.5493727",
"0.54912186",
"0.5485399",
"0.54848707",
"0.54806364",
"0.54790187",
"0.5448588",
"0.54450583",
"0.54450583",
"0.5443212",
"0.54394853",
"0.5437258",
"0.5434127",
"0.54290587",
"0.5420532",
"0.5417961",
"0.54172236",
"0.54083586",
"0.540799",
"0.5404327",
"0.537831",
"0.537831",
"0.53771013",
"0.5374465",
"0.5367654",
"0.5367654",
"0.53598857",
"0.5352269",
"0.5345227",
"0.53440773",
"0.53436166",
"0.5337878",
"0.53348976",
"0.5333589",
"0.5333589",
"0.53292817",
"0.5328948",
"0.53213423",
"0.53111285",
"0.5310129",
"0.5298123",
"0.52963674",
"0.5290066",
"0.52855647",
"0.5281963",
"0.52798235"
] |
0.617962
|
2
|
Determines whether IP address is private (reserved) === Parameters address:: IP address to test (ie '192.168.0.1')
|
def is_private?(address)
[
IPAddr.new('10.0.0.0/8'),
IPAddr.new('172.16.0.0/12'),
IPAddr.new('192.168.0.0/16'),
].any? do |i|
i.include? address
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_private(ip)\n\t\tpriv = FALSE\n\t\tif (ip_int(\"10.0.0.0\")..ip_int(\"10.255.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"172.16.0.0\")..ip_int(\"172.31.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"192.168.0.0\")..ip_int(\"192.168.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\tend\n\t\treturn priv\n\tend",
"def is_private(ip)\n\t\tpriv = FALSE\n\t\tif (ip_int(\"10.0.0.0\")..ip_int(\"10.255.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"172.16.0.0\")..ip_int(\"172.31.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"192.168.0.0\")..ip_int(\"192.168.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\tend\n\t\treturn priv\n\tend",
"def okIP(addr)\nreturn addr != \"0.0.0.0\" &&\n addr != \"255.255.255.255\" &&\n !addr.match(/^169\\.254.*/) &&\n !addr.match(/^10.*/) &&\n !addr.match(/^172\\.[1-3].*/) && # TODO: match the block better\n !addr.match(/^192\\.168.*/)\nend",
"def find_private_ip\n ip_addresses = interface_addresses\n ip_addresses.each do |ip|\n if ip.start_with?(\"192\") || ip.start_with?(\"10\")\n return ip\n end\n end\n return nil\n end",
"def private_ips\n filter_nics_and_return_ips {|nic| nic.internet_access == false }\n end",
"def is_valid_ip?(address)\n octets = address.split('.')\n return false if octets.length != 4\n octets.each {|octet| return false if octet.to_i > 255 || octet.to_i < 0}\n true\nend",
"def check_ip; end",
"def use_only_private_ip?\n @gcp_config['use_only_private_ip']\n end",
"def valid_ip?(address)\n address.is_a?(String)? validate_number_count(address) : false\nend",
"def has_address(interface)\n ip = Facter::Util::IP.get_interface_value(interface, 'ipaddress')\n if ip.nil?\n false\n else\n true\n end\nend",
"def configure_private_network_ip(config, ip, vm_name)\n if ip\n config.vm.network :private_network, :ip => ip, :netmask => \"255.255.255.0\"\n else\n puts \" NO HOSTONLY IP defined for VM #{vm_name}.\"\n end\n end",
"def valid_address? address\n code = call_blockchain_api(\"checkaddress/#{address}\")\n\n !['X5', 'SZ', 'CK'].include?(code)\n end",
"def private_ip_address\n private_ip_addresses.first\n end",
"def public_cidr?(cidr_s)\n cidr = NetAddr::CIDR.create(cidr_s)\n # CIDR ranges reserved for internal addresses\n [\n '10.0.0.0/8', '172.16.0.0/12', '198.168.0.0/16'\n ].each do |private_cidr|\n if cidr == private_cidr || cidr.is_contained?(private_cidr)\n return false\n end\n end\n true\n end",
"def has_public_ipaddress?\n # Define the test value\n test = false\n\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n if ip_config['public_ipaddress']['attached']\n test = true\n break\n end\n end\n end\n\n test\n end",
"def check_address(ip)\n @r.rule(:check, src: ip, chain: @allow, jump: 'ACCEPT').do?\n end",
"def check_address(ip)\n @r.rule(:check, src: ip, chain: @allow, jump: 'ACCEPT').do?\n end",
"def range?\n ip == network\n end",
"def addr_valid?(res)\n res << \"Provided IP addr isn't valid!\" unless ip_validation_lib.valid? addr\n end",
"def banned_ip_for_download?(ip_addr)\n raise ArgumentError unless ip_addr.is_a?(IPAddr)\n\n if ip_addr.ipv4?\n if IPAddr.new(\"127.0.0.1\") == ip_addr\n true\n elsif IPAddr.new(\"169.254.0.0/16\").include?(ip_addr)\n true\n elsif IPAddr.new(\"10.0.0.0/8\").include?(ip_addr)\n true\n elsif IPAddr.new(\"172.16.0.0/12\").include?(ip_addr)\n true\n elsif IPAddr.new(\"192.168.0.0/16\").include?(ip_addr)\n true\n else\n false\n end\n elsif ip_addr.ipv6?\n if IPAddr.new(\"::1\") == ip_addr\n true\n elsif IPAddr.new(\"fe80::/10\").include?(ip_addr)\n true\n elsif IPAddr.new(\"fd00::/8\").include?(ip_addr)\n true\n else\n false\n end\n else\n false\n end\n end",
"def has_ip?(ip_addr)\n if IPAddr.new(subnet_cidr) === IPAddr.new(ip_addr)\n # ip within subnet\n local_ips.include? ip_addr\n else\n # ip outside subnet\n public_ips.has_value? ip_addr\n end\n end",
"def private_ip_address\n data[:private_ip_address]\n end",
"def private_ip_address\n data[:private_ip_address]\n end",
"def rfc1918?(ip)\n return :private if Addrinfo.ip(ip).ipv4_private?\n\n :public\n end",
"def valid_ip?(address)\n #ternary that validates number count if string or returns false\n address.is_a?(String) ? validate_number_count(address) : false\nend",
"def exact_ip_address?(str)\n !!(str =~ /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/)\nend",
"def ceph_chef_ip4_address_in_network?(ip, params, net)\n net.contains?(ip) && params.key?('broadcast')\nend",
"def internal_ip?(ip)\n INTERNAL_SUBNETS.any? { |subnet| subnet.include?(ip) }\n end",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def private_ip_v4_address; end",
"def checkip?(ip)\n if ip =~ %r=^172.|^192.168.|^10.$=\n return \"Private Class C IP Range\"\n elsif ip =~ %r=^127.$=\n return \"Local Loopback\"\n end\n end",
"def nip_test (a_ip,b_ip)\n 0.upto(3) {|x| return false if (a_ip[x] != b_ip[x])}\n return true;\n end",
"def ip_in(subnet24)\n return false if ip.nil?\n ip.split(\".\")[0..1].join(\".\") == subnet24\n end",
"def ip?\n return (proto == 'ip')\n end",
"def allowed(ip)\n nip = ip_to_nip(ip)\n for x_ip in @access_list\n return true if (nip_test(nip, x_ip))\n end\n return false\n end",
"def valid_ip?\n if !@config[:host_allow_ip]\n bool = set_error(:ip_address_forbidden)\n elsif ip_address.include?(\":\")\n bool = ip_address.match(Resolv::IPv6::Regex) ? true : set_error(:ipv6_address_invalid)\n elsif ip_address.include?(\".\")\n bool = ip_address.match(Resolv::IPv4::Regex) ? true : set_error(:ipv4_address_invalid)\n end\n if bool && (localhost? && !@config[:host_local])\n bool = set_error(:ip_address_no_localhost)\n end\n bool\n end",
"def server_get_private_ip(server_name)\n private_ip = ''\n if server_exist?(server_name)\n server = find_match(@compute.servers, server_name)\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2)\n if address[1].length >= 1\n Puppet.debug \"found private ip = #{address[1][0].inspect}\"\n private_ip = address[1][0].addr\n end\n end\n end\n end\n return private_ip\n end",
"def get_public_ipv4\n # Socket.ip_address_list.detect{|intf| intf.ipv4? and !intf.ipv4_loopback? and !intf.ipv4_multicast? and intf.ipv4_private?}\n Socket.ip_address_list.detect{|intf| intf.ipv4_private?}\nend",
"def is_an_ip_number?(ip_string)\n /^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/.match?(ip_string)\nend",
"def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend",
"def private_ip_of(server)\n server[:cloud][:private_ips].first rescue server[:ipaddress]\n end",
"def is_whitelisted?(address)\n !!(self.class.safetynet_options[:whitelist].match(address))\n end",
"def accessible_from?(cidr_s)\n return false if ingress_permissions.empty?\n\n cidr = NetAddr::CIDR.create(cidr_s)\n allowed_cidrs = ingress_permissions.map(&:ip_ranges)\n .flatten.map(&:cidr_ip)\n matching_rules = allowed_cidrs.map do |source_cidr|\n cidr == source_cidr || cidr.is_contained?(source_cidr)\n end\n matching_rules.include? true\n end",
"def validate_ipaddr(ip)\n ip_regex = /\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/\n if ip_regex =~ ip\n return true\n else\n return false\n end\n end",
"def dot_seperated_ip_address?(input_string)\n numbers = input_string.split('.')\n return false if numbers.size != 4\n\n numbers.each do |num|\n return false if is_an_ip_number?(num) == false\n end\n true\nend",
"def is_local_host\n require 'ipaddr'\n begin\n local = IPAddr.new(\"127.0.0.0/8\")\n private1 = IPAddr.new(\"10.0.0.0/8\")\n private2 = IPAddr.new(\"172.16.0.0/12\")\n private3 = IPAddr.new(\"192.168.0.0/16\")\n private4 = IPAddr.new(\"85.230.85.45\")\n private5 = IPAddr.new(\"94.234.170.18\")\n\n if local.include?(request.remote_ip)\n return true\n end\n if private1.include?(request.remote_ip)\n return true\n end\n if private2.include?(request.remote_ip)\n return true\n end\n if private3.include?(request.remote_ip)\n return true\n end\n if private4.include?(request.remote_ip)\n return true\n end\n if private5.include?(request.remote_ip)\n return true\n end\n return false\n rescue\n return false\n end\n end",
"def check_private_ips\n $vms.each do |key,vm_config|\n if !vm_config['private_network_ip'].to_s.empty?\n $vms.each do |key_search,vm_config_search|\n if vm_config['private_network_ip'] == vm_config_search['private_network_ip']\n if key != key_search\n warn \"you have a ip conflict between #{vm_config['key']} and #{vm_config_search['name']}\".red\n end\n end\n end\n end\n end\nend",
"def address?\n if self.address\n return false\n else\n return true\n end\n end",
"def eaddrnotavail?() EADDRNOTAVAIL == @error_code; end",
"def has_cidr?(cidr_symbol)\n @by_cidr.key?(cidr_symbol)\n end",
"def check_ip_address\n if ip_address\n result = IPAddress.valid? ip_address\n errors.add( 'Incorrect IP formatting' ) unless result\n end\n end",
"def allowed_request\n !((request.remote_ip =~ /127\\.0\\.0\\.1/).nil? && (request.remote_ip =~ /128\\.128\\./).nil? && (request.remote_ip =~ /10\\.19\\./).nil?)\n end",
"def public_ips\n filter_nics_and_return_ips {|nic| nic.internet_access == true }\n end",
"def is_ip_addr?(part)\n ip = IPAddr.new(part)\n ip.ipv4?\n rescue IPAddr::InvalidAddressError => e\n false\n end",
"def valid_ip?(string)\n return false unless string =~ /^\\d+(\\.\\d+){3}$/\n nums = string.split('.').map(&:to_i)\n nums.all? { |num| num >= 0 && num <= 255 }\nend",
"def valid_ip?(string)\n string.split(\".\").each do |num_str|\n num = num_str.to_i\n return false if num < 0 || num > 255\n end\n true\nend",
"def valid_ip?(str)\n ip_ary = str.split('.')\n ip_ary.size == 4 && ip_ary.all?{|x| x.match(/^\\d{1,3}$/) && (0..255).include?(x.to_i)}\nend",
"def ip_valid?\n return if ip.blank?\n\n IPAddr.new(ip.strip, Socket::AF_INET)\n rescue IPAddr::InvalidAddressError, IPAddr::AddressFamilyError\n errors.add(:ip, :invalid)\n end",
"def allowHost(cidr)\n end",
"def private_ip_addresses\n addresses = []\n if network_interfaces.respond_to? :map\n addresses = network_interfaces.map { |nic| nic[:network_ip] }\n end\n addresses\n end",
"def old_ip_address?\n dns.any? do |answer|\n answer.class == Net::DNS::RR::A && LEGACY_IP_ADDRESSES.include?(answer.address.to_s)\n end if dns?\n end",
"def check_address(_)\n raise NotImplementedError\n end",
"def is_addr(s)\n s.match(/^[0-9a-fA-F]+:$/) != nil\nend",
"def is_private?\n ! is_public?\n end",
"def is_private?\n ! is_public?\n end",
"def authorize_ip_address(ip)\n authorize_cidrip(\"#{ip}/32\")\n end",
"def valid_ip?(str)\n return false unless str =~ /^\\d+(\\.\\d+){3}$/\n nums = str.split(\".\").map(&:to_i)\n nums.all? {|num| num >= 0 && num <= 255}\nend",
"def dot_separated_ip_address?(input_string)\n dot_separated_words = input_string.split(\".\")\n if dot_separated_words.size != 4\n return false\n else\n dot_separated_words.each do |word|\n if (0..256).include?(word.to_i)\n next\n else\n return false\n end\n end\n end\n return true\nend",
"def check_ip_any_alias\n case @options[:ipaddr]\n when nil, '', 'any', /^\\s*$/\n @options[:ipaddr] = '0.0.0.0'\n @options[:netmask] = 0\n end\n end",
"def valid?\n (internal_ip.nil? || name.nil?) ? false : true\n end",
"def valid_ip?(str)\n nums = str.split(\".\").map(&:to_i)\n return false if nums.size != 4\n nums.all? { |num| num >= 0 && num <= 255 }\nend",
"def accessible_from?(cidr)\n return false if public_cidr?(cidr) && !publicly_accessible?\n\n vpc_security_groups.each do |sg|\n security_group = AWS::EC2::SecurityGroup.new(sg, @ec2)\n return true if security_group.accessible_from?(cidr)\n end\n\n false\n end",
"def ip_well_formed?\n\t\tunless ip_address && ip_address =~ /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n\t\t\terrors.add(:ip_address, \"is malformed\")\n\t\t\treturn false\n\t\tend\n\t\t\n\t\toctets = [$1, $2, $3, $4]\n\n\t\toctets.each { |octet|\n\t\t\tunless octet.to_i <= 256 && octet.to_i >= 0\n\t\t\t errors.add(:ip_address, \"is malformed\")\n\t\t\t return false\n\t\t\tend\n\t\t}\n\t\ttrue\n\tend",
"def ip_is_valid(ip, mask)\n ip_parts = ip.split('.')\n mask_parts = mask.split('.')\n \n if mask_parts.length != 4\n SC.logger.fatal \"Invalid IP mask: #{mask}\\n\"\n exit\n end\n \n ip_idx = 0\n mask_parts.each {|mask_part|\n ip_part = ip_parts[ip_idx]\n \n # * means anything matches\n if mask_part == '*'\n next\n end\n \n if ip_part != mask_part\n return false\n end\n \n ip_idx = ip_idx + 1\n }\n \n return true\n end",
"def directly_reachable(target)\n number_of_interfaces_checked = 0\n @facts['interfaces'].split(',').each do |inf|\n if @facts[\"ipaddress_#{inf}\"] && @facts[\"netmask_#{inf}\"]\n number_of_interfaces_checked += 1\n infaddr = IPAddr.new(@facts[\"ipaddress_#{inf}\"] + '/' + @facts[\"netmask_#{inf}\"])\n return true if infaddr.include?(IPAddr.new(target))\n end\n end\n if number_of_interfaces_checked > 0\n return false\n else\n # If Facter failed for some reason and didn't send us any interface\n # data we don't want to have etch unconfigure/misconfigure the\n # networking on the client\n abort \"No interface addresses/netmasks received\"\n end\nend",
"def private?\n private == 'private'\n end",
"def valid_ip?(string)\n return false unless string =~ /\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}/\n\n string.split(\".\").each do |sub_str|\n if !sub_str.to_i.between?(0, 255)\n return false\n end\n end\n\n return true\nend",
"def valid_ip(ip)\n ip.split('.').map(&:to_i).select {|x| x.between?(0,255)}.count == 4\nend",
"def private?\n sensitivity == \"Private\"\n end",
"def loopback_address?(ip)\n NON_ROUTABLE_IP_RANGES.any? { |range| range.include?(ip) }\n end",
"def dot_separated_ip_address?(input_string)\n dot_separated_words = input_string.split(\".\")\n return false unless dot_separated_words.size == 4\n \n dot_separated_words.each do |word|\n return false unless (0..256).include?(word.to_i)\n end\n\n return true\nend",
"def an_ip_number?(element)\n element.to_i >= 0 && element.to_i <= 255\nend",
"def dot_separated_ip_address?(input_string)\n is_an_ip_number?(input_string.split(\".\"))\nend",
"def check_multipass_hostonly_network(options,if_name)\n gw_if_name = get_gw_if_name(options)\n check_nat(options,gw_if_name,if_name)\n return\nend",
"def ipv4_address?(n)\n arr = n.split('.')\n if arr.count != 4 ||\n !('1'..'255').include?(arr[0])\n return false\n end\n\n arr.each do |num|\n return false if !('1'..'255').include?(num)\n end\n true\nend",
"def ip_address? (str)\n\treturn str.match? /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/\nend",
"def valid_ip?(string)\n decimal_counter = 0\n range_counter = 0\n\n strArray = string.split('')\n strArray.each do |char|\n if char == '.'\n decimal_counter += 1\n end\n end\n\n numArray = string.split('.')\n numArray.each do |int|\n int = int.to_i\n if int >= 0 && int <= 255\n range_counter += 1\n else\n return\n end\n end\n\n if decimal_counter == 3 && range_counter == 4\n p \"true\"\n return true\n else\n p \"false\"\n return false\n end\nend",
"def ip_trusted? (ip)\n\t\tputs \"Check if the IP within the range of the known CIDR blocks: #{ip}\" if @verbose\n\t\tknown = false\n\t\treturn false if @known_cidr_blks==nil\n\t\tfirst_octet_ip = ip.split('.').first.to_i\n\t\t@known_cidr_blks_desc_index.each do |line|\n\t\t\tfirst_octet_blk = line.split('.').first.to_i\n\t\t\tnext if first_octet_blk > first_octet_ip\n\t\t\tputs \"line: #{line}\" if @verbose\n\t\t\tcidr4 = NetAddr::CIDR.create(line)\n\t\t\tknown = cidr4.contains?(ip+'/32')\n\t\t\tbreak if known\n\t\tend\n\t\treturn known\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn false\n\tend",
"def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact host \"#{ip}\")\n end\n\n reachable\n end",
"def permited_source?(ip)\n # get permitted subnet \n config = BeEF::Core::Configuration.instance\n permitted_ui_subnet = config.get('beef.restrictions.permitted_ui_subnet')\n target_network = IPAddr.new(permitted_ui_subnet)\n \n # test if ip within subnet\n return target_network.include?(ip)\n end",
"def has_ipv4_ip_address?\n self.options[:ip].is_a?(String) && self.options[:ip] =~ /\\A\\d+\\.\\d+\\.\\d+\\.\\d+/\n end",
"def is_restricted?(address)\n domain = Mail::Address.new(address).domain\n !domain.in?(NONDISPOSABLE_DOMAINS)\n rescue Mail::Field::IncompleteParseError\n true\n end",
"def host_in_range?(ip, ip_address_start, ip_address_end)\n ip >= ip_address_start && ip <= ip_address_end\n end",
"def validate_ip(value)\n case value\n when Resolv::IPv4::Regex\n return true\n when Resolv::IPv6::Regex\n return true\n else\n return false\n end\n end",
"def my_ipv4_info\n\tSocket.ip_address_list.find { |interface| interface.ipv4_private? }\nend",
"def is_ok ( addr )\n\tindex = addr - @base\n\treturn true if @map[index] == \"X\"\n\treturn true if @map[index] == \"I\"\n\treturn false\n end",
"def validate_ip(value)\n case value\n when Resolv::IPv4::Regex\n return true\n when Resolv::IPv6::Regex\n return true\n else\n return false\n end\n end",
"def valid_ip?(str)\n str_arr = str.split(\".\");\n return false if str_arr.length != 4\n\n str_arr.each do |el|\n return false unless el.match(/^\\d{0,3}$/) && el.to_i >= 0 && el.to_i <= 255\n end\n return true \nend",
"def ip?(ip_or_name)\n # Get address always returns an IP, so if nothing changes this was one\n Resolv.getaddress(ip_or_name) == ip_or_name\n rescue Resolv::ResolvError\n false\n end",
"def address_is_local?(address)\n Rails.configuration.local_addresses.any? { |spec| address_matches spec.strip.split('.'), address.strip.split('.') }\nend"
] |
[
"0.77885616",
"0.77885616",
"0.7283692",
"0.6809676",
"0.67911214",
"0.6775022",
"0.65426326",
"0.6536171",
"0.64874506",
"0.648404",
"0.63889843",
"0.6378189",
"0.63750863",
"0.6357704",
"0.6354815",
"0.6349172",
"0.6349172",
"0.632853",
"0.6323603",
"0.6319336",
"0.63138056",
"0.6299874",
"0.6299874",
"0.62716824",
"0.6268802",
"0.6258575",
"0.6241221",
"0.62248755",
"0.6204139",
"0.61981666",
"0.6175884",
"0.61732286",
"0.61576855",
"0.61143804",
"0.6089609",
"0.6077898",
"0.60654736",
"0.6058704",
"0.605661",
"0.60524166",
"0.6049941",
"0.6048146",
"0.6042509",
"0.60382795",
"0.60325146",
"0.6031474",
"0.6030283",
"0.60297704",
"0.6026541",
"0.60153234",
"0.59972405",
"0.59600353",
"0.5957795",
"0.59318894",
"0.5911371",
"0.58988506",
"0.58842736",
"0.5872615",
"0.5855576",
"0.5855279",
"0.5851707",
"0.5850761",
"0.584572",
"0.5840399",
"0.5840399",
"0.58389896",
"0.58325297",
"0.58316916",
"0.5831664",
"0.5830708",
"0.582683",
"0.5820473",
"0.5820059",
"0.58192885",
"0.58129495",
"0.58092093",
"0.5807079",
"0.5802762",
"0.5800119",
"0.5793813",
"0.5790268",
"0.57815456",
"0.57784426",
"0.57756984",
"0.5772294",
"0.577101",
"0.57591087",
"0.5758014",
"0.5754633",
"0.57511413",
"0.5749477",
"0.57402676",
"0.5735374",
"0.5735103",
"0.57350343",
"0.5734323",
"0.57221293",
"0.5719649",
"0.5710895",
"0.5691474"
] |
0.829832
|
0
|
Names orionvm ip address === Parameters type:: Use :public_ip or :private_ip
|
def get_ip_address(type)
network[:interfaces].each do |iface, info|
next unless info['type'] == 'eth'
info[:addresses].each do |addr, detail|
next unless detail['family'] == 'inet'
case type
when :public_ip
return addr if !is_private?(addr)
when :private_ip
return addr if is_private?(addr)
end
end
end
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def name\n ip_address\n end",
"def ip\n @ip ||= select { |type,value| type == :ip }.map do |(type,value)|\n IPAddr.new(value)\n end\n end",
"def name\n ip_address\n end",
"def aws_get_ip (method = :internal, type = :public)\n # allowed methods: :internal (check meta-data inside VM), :aws (ask API)\n # allowed types: :public, :private\n self.aws_describe_instance\n\n if method.equal?(:internal)\n key = type.equal?(:public) ? 'public-ipv4' : 'local-ipv4'\n murl = sprintf('http://169.254.169.254/latest/meta-data/%s', key)\n result = self.aws_get_url(murl)\n else\n key = type.equal?(:public) ? 'ipAddress' : 'privateIpAddress'\n result = @instance_data[key]\n end\n\n result\n end",
"def public_ip_v4_address; end",
"def public_ip() ; info[:public_ip] ; end",
"def show_like_ip\n return if table != 254\n\n str = \"\"\n if dst_len == 0\n str = \"default via #{extract_gateway_address_from_attrs} dev #{extract_oif_from_attrs}\"\n elsif dst_len == 32\n str = \"#{extract_dst_from_attrs} dev #{extract_oif_from_attrs}\"\n else\n end\n\n puts str unless str == \"\"\n end",
"def ipsource\n lanconfig[\"ip address source\"].downcase!\n end",
"def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ipaddr; end",
"def ip; end",
"def ip; end",
"def ip\n @vps.ip \n end",
"def private_ip_v4_address; end",
"def ip\n ''\n end",
"def ipaddr?; end",
"def arp_src_ip= i; typecast \"arp_src_ip\", i; end",
"def libvirt_vm_ip(name)\n mac = `sudo virsh domiflist #{name} | tail -n +3 | tr -s \" \" | cut -f 5 -d \" \"`.strip\n address = `arp | grep -i #{mac} | cut -f1 -d \" \"`.chomp\n { address: address, port: SSH_PORT }\n end",
"def address(public_ip)\n addresses(public_ip)[0]\n end",
"def public_ip\n # For AWS and OpenStack, the elastic IP is the public IP\n # For vSphere and vCloud, the static_ip is the public IP\n @spec['properties']['vip'] || static_ip\n end",
"def device_ipaddress; end",
"def device_ipaddress; end",
"def ip_v4_address; end",
"def ip_string\n\t\t\"#{settings.subnet}.#{settings.nodes_ip_offset + @ip}\"\n\tend",
"def local_ip\n\nend",
"def arp_dest_ip= i; typecast \"arp_dest_ip\", i; end",
"def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end",
"def checkip?(ip)\n if ip =~ %r=^172.|^192.168.|^10.$=\n return \"Private Class C IP Range\"\n elsif ip =~ %r=^127.$=\n return \"Local Loopback\"\n end\n end",
"def public_ip_address\n data[:public_ip_address]\n end",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end",
"def ip\n @data[\"ip\"]\n end",
"def ip\n @attributes[:ip]\n end",
"def ip\n @attributes[:ip]\n end",
"def device_ipaddress=(_arg0); end",
"def device_ipaddress=(_arg0); end",
"def get_ip(node)\n provisioning.ipaddress(node)\n end",
"def ip_address\n # Does not work for now as the vmx path is not escape correctly by fission 0.4.0\n #return raw.network_info.data.first['ip_address']\n raise ::Fission::Error,\"VM #{name} does not exist\" unless self.exists?\n \n # Use alternate method to retrieve the IP address using vmrun readVariable\n \n ip_address = shell_exec(\"vmrun readVariable \\\"#{vmx_file_path}\\\" guestVar ip\", { :mute => true})\n return ip_address.stdout.strip\n \n # unless mac_address.nil?\n # lease = Fission::Lease.find_by_mac_address(mac_address).data\n # return lease.ip_address unless lease.nil?\n # return nil\n # else\n # # No mac address was found for this machine so we can't calculate the ip-address\n # return nil\n # end\n end",
"def configure_private_network_ip(config, ip, vm_name)\n if ip\n config.vm.network :private_network, :ip => ip, :netmask => \"255.255.255.0\"\n else\n puts \" NO HOSTONLY IP defined for VM #{vm_name}.\"\n end\n end",
"def public_ip_address\n public_ip_addresses.first\n end",
"def ip\n self['ip'] = get_public_ip || get_ip\n end",
"def customize_vm(name,options)\n vm_config = \"\"\n options.each_pair do |key,value|\n case key\n when 'ip'\n vm_config << \" v.vm.network :private_network, :ip => '#{value}'\\n\"\n else\n next\n end\n end\n vm_config\n end",
"def customize_vm(name,options)\n vm_config = \"\"\n options.each_pair do |key,value|\n case key\n when 'ip'\n vm_config << \" v.vm.network :private_network, :ip => '#{value}'\\n\"\n else\n next\n end\n end\n vm_config\n end",
"def ip_address(env)\n ip_address_record(env)[:address]\n end",
"def virtualbox_vm_ip(name)\n mac_string = `VBoxManage showvminfo #{name} --machinereadable | grep Forwarding`\n data = mac_string.match(/.+=\"\\w+,tcp,,(\\d+),,22\"/)\n port = data[1].to_i\n { address: SSH_ADDRESS, port: port }\n end",
"def to_s\n @ip\n end",
"def getIp()\n return @ip\n\tend",
"def to_s\n @ip_string\n end",
"def kvm_ip(name)\n addr = ip_by_mac(node_mac(name))\n addr.empty? ? ip_by_mount(name) : addr\nend",
"def ip\n super\n end",
"def to_s\r\n @ip\r\n end",
"def ip\n @ip ||= @node.search('IP/listEntry').map(&:inner_text)\n end",
"def list_ip(containers) # rubocop:disable Metrics/AbcSize\n @options[:container] = containers\n container\n instance_data = list.body\n instance_data = JSON.parse(instance_data)\n vcableid = instance_data['vcable_id']\n abort('Error network configuration is not present') if vcableid.nil?\n internalip = instance_data['ip']\n iputil = IPUtil.new(id_domain, user, passwd, restendpoint)\n basecontainer = containers.split('/')\n usercontainer = '/' + basecontainer[1] + '/' + basecontainer[2] + '/' \n vcabledetails = JSON.parse(iputil.discover(usercontainer, 'vcable', vcableid, 'association').body)\n vcabledetails = vcabledetails['result']\n vcabledetails = vcabledetails.at(0)\n extipaddress = vcabledetails['ip']\n return internalip, extipaddress\n end",
"def ip(options=nil)\n known_args = [:Objectify, :Short]\n objectify = false\n short = false\n\n if (options)\n if (!options.kind_of?(Hash))\n raise ArgumentError, \"Expected Hash, but \" +\n \"#{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if( options.has_key?(:Short) && options[:Short] == true )\n short = true\n end\n\n if( options.has_key?(:Objectify) && options[:Objectify] == true )\n objectify = true\n end\n end\n\n\n if (!objectify)\n ip = NetAddr.ip_int_to_str(@ip, @version)\n ip = NetAddr.shorten(ip) if (short && @version == 6)\n else\n ip = NetAddr.cidr_build(@version,@ip)\n end\n\n return(ip)\n end",
"def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end",
"def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end",
"def show\n @ip_list = IPAddress(@network.network)\n @network_ips = @network.addresses\n end",
"def ip\n unless @vm\n warn 'No Vm assigned to locate IP'\n return\n end\n @ip ||= detect_ip\n end",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def ip(arg = nil)\n set_or_return(:ip,\n arg,\n kind_of: String,\n default: '127.0.0.1',\n callbacks: {\n 'An `ip` must be a valid IP address' =>\n ->(a) { a.nil? ? true : !IPAddr.new(a).nil? }\n })\n end",
"def ip(value)\n merge(bkip: value.to_s)\n end",
"def determine_public_ip\n # 169.254.169.254 is the address of the AWS instance metadata service\n # See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html\n `curl --silent -XGET http://169.254.169.254/latest/meta-data/public-ipv4`\n end",
"def to_s\n \"#{ip_address} [#{role}]\"\n end",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def public_ips\n filter_nics_and_return_ips {|nic| nic.internet_access == true }\n end",
"def check_ip; end",
"def private_ip_address\n private_ip_addresses.first\n end",
"def ipaddress\n @network_payload['IP']\n end",
"def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end",
"def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end",
"def ip_adress_params\n params[:ip_adress]\n end",
"def ip\n @values.fetch('ai.device.ip') { \n @values['ai.device.ip'] = nil\n }\n end",
"def remote_ip; end",
"def read_host_ip\n ip = read_machine_ip\n base_ip = ip.split(\".\")\n base_ip[3] = \"1\"\n base_ip.join(\".\")\n end",
"def ipmi_ip_string\n\t\t\"#{settings.ipmi['subnet']}.\" + @ipmi_ip.to_s\n\tend",
"def get_ip_address(name, eth)\n network[:interfaces][eth][:addresses].each do |key, info|\n rackspace[name] = key if info['family'] == 'inet'\n end\nend",
"def addresses network=nil\n if network\n data = on_network network\n ips = data.map { |v| (v.has_key? :ip) ? v[:ip] : nil }\n else\n vips.each_key.map { |k| vips[k][:ip] }\n end\n end",
"def ipaddress\n config[\"ipaddress\"]\n end",
"def ipaddress_params\n params.require(:ipaddress).permit(:ip_address,:ip,:interface,:virtualmachine_id)\n end",
"def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end",
"def set_ip_name\n @ip_name = IpName.find(params[:id])\n end",
"def read_machine_ip(machine)\n machine.config.vm.networks.each do |type, options|\n if type == :private_network && options[:ip].is_a?(String)\n return options[:ip]\n end\n end\n\n nil\n end",
"def global_vagrant_options\n ['ip']\n end",
"def ip\n nil\n end",
"def getIpFromNum(ii)\n \"172.31.0.#{100+ii}\"\nend",
"def my_ip\n get(\"/tools/myip\")\n end",
"def ip; get_data_in_file :ip end",
"def reverse_name_lookup(ip, type = :A)\n # look for all the zones\n type = type.to_sym if type.class != Symbol\n dns_name = String.new\n @dns.domains.each do |zone|\n @dns.domains.get(zone.id).records.each do | record |\n if record.data == ip and record.type.to_sym == type\n dns_name = record.name\n break\n end\n end\n end\n return dns_name\n end",
"def determine_ips\n ips = @info[:ip] = {private: [], public: []}\n\n ifc_cmd = \"/sbin/ifconfig|grep 'inet addr'|grep -v ':127'|sed -e \" \\\n \"'s/.*addr:\\([0-9.]*\\) .*/\\\\1/'\"\n ifconfig = @shell.query('IFCONFIG', ifc_cmd)\n\n ifconfig.each_line do |ip|\n ip.strip!\n ips[rfc1918?(ip)] << ip\n end\n end",
"def echo_ip(ip) echo(ip ? ip.to_s : nil, 16, '-- dynamic --') end",
"def to_s\n if to_wmasked_ip_s == '0.0.0.0'\n # ip = '0.0.0.0' or wildcard = '255.255.255.255'\n tag_ip('any')\n elsif @wildcard == '0.0.0.0'\n # /32 mask\n format '%<host>s %<ip>s', host: tag_mask('host'), ip: tag_ip(@ipaddr.ip)\n else\n format '%<ip>s %<mask>s', ip: tag_ip(to_wmasked_ip_s), mask: tag_mask(@wildcard)\n end\n end",
"def get_ip_address(name, eth)\n if eth_iface = network[:interfaces][eth]\n eth_iface[:addresses].each do |key, info|\n jpc2[name] = key if info['family'] == 'inet'\n end\n end\nend",
"def listIPs\n ips = []\n cloud_desc.network_interfaces.each { |iface|\n ips << iface.network_ip\n if iface.access_configs\n iface.access_configs.each { |acfg|\n ips << acfg.nat_ip if acfg.nat_ip\n }\n end\n }\n ips\n end",
"def get_nat_ip\n puts \"Getting NAT address\"\n\n # Get first instance with \"nat\" role\n instance = instances_for_role(\"nat\").first[:instances].first\n # Grab the interface that has source_dest_check set to false (most likely interface)\n primary = instance[:network_interfaces].select { |x| x[:source_dest_check] == false }.first\n nat = \"ec2-user@#{primary[:association][:public_ip]}\"\n\n puts \" - #{nat}\"\n nat\n end"
] |
[
"0.72197586",
"0.7196706",
"0.71419674",
"0.68927634",
"0.6867152",
"0.6786188",
"0.6781043",
"0.67267185",
"0.6722671",
"0.67162526",
"0.67162526",
"0.67162526",
"0.67162526",
"0.67162526",
"0.67162526",
"0.6716069",
"0.669638",
"0.669638",
"0.66857624",
"0.6661724",
"0.6647056",
"0.6574886",
"0.6572356",
"0.6537309",
"0.6530061",
"0.64897215",
"0.6454824",
"0.6454824",
"0.6436046",
"0.64222825",
"0.64205",
"0.64173687",
"0.640008",
"0.63914037",
"0.63785696",
"0.63612974",
"0.63587826",
"0.6354692",
"0.63493794",
"0.63493794",
"0.6341192",
"0.6341192",
"0.6334551",
"0.6330254",
"0.6314507",
"0.631072",
"0.6301034",
"0.63000166",
"0.63000166",
"0.62991476",
"0.62925434",
"0.6288067",
"0.628761",
"0.62811613",
"0.6269213",
"0.62627804",
"0.62624544",
"0.6261321",
"0.62554795",
"0.624319",
"0.6241818",
"0.6237907",
"0.6234616",
"0.62340045",
"0.62319124",
"0.62296754",
"0.6225724",
"0.62241393",
"0.62184834",
"0.6217535",
"0.6205604",
"0.6190135",
"0.61896414",
"0.6185203",
"0.61814654",
"0.6177529",
"0.617509",
"0.6173343",
"0.61722946",
"0.61688673",
"0.6160277",
"0.61566347",
"0.6143797",
"0.61419517",
"0.6130789",
"0.6129769",
"0.6122768",
"0.61216",
"0.6112637",
"0.6093799",
"0.60931647",
"0.60923105",
"0.60868204",
"0.60841393",
"0.6079752",
"0.6075901",
"0.6065447",
"0.6063631",
"0.6057958",
"0.6048955"
] |
0.697365
|
3
|
This object should contain: bibnumber, title, summary, cast, language, rating, note poster_url?
|
def initialize(bibnumber)
@bibnumber = bibnumber
load_marc_record
# get_poster_url if @title and whatever other fields we need to do the search
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def retrieve_bibtex\n\n @bibtex.key = self.accession_number\n @bibtex.title = self.title\n if self.bib_authors_list.length > 0\n @bibtex.author = self.bib_authors_list.join(' and ').chomp\n end\n @bibtex.year = self.publication_year.to_i\n\n # bibtex type\n _type = self.publication_type\n case _type\n when 'Academic Journal'\n @bibtex.type = :article\n @bibtex.journal = self.source_title\n if self.issue\n @bibtex.issue = self.issue\n end\n if self.volume\n @bibtex.number = self.volume\n end\n if self.page_start && self.page_count\n @bibtex.pages = self.page_start + '-' + (self.page_start.to_i + self.page_count.to_i-1).to_s\n end\n if self.bib_publication_month\n @bibtex.month = self.bib_publication_month.to_i\n end\n when 'Conference'\n @bibtex.type = :conference\n @bibtex.booktitle = self.source_title\n if self.issue\n @bibtex.issue = self.issue\n end\n if self.volume\n @bibtex.number = self.volume\n end\n if self.page_start && self.page_count\n @bibtex.pages = self.page_start + '-' + (self.page_start.to_i + self.page_count.to_i-1).to_s\n end\n if self.bib_publication_month\n @bibtex.month = self.bib_publication_month.to_i\n end\n if self.publisher_info\n @bibtex.publisher = self.publisher_info\n end\n if self.series\n @bibtex.series = self.series\n end\n when 'Book', 'eBook'\n @bibtex.type = :book\n if self.publisher_info\n @bibtex.publisher = self.publisher_info\n end\n if self.series\n @bibtex.series = self.series\n end\n if self.bib_publication_month\n @bibtex.month = self.bib_publication_month.to_i\n end\n if self.isbns\n @bibtex.isbn = self.isbns.first\n end\n else\n @bibtex.type = :other\n end\n @bibtex\n end",
"def get_document_details(doc)\n tmp_hash = {}\n tmp_hash[\"id\"] = doc[\"bibid\"]\n tmp_hash[\"location\"] = doc[\"location\"].present? ? doc[\"location\"] : \"\"\n tmp_hash[\"title\"] = doc[\"fulltitle_display\"].present? ? doc[\"fulltitle_display\"] : \"\"\n if doc[\"format\"].present?\n if doc[\"format\"][1].present? and doc[\"format\"][1] == \"Microform\"\n the_format = doc[\"format\"][1]\n else\n the_format = doc[\"format\"][0]\n end\n else\n the_format = \"\"\n end\n # oclc_id and isbn are used to get the images from googlebooks\n oclc_id = doc[\"oclc_id_display\"].present? ? doc[\"oclc_id_display\"][0] : \"\"\n isbn = doc[\"isbn_display\"].present? ? doc[\"isbn_display\"][0].split(\" \")[0] : \"\"\n tmp_hash[\"format\"] = the_format\n tmp_hash[\"pub_date\"] = doc[\"pub_date_display\"].present? ? doc[\"pub_date_display\"] : \"\"\n tmp_hash[\"publisher\"] = doc[\"publisher_display\"].present? ? doc[\"publisher_display\"] : \"\"\n tmp_hash[\"author\"] = doc[\"author_display\"].present? ? doc[\"author_display\"] : \"\"\n tmp_hash[\"availability\"] = doc[\"availability_json\"].present? ? doc[\"availability_json\"] : \"\"\n tmp_hash[\"locations\"] = doc[\"availability_json\"].present? ? process_locations(doc[\"availability_json\"]) : []\n tmp_hash[\"citation\"] = doc[\"cite_preescaped_display\"].present? ? doc[\"cite_preescaped_display\"] : \"\"\n tmp_hash[\"callnumber\"] = doc[\"callnum_display\"].present? ? doc[\"callnum_display\"] : \"\"\n # the difference between these next two: \"internal_class_label\" gets used in the data attribute\n # of some elements, while the \"display_class_label\" gets displayed in the UI and has the added\n # font awesomne html\n classification = doc[\"classification_display\"].present? ? doc[\"classification_display\"] : \"\"\n tmp_hash[\"internal_class_label\"] = build_class_label(classification)\n tmp_hash[\"display_class_label\"] = tmp_hash[\"internal_class_label\"].gsub(' : ','<i class=\"fa fa-caret-right class-caret\"></i>').html_safe\n # tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_isbn[0], oclc_isbn[1], the_format)\n tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_id, isbn, the_format)\n\n return tmp_hash\n end",
"def publication_info\n\n {:type => :content, :id => id}\n\n end",
"def data\n return @data if @data\n google_hash, data = to_hash, BookData.new\n\n data.creator = google_hash[:creator]\n data.date = google_hash[:date]\n data.description = google_hash[:description]\n data.format = google_hash[:format]\n data.id = google_hash[:id]\n data.identifier = google_hash[:identifier]\n data.language = google_hash[:language]\n data.publisher = google_hash[:publisher]\n\n if google_hash[:rating] && google_hash[:rating][:attributes]\n data.rating = google_hash[:rating][:attributes][:average].to_f\n data.rating_max = google_hash[:rating][:attributes][:max].to_f\n data.rating_min = google_hash[:rating][:attributes][:min].to_f\n end\n\n data.subject = google_hash[:subject].map { |s| s.split(/ [\\-\\/] /) }.flatten.map(&:strip).uniq.sort\n data.title = google_hash[:title].uniq.join(\" \")\n data.updated = google_hash[:updated]\n data.category = google_hash[:category]\n data.embeddability = google_hash[:embeddability][:value]\n data.open_access = google_hash[:openAccess][:value]\n data.viewability = google_hash[:viewability][:value]\n\n google_hash[:link].each do |link|\n href = link.is_a?(Hash) ? link[:attributes][:href] : link.last[:href]\n rel = link.is_a?(Hash) ? link[:attributes][:rel] : link.last[:rel]\n data.send(\"#{rel[/thumbnail|info|annotation|alternate|self/]}_url=\", href)\n end\n\n @data = data\n end",
"def load_marc_record\n @@sierra_api = SierraApi.new unless @@sierra_api\n\n marc_record = @@sierra_api.bibs(id: @bibnumber)\n\n relavent_tags = ['245', '500', '511', '520', '521', '546']\n\n tags = {}\n marc_record.each do |i|\n tag = i['tag']\n if relavent_tags.include?(tag)\n tags[tag] = {} unless tags.key?(tag)\n\n i['data']['subfields'].each do |j|\n code = j['code']\n if tags[tag].key?(code)\n tags[tag][code] << ' ' + j['data']\n else\n tags[tag][code] = j['data']\n end\n end\n end\n end\n #pp tags\n\n # Extract fields.\n @title = tags['245']['a'].gsub(' /', '') if defined?(tags['245']['a'])\n @summary = tags['520']['a'] if defined?(tags['520']['a'])\n @cast = tags['511']['a'] if defined?(tags['511']['a'])\n @language = tags['546']['a'] if defined?(tags['546']['a'])\n @rating = tags['521']['a'] if defined?(tags['521']['a'])\n\n if tags.key?('500')\n note = tags['500'].values.join(' ')\n if match = /\\d{4}/.match(note)\n @year = match[0] if match.length == 1\n end\n end\n\n end",
"def display_book_attributes\n [@title, @type, @author, @price]\n end",
"def parse_item(item) \n @book = JSON(item.body)[\"data\"].first \t\n \n # @book = Hashie::Mash.new book_data\n @book_id = @book['book_id']\n @title = @book['title']\n @authors = @book['author_data'] || []\n @publisher = @book['publisher_name']\n @published_date = extract_date @book['edition_info'] if @book['edition_info'].present?\n @description = @book['summary']\n @isbn = @book['isbn13']\n @isbn10 = @book['isbn10']\n @dewey = @book['dewey_decimal']\n @page_count = extract_page_count @book['physical_description_text'] if @book['physical_description_text'].present?\n @notes = @book['notes']\n @edition_info = @book['edition_info']\n @physical_description = @book['physical_description_text']\n @subject_ids = @book['subject_ids'] || []\n @language = @book['language']\n end",
"def item_format(_bib)\n 'article'\n end",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end",
"def fetch_metadata\n self.title ||= biblio_commons.title\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n self.format ||= biblio_commons.format\n end",
"def to_object\n doc = {}\n\n doc['isbn'] = record_to_array('020.a')\n doc['issn'] = record_to_array('022.b')\n doc['author'] = record_to_array('100.a')\n doc['edition'] = record_to_array('250.a')\n doc['scale'] = record_to_array('255.a')\n doc['num_pages'] = record_to_array('300.a')\n doc['cite_as'] = record_to_array('524.a')\n doc['add_entry'] = record_to_array('700.a')\n doc['url'] = record_to_array('856.u')\n\n # Publisher, title, series could have multiple fields\n # So just join the arrays together\n\n doc['pub_place'] = record_to_array('260.a') +\n record_to_array('264.a')\n doc['publisher'] = record_to_array('260.b') +\n record_to_array('264.b')\n doc['pub_date'] = record_to_array('260.c') +\n record_to_array('264.c')\n doc['title'] = record_to_array('245.a') +\n record_to_array('245.b')\n doc['series'] = record_to_array('440.a') +\n record_to_array('490.a')\n\n doc\n end",
"def load_from_record(api_object)\n record = api_object.at_xpath(\"api:records/api:record[@format='native']/api:native\")\n\n unless record \n raise ArgumentError,\n \"Object given did not contain the nodes expected of a publication record.\"\n end\n \n xpath_queries = {\n doc_type: \"../../../@type\",\n id: \"../../../@id\",\n publisher: \"api:field[@name='publisher']/api:text\",\n title: \"api:field[@name='title']/api:text\",\n volume: \"api:field[@name='volume']/api:text\",\n abstract: \"api:field[@name='abstract']/api:text\",\n issue: \"api:field[@name='issue']/api:text\",\n page_start: \"api:field[@name='pagination']/api:pagination/api:begin-page\",\n page_end: \"api:field[@name='pagination']/api:pagination/api:end-page\",\n pages: \"api:field[@name='pagination']/api:pagination/api:page-count\",\n number: \"api:field[@name='number']/api:text\",\n doi: \"api:field[@name='doi']/api:links/api:link[@type='doi']/@href\",\n journal: \"api:field[@name='journal']/api:text\",\n\n }\n\n # Loop through all the xpath queries.\n xpath_queries.each do |field, xpath|\n if element = record.at_xpath(xpath)\n send(\"#{field}=\", element.text)\n end\n end\n\n extract_author_list(record.at_xpath(\"api:field[@name='authors']\"))\n extract_date(record.at_xpath(\"api:field[@name='publication-date']\"))\n extract_subject(record.at_xpath(\"api:field[@name='keywords']\"))\n end",
"def attributes\n hash = {\n \"author\" => @author,\n \"title\" => @title,\n \"summary\" => @summary,\n \"images\" => @images,\n \"source\" => @source,\n \"date\" => @date\n }\n end",
"def initialize(uri = nil, factory = nil, json: nil, ld: nil)\n uri = json ? json['uri'] : nil if uri.nil?\n super(uri, factory)\n if json\n has_part = json['hasPart']\n is_part_of = json['isPartOf']\n self.authors = get_property('authors', json, single: false)\n self.book_jacket_url = get_property('bookjacketURL', json)\n self.date = get_property('date', json)\n self.doi = get_property('doi', json)\n self.edition = get_property('edition', json)\n self.edition_data = get_property('editionData', json)\n self.eissn = get_property('eissn', json)\n self.has_part = has_part ? factory.get(uri, json: has_part) : nil\n self.is_part_of = is_part_of ? factory.get(uri, json: is_part_of) : nil\n self.isbn10 = get_property('isbn10', json)\n self.isbn13 = get_property('isbn13', json)\n self.isbns = get_property('isbns', json, single: false)\n self.issn = get_property('issn', json)\n self.issue = get_property('issue', json)\n self.issued = json ? json['issued'] : nil # TODO\n self.latest_edition = get_property('latestEdition', json)\n self.local_control_number = get_property('lcn', json)\n self.online_resource = get_property('onlineResource', json) ? true : false\n self.page = get_property('page', json)\n self.page_end = get_property('pageEnd', json)\n self.page_start = get_property('pageStart', json)\n self.place_of_publication = get_property('placeOfPublication', json)\n self.publisher = get_property('publisher', json)\n self.title = get_property('title', json)\n self.type = get_property('type', json)\n self.url = get_property('url', json, is_url: true)\n self.volume = get_property('volume', json)\n end\n end",
"def getTitle(book)\n book['volumeInfo']['title']\nend",
"def initialize(parsed_values)\n self.title = parsed_values[:title]\n self.author = parsed_values[:author]\n self.subject = parsed_values[:subject]\n self.publisher = parsed_values[:publisher]\n self.cover = parsed_values[:cover]\n self.synopsis = parsed_values[:synopsis]\n self.isbn = parsed_values[:isbn]\n self.other_isbn = parsed_values[:other_isbn]\n self.isbn10 = parsed_values[:isbn10]\n self.gtin = parsed_values[:gtin]\n self.upc = parsed_values[:upc]\n self.lang = parsed_values[:language]\n self.country = parsed_values[:country]\n self.xml = parsed_values[:xml]\n self.prices = process_prices(parsed_values[:prices])\n self.excerpt = parsed_values[:excerpt]\n self.cover_url = parsed_values[:cover_url]\n self.other_ids = parsed_values[:other_ids]\n self.available = parsed_values[:available]\n self.released_at = parsed_values[:released_at]\n self.publishing_status = parsed_values[:publishing_status]\n self.sales_rights = parsed_values[:sales_rights]\n self.format = parsed_values[:format]\n end",
"def add_link\n @bib.link.each do |l|\n case l.type&.downcase\n when \"doi\" then @item.doi = l.content\n when \"file\" then @item.file2 = l.content\n when \"src\" then @item.url = l.content\n end\n end\n end",
"def bib\n self.response = self.class.get(\"#{record_url}?view=full\")\n raise_error_if(\"Error getting bib from Aleph REST APIs.\") {\n (response.parsed_response[\"get_record\"].nil? or response.parsed_response[\"get_record\"][\"record\"].nil?)\n }\n MARC::XMLReader.new(StringIO.new(xml(xml: response.body).at_xpath(\"get-record/record\").to_xml(xml_options).strip)).first\n end",
"def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end",
"def simple_attributes\n [:creator, :subject, :spatial, :temporal,\n :title, :provenance, :language, :publisher]\n end",
"def initialize\n self.title = nil\n self.url = nil\n self.comments_url = nil\n self.created_at = nil\n self.author = nil\n self.categories = []\n self.content = nil\n self.medias = []\n end",
"def initialize(title, author, isbn)\n @title = title\n @author = author\n @isbn = isbn\nend",
"def initialize(title, author, desc, year, edition, num_copies)\n @title = title\n @author = author\n @desc = desc\n @year = year\n @num_copies = num_copies\n @year = year\n @edition = edition\n\n @num_copies = num_copies\n @num_in = @num_copies\n @num_out = 0\n @borrowed_by = []\n @reviews = []\n @ratings = []\n @future_check_out = {}\n end",
"def test_book_getter\n\n assert_equal([{title: \"Lord Of The Rings\",\n rental_details: {\n student_name: \"Richard\",\n date: \"01/12/16\"}},\n {title: \"His Dark Materials\",\n rental_details: {\n student_name: \"Campbell\",\n date: \"01/12/17\"}},\n {title: \"Fahrenheit 451\",\n rental_details: {\n student_name: \"Craig\",\n date: \"01/12/18\"}}], Library.new(@library_setup).books) #The full, proper way to create a class instance, then to use a getter to pull the data. compiled_library used from now on for ease.\n end",
"def bibliography_item_params\n params.require(:bibliography_item).permit(:titel, :author, :source, :accessed)\n end",
"def initialize(title, author, isbn)\n @title = title\n @author = author\n @isbn = isbn\n end",
"def initialize(title,author,isbn)\n @title = title\n @author = author\n @isbn = isbn.to_i\n# @borrow = false\n end",
"def test_gets_books__A\n\n new_library = [{\n title: \"lord_of_the_rings\",\n rental_details: {\n student_name: \"Jeff\",\n date: \"01/12/16\"\n }\n },\n {\n title: \"animal_farm\",\n rental_details: {\n student_name: \"Bob\",\n date: \"05/11/15\"\n }\n },\n {\n title: \"life_of_pi\",\n rental_details: {\n student_name: \"Fred\",\n date: \"25/12/17\"\n }\n }\n ]\n\n assert_equal(new_library, @library1.books)\n\n end",
"def initialize(title, author,year=\"unknown\", edition=\"unknown\")\n @title = title\n @author = author\n @checked_out = false\n @current_patron = nil\n @year_published = year\n @edition = edition\n @reviews = {}\n end",
"def render_book(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n if p.editors.size > 0 then\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editors, \"\n end\n end\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then\n r += text_for_field(\"Volume\", p, :prefix => \", volume \")\n r += text_for_field(\"Series\", p, :prefix => \" of \")\n elsif field(p,\"Number\") then\n r += text_for_field(\"Number\", p, :prefix => \". Number \")\n r += text_for_field(\"Series\", p, :prefix => \" in \")\n elsif field(p,\"Series\") then\n r += text_for_field(\"Series\", p, :prefix => \". \")\n end\n r += \". \"\n\n r += text_for_field(\"Publisher\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n r += text_for_field(\"Edition\", p, :postfix => \" edition, \").titlecase.detex\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\n\nend",
"def test_book_info__book_in_library\n @library = Library.new(@books_array)\n book_details = @library.book_info(\"lord_of_the_dance\")\n\n expected = {\n title: \"lord_of_the_dance\",\n rental_details: {\n student_name: \"Jack\",\n date: \"21/12/17\"\n }\n }\n\n assert_equal(expected, book_details)\n\n end",
"def description; @doc['description']; end",
"def description; @doc['description']; end",
"def bibo_records\n @bibo_records ||= dois.map do |doi_info|\n record_base = {\n :doi => doi_info[:doi],\n :display_doi => doi_info[:display_doi],\n :type => doi_info[:type],\n :random_index => rand\n }\n\n contributors = contributors doi_info[:parent]\n record_base[:contributors] = contributors if not contributors.nil?\n\n published = published doi_info[:parent]\n record_base[:published] = published if not published.nil?\n\n title_node = doi_info[:parent].at_css(\"title\", @@ns)\n record_base[:title] = title_node.text if not title_node.nil?\n\n if doi_info[:type] == \"journal_article\" ||\n doi_info[:type] == \"conference_paper\"\n journal_node = doi_info[:parent].parent\n record_base[:journal] = journal(journal_node)\n\n conj_issue(record_base, journal_node)\n conj_volume(record_base, journal_node)\n end\n\n record_base\n end\n end",
"def initialize(title:, author:, release_date:, publisher:, isbn:)\n @title = title\n @author = author\n @release_date = release_date\n @publisher = publisher\n @isbn = isbn\n end",
"def doi_metadata\n # This must be mock_doi rather than any identifier defined in the object.\n # Otherwise users could manually specify a different identifier and\n # change records they're not supposed to.\n data = {:identifier => mock_doi}\n \n data[:alternate_identifier] = identifier.map do |identifier|\n next if identifier == full_mock_doi\n guess_identifier_type(identifier)\n end .compact\n\n if respond_to? :doi_published and doi_published\n data[:publication_year] = \"#{doi_published.year}\"\n else\n data[:publication_year] = \"#{Time.new.year}\"\n end\n\n data[:subject] =\n (subject.to_a.map do |e|\n { scheme:'FAST', schemeURI: 'http://fast.oclc.org/', label: e }\n end) +\n (tag.to_a.map do |e|\n { scheme: nil, schemeURI: nil, label: e}\n end)\n\n creator_role=Sufia.config.contributor_roles['Creator']\n data[:creator] = ((contributors_sorted.select do |c|\n c.role.include? creator_role\n end).select do |c|\n !c.marked_for_destruction?\n end).map do |c|\n { name: c.contributor_name.first,\n affiliation: c.affiliation\n }\n end\n\n data[:abstract] = abstract.to_a\n data[:research_methods] = research_methods.to_a\n data[:description] = description.to_a\n data[:funder] = funder.to_a\n data[:contributor] = contributors_sorted.reduce([]) do |a,c|\n # Creator role is converted to nil in contributor_role_to_datacite and then removed with compact\n next a if c.marked_for_destruction?\n roles=c.role.map do |r| contributor_role_to_datacite r end\n roles.compact!\n next a if roles.empty?\n roles.sort! # Roles must be sorted, otherwise authors might change arbitrarily\n roles.each do |r|\n a << {\n name: c.contributor_name.first,\n affiliation: c.affiliation,\n contributor_type: r\n }\n end\n a\n end\n\n\n data[:relatedIdentifier] = related_url.map do |url|\n # related field is now titled cited by, so use that as the relation type\n (guess_identifier_type url).tap do |ident| ident[:relation_type]='IsCitedBy' end\n end\n\n if self.class == GenericFile\n data[:title] = title\n data[:resource_type] = Sufia.config.resource_types_to_datacite[resource_type.first] # Only maping first choice from the list\n data[:size] = [content.size]\n data[:format] = [content.mime_type]\n data[:date_uploaded] = date_uploaded.strftime('%Y-%m-%d')\n data[:rights] = rights.map do |frights|\n {rights: Sufia.config.cc_licenses_reverse[frights], rightsURI: frights}\n end\n else #Add Collection metadata\n data[:title] = [title] # Collection returns string, XML builder expects array\n # FixMe: construct << {contributor, email}\n if not date_created.empty?\n data[:date_created] = Date.parse(date_created.first.to_s).strftime('%Y-%m-%d') unless date_created.empty?\n end\n data[:resource_type] = Sufia.config.resource_types_to_datacite['Collection']\n\n #Add members metadata\n# \t\t\tdata[:rights] = rights.map do |crights|\n# \t\t\t\t{rights: \"Collection rights - \" + Sufia.config.cc_licenses_reverse[crights], rightsURI: crights }\n# \t\t\tend\n# members.reduce(data[:rights]) do |a,mobj|\n data[:rights] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.rights.any?\n a << { # Do we allow for multiple licensing?\n rights: filename + \" - \" + Sufia.config.cc_licenses_reverse[mobj.rights[0]],\n rightsURI: mobj.rights[0]\n }\n else\n a\n end\n else\n a\n end\n end\n\n data[:format] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.content.mime_type.nil? then a end\n a << (filename + \" - \" + mobj.content.mime_type)\n else\n a\n end\n end\n\n data[:size] = members.reduce([]) do |a,mobj|\n if member_visible? mobj\n if mobj.content.original_name.nil? then filename = mobj.id else filename = mobj.content.original_name end\n if mobj.content.size then a end\n a << \"#{filename} - #{mobj.content.size}\"# Should we preatyfier file size in bytes?\n else\n a\n end\n end\n\n\n members.reduce(data[:relatedIdentifier]) do |a,mobj|\n if member_visible? mobj and mobj.respond_to? :doi_landing_page #FixMe: only public objects\n a << { id: mobj.doi_landing_page, id_type: 'URL', relation_type: 'HasPart' }\n else\n a\n end\n end\n end\n return data\n end",
"def build_preview_attrs preview_info\n itemdata = fetch_itemdata_info preview_info\n if itemdata.is_a?(Hash) && itemdata['docid'].present?\n fields = [\n :detail_background,\n :app_gift_title,\n :score_count,\n :all_download,\n :score,\n :popularity,\n :ishot,\n :official_icon_url\n ]\n itemdata.keep_if{|k| fields.include?(k.to_sym) }\n else\n {}\n end\n end",
"def author; @author; end",
"def author; @author; end",
"def citeproc_item\n item = CiteProc::Item.new(id: @doc.uid, type: 'article-journal')\n\n unless @doc.authors.empty?\n item.author = CiteProc::Names.new\n @doc.authors.each do |a|\n item.author << CiteProc::Name.new(a.citeproc)\n end\n end\n\n item.title = @doc.title if @doc.title\n item.container_title = @doc.journal if @doc.journal\n item.issued = CiteProc::Date.new(Integer(@doc.year)) if @doc.year\n item.volume = @doc.volume if @doc.volume\n item.issue = @doc.number if @doc.number\n item.page = @doc.pages if @doc.pages\n\n item\n end",
"def search_attributes\n {:title => self.name, :description => self.bio.present? ? self.bio[0..100] : \"\", :image => self.portrait(:thumb)}\n end",
"def books \n @books\n end",
"def remarks\n self.dig_for_array(\"remarks\")\n end",
"def bib_title\n @bib_entity.fetch('Titles', {}).find{|item| item['Type'] == 'main'}['TitleFull']\n end",
"def create\n # @book = Book.new(book_params)\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 action: 'show', 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\n\n\n @isbn = params[:book][:ISBN]\n search_term = params[:search] || \"#{@isbn}\"\n @res = Amazon::Ecs.item_lookup(search_term, { :search_index => 'Books', :id_type => \"ISBN\", :response_group => \"ItemAttributes\"})\n @imgs = Amazon::Ecs.item_lookup(search_term, { :search_index => 'Books', :id_type => \"ISBN\", :response_group => 'Images',\n :search_index => 'Books',\n :sort => 'relevancerank' })\n puts @imgs.items.first.get_element('MediumImage').get('URL')\n # need to save author, title, publisher of first returned item\n @new_book = @res.items.first\n @book = Book.new\n @book.title = @res.items.first.get_element('ItemAttributes').get('Title')\n @book.author = @res.items.first.get_element('ItemAttributes').get('Author')\n @book.publisher = @res.items.first.get_element('ItemAttributes').get('Publisher')\n @book.url = @imgs.items.first.get_element('MediumImage').get('URL')\n @book.save\n\n\n end",
"def rent_details(books) #passed\n details_collect = []\n for rentals in books[:rental_details]\n details_collect.push(rentals)\n end\n end",
"def initialize(attributes)\n @score = attributes['score']\n @name = attributes['name']\n @title = attributes['title']\n @comment_count = attributes['num_comments']\n @ups = attributes['ups']\n @downs = attributes['downs']\n @url = attributes['url']\n @domain = attributes['domain']\n @author = User.new(attributes['author']) unless attributes['author'].nil?\n @id = attributes['id']\n # Reddit's created_at timestamps are currently wonky, so this will return the wrong time.\n @created_at = Time.at(attributes['created']) unless attributes['created'].nil?\n @saved = attributes['saved']\n @clicked = attributes['clicked']\n @hidden = attributes['hidden']\n @selftext = attributes['selftext']\n @selftext_html = attributes['selftext_html']\n end",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def get_title(book)\n book[\"volumeInfo\"][\"title\"]\nend",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def get_movie_bio(id)\n doc = Nokogiri::HTML(open(IMDB_URL + \"/title/\" + id))\n title = doc.css(\"h1.header\").text.split(\"\\n\").delete_if {|x| x==\"\"}.first\n bio = doc.css(\"#maindetails_center_bottom\").css(\".article p\").text\n image_link = doc.css(\"#img_primary img\").first.attributes[\"src\"].value if doc.css(\"#img_primary img\").first\n cast = get_cast(doc.css(\"table.cast_list td.name\"))\n\n {:title => title, :bio => bio, :image_link => image_link, :cast => cast}\n end",
"def book_title\n @book_title\n end",
"def create\n @book = Book.new(book_params)\n\n # 書籍情報を取得\n get_info\n\n if @res.present? && !@res.has_error? && @res.total_results != 0\n @book.isbn = @res.first_item.get('ItemAttributes/ISBN')\n @book.asin = @res.first_item.get('ASIN')\n @book.title = @res.first_item.get('ItemAttributes/Title')\n @book.publisher = @res.first_item.get('ItemAttributes/Manufacturer')\n @book.author = @res.first_item.get('ItemAttributes/Author')\n @book.description = @res.first_item.get('EditorialReviews/EditorialReview/Content')\n @book.image = @res.first_item.get('MediumImage/URL')\n @book.publish_date = @res.first_item.get('ItemAttributes/PublicationDate')\n @book.number_of_pages = @res.first_item.get('ItemAttributes/NumberOfPages')\n @book.price = @res.first_item.get('ItemAttributes/ListPrice/Amount')\n\n # 取得したISBNが登録されてない場合のみ、取得した書籍を登録する\n @find_book = Book.find_by(isbn: @book.isbn)\n if @find_book.nil?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: @book.title + ' を新規登録しました。' }\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 else\n respond_to do |format|\n format.html { redirect_to @find_book, notice: @book.title + ' は既に登録されています。' }\n format.json { render :show, status: :created, location: @find_book }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to books_url, notice: '本が見つかりませんでした。' }\n format.json { head :no_content }\n end\n end\n end",
"def author_hash; end",
"def additional_information_list\n self.additional_information.map{ |ai| { title: ai.title, url: ai.url } } rescue []\n end",
"def fetch_metadata\n self.user_id ||= biblio_commons.user_id\n self.title ||= biblio_commons.name\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n end",
"def bibs\n bibs = self.items.map {|item| item.about}\n \n # Create a Hash in which the keys are the display position and the values are the corresponding Bib objects\n indexed_bibs = bibs.reduce(Hash.new) {|sorted_bibs, bib| sorted_bibs[bib.display_position] = bib; sorted_bibs}\n \n # Convert the Hash form into an Array sorted by the display position\n sorted_bibs = indexed_bibs.keys.sort.reduce(Array.new) {|sorted_bibs, position| sorted_bibs << indexed_bibs[position]}\n \n sorted_bibs\n end",
"def journal_title_fields\n []\n end",
"def create_bibtex(document)\n bibtex = '@book{resource, '\n if document.has? 'author_display'\n bibtex.concat('author = {' + document['author_display'].gsub(/[0-9\\-]/, '') + '},')\n end\n bibtex.concat('title = {' + document['title_display'] + '}')\n if document.has? 'pub_date'\n bibtex.concat(', year = ' + document['pub_date'][0])\n end\n if document.has? 'publisher_display'\n if document['publisher_display'].is_a?(Array)\n bibtex.concat(', publisher = {' + document['publisher_display'][0] + '}')\n else\n bibtex.concat(', publisher = ' + document['publisher_display'].to_s + '}')\n end\n end\n bibtex.concat('}')\n return bibtex\n end",
"def titles\n [ { :number => 8, :title => 'Corporations', :ref_url => 'http://delcode.delaware.gov/title8/index.shtml' } ]\nend",
"def initialize(title, author, isbn, available)\n @title = title\n @author = author\n @isbn = isbn\n @available = available\n end",
"def publication_place\n end",
"def fetch_title_marvel(publisher, title, url, date = nil) \n log(\"retrieving title information for [#{title}]\", :debug)\n doc = Hpricot(open(url))\n \n display_description = (doc/\"font[@class=plain_text]\").innerHTML\n\n title = RubyPants.new(title, -1).to_html\n display_name, display_number = title.split('#')\n display_name = check_title(display_name)\n display_number = display_number.split(' ')[0] unless display_number.nil?\n \n new_record = false\n \n if display_number.nil?\n # SoloBook\n model = SoloBook.find_by_name(display_name)\n \n if model.nil?\n model = SoloBook.new(:name => display_name, \n :publisher => publisher)\n new_record = true\n end\n \n else\n # Episode\n series = Series.find_by_name(display_name)\n \n if series.nil?\n # Series doesn't exist, create new Series\n series = Series.create!(:name => display_name, \n :publisher => publisher)\n log(\"created new series [#{display_name}]\", :info)\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n # Add episode to existing series\n if series.find_episode(display_number).nil?\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n model = series.find_episode(display_number)\n end\n end\n end\n \n display_talent, display_description = display_description.split(\"<strong>THE STORY:</strong>\")\n display_description ||= \"\" # if description was empty make sure it's non-nil\n display_description = display_description.split(\"<strong>PRICE:</strong>\")[0]\n \n model.talent = html2text(display_talent).strip.titleize\n model.description = html2text(display_description).strip\n model.published_on = date\n \n model.save!\n new_record ? log(\"created new book [#{title}]\", :info) : log(\"updated existing book [#{title}]\", :debug)\n \n if model.cover_image.nil?\n # get cover image (if we don't have one already)\n image_element = (doc/\"img\").select { |elem| elem.attributes['src'].match(/thumb/) }\n image_url = nil\n \n unless image_element.empty?\n image_url = image_element[0].attributes['src']\n image_url = \"#{URL_Marvel}#{image_element[0].attributes['src'].gsub('_thumb', '_full')}\" # full size art\n end\n \n get_cover_image(model, image_url)\n end\n \n rescue ActiveRecord::RecordInvalid => e\n log(\"failed to create book [#{title}]\", :info)\n log(\"errors: #{model.errors.full_messages.join(', ')}\", :info)\n return false\n end",
"def authors\n bib_authors || get_item_data_by_name('Author')\n end",
"def author; end",
"def initialize(title:, author:, release_date:, publisher:, isbn:)\n @title = title\n @author = author\n @release_date = release_date\n @publisher = publisher\n @isbn = isbn\n \n @errors = []\n end",
"def initialize(attributes)\n @name = attributes.fetch(:name)\n @id = attributes.fetch(:id)\n @release_year = attributes.fetch(:release_year).to_i\n @genre = attributes.fetch(:genre)\n @artist = attributes.fetch(:artist).gsub(\"'\", \"''\")\n end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def publication_year\n end",
"def initialize(title, movie_link, average_age=0, cast_list=[])\n @title = title\n @movie_link = movie_link\n @average_age = average_age\n @cast_list = cast_list\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 set_attributes\n # (needed) set title\n if @data['title'] then\n @title = @data['title']\n else\n raise \"This post (#{@id}) miss a title\"\n end\n # (needed) set author\n if @data['author'] then\n @author_name = @data['author']\n elsif @infos[:author_name]\n @author_name = @infos[:author_name]\n else\n @author_name = 'unknown'\n end\n if @data['email'] then\n @author_email = @data['email']\n else\n @author_email = @infos[:author_email]\n end\n # (needed) set published, if found nowhere, use filename date\n if @data['published'] then\n @published = Time.at(@data['published'])\n elsif @infos[:published]\n @published = @infos[:published]\n else\n @published = Time.mktime(@year, @month, @day)\n end\n # (optional) set last modification date\n @last_modified = @infos[:last_modified] if @infos[:last_modified]\n # (optional) set last modification author name\n @last_author_name = @infos[:last_author_name] if @infos[:last_author_name]\n # (optional) set last modification author email\n @last_author_email = @infos[:last_author_email] if @infos[:last_author_email]\n end",
"def reader\n @title \n end",
"def initialize(results_record)\n\n if results_record.key? 'Record'\n @record = results_record['Record'] # single record returned by retrieve api\n else\n @record = results_record # set of records returned by search api\n end\n\n @items = @record.fetch('Items', {})\n\n @bib_entity = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibEntity', {})\n\n @bib_relationships = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibRelationships', {})\n\n @bib_part = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibRelationships', {})\n .fetch('IsPartOfRelationships', {})[0]\n\n @bibtex = BibTeX::Entry.new\n end",
"def isbn\n @isbn\n end",
"def isbn\n @isbn\n end",
"def test_rental_details_for_title\n rental_details = @library1.rental_details_for_title(\"lord_of_the_rings\")\n assert_equal({student_name: \"Jeff\", date: \"25/05/19\"}, rental_details)\n end",
"def initialize\n self.title = nil\n self.url = nil\n self.description = nil\n self.updated_at = nil\n self.entries = []\n end",
"def publication_params\n params.require(:publication).permit(:title, :author, :abstract, :rating, :google_url, :journal)\n end",
"def create\n\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t@book = Book.new(book_params)\n\n#\t\tputs book.title\n#\t\tputs book.description\n#\t\tputs book.work.original_title\n#\t\tputs book.num_pages\n#\t\tputs book.authors.author.name\n#\t\tputs book.publisher\n\n\t\t@book.titlelong = book.title\n\t\t@book.description = strip_tags(book.description)\n\t\tputs @book.description#.gsub(/<br\\s*\\?>/, '')\n\t\t@book.title = book.work.original_title\n\t\t@book.pages = book.num_pages\n\t\t@book.bookrating = book.average_rating\n\t\t@book.author = book.authors.author.name\n\t\t@book.publisher = book.publisher\n\n\t\t#book.search(\"9780545790352\", 5)\n\t\t#puts book.books.first.get_title\n\t\t#@show = Show.new(show_params)\n\t\t#@show.title = result[\"original_name\"]\n\t\t#@show.description = result[\"overview\"]\n\t\t#@show.seasons = result[\"number_of_seasons\"]\n\t\t#@show.episodes = result[\"number_of_episodes\"]\n\t\t#@show.episoderuntime = result[\"episode_run_time\"].dig(0)\n\t\t#@show.showrating = result[\"vote_average\"]\n\t\t#@show.airdate = result[\"first_air_date\"]\n\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 :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 attributes\r\n hash = super\r\n hash.delete('author')\r\n hash.delete('images')\r\n hash[\"document_type\"] = document_type\r\n hash[\"section_name\"] = section_name\r\n hash\r\n end",
"def details\n @details ||= Tmdb::Collection.detail(@id)\n return @details\n end",
"def build_content_metadata record, tags\n # TODO: Further enrich the structured data by marking up FAQ accordions, Video Carousels, Image Galleries, etc.\n # Also ItemList metadata for the meditations archive\n # See here: https://developers.google.com/search/docs/data-types/article\n []\n end",
"def serialize!\n\t\t\t@namespaces=raw_doc.root.namespaces if @namespaces.nil?\n\t\t\t@authors=[]\n\t\t\t@raw_doc=raw_doc.at('./xmlns:entry',@namespaces) if raw_doc.at('./xmlns:entry',@namespaces)\n\t\t\t@title=text(raw_doc.at('./xmlns:title',@namespaces))\n\t\t\t@id=text(raw_doc.at('./xmlns:id',@namespaces))\n\t\t\t@summary=text(raw_doc.at('./xmlns:summary',@namespaces))\n\t\t\td=text(raw_doc.at('./xmlns:updated',@namespaces))\n\t\t\t@updated=DateTime.parse(d) unless d.nil?\n\t\t\td=text(raw_doc.at('./xmlns:published',@namespaces))\n\t\t\t@published=DateTime.parse(d) unless d.nil?\n\n\t\t\t@authors=raw_doc.xpath('./xmlns:author',@namespaces).collect do |author|\n\t\t\t\t{\n\t\t\t\t\t:name => text(author.at('./xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(author.at('./xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(author.at('./xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@links=OPDS::Support::LinkSet.new @browser\n\t\t\traw_doc.xpath('./xmlns:link',@namespaces).each do |n|\n\t\t\t\ttext=nil\n\t\t\t\ttext=n.attributes['title'].value unless n.attributes['title'].nil?\n\t\t\t\tlink=n.attributes['href'].value\n\t\t\t\ttype=n.attributes['type'].value unless n.attributes['type'].nil?\n\t\t\t\tprice=nil\n\t\t\t\tcurrency=nil\n\t\t\t\t@namespaces['opds']||='http://opds-spec.org/2010/catalog'\n\t\t\t\ttypes=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}\n\t\t\t\ttype=[type,types].flatten.compact unless types.nil? || types.empty?\n\t\t\t\toprice=n.at('./opds:price',@namespaces)\n\t\t\t\tif oprice\n\t\t\t\t\tprice=text(oprice)\n\t\t\t\t\tcurrency=oprice.attributes['currencycode'].value unless oprice.attributes['currencycode'].nil?\n\t\t\t\tend\n\n\t\t\t\tunless n.attributes['rel'].nil?\n\t\t\t\t\tn.attributes['rel'].value.split.each do |rel|\n\t\t\t\t\t\t@links.push(rel,link,text,type,price,currency)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@links.push(nil,link,text,type,price,currency)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@dcmetas=Hash.new\n\t\t\tprefs=@namespaces.reject{|_,v| !%W[http://purl.org/dc/terms/ http://purl.org/dc/elements/1.1/].include?v}\n\t\t\tprefs.keys.map{|p| p.split(':').last}.each do |pref|\n\t\t\t\traw_doc.xpath('./'+pref+':*',@namespaces).each do |n|\n\t\t\t\t\t@dcmetas[n.name]=[] unless @dcmetas[n.name]\n\t\t\t\t\t@dcmetas[n.name].push [n.text, n]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@categories=raw_doc.xpath('./xmlns:category',@namespaces).collect do |n|\n\t\t\t\t[text(n.attributes['label']),text(n.attributes['term'])]\n\t\t\tend\n\n\t\t\t@content=raw_doc.at('./xmlns:content',@namespaces).to_s\n\t\t\t\n\t\t\t@contributors=raw_doc.xpath('./xmlns:contributor',@namespaces).collect do |auth|\n\t\t\t\t{\n\t\t\t\t\t:name => text(raw_doc.at('./xmlns:contributor/xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(raw_doc.at('./xmlns:contributor/xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(raw_doc.at('./xmlns:contributor/xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@rights=text(raw_doc.at('./xmlns:rights',@namespaces))\n\t\t\t@subtitle=text(raw_doc.at('./xmlns:rights',@namespaces))\n\n\t\tend",
"def initialize(attributes)\n @name = attributes.fetch(:name)\n @id = attributes.fetch(:id)\n # @artist = attributes.fetch(:artist)\n # @genre = attributes.fetch(:genre)\n # @year = attributes.fetch(:year)\n # @in_inventory = attributes.fetch(:in_inventory, true) \n end",
"def set_object_fields\n \n # source id\n ##marc_source_id = marc.get_marc_source_id\n ##self.id = marc_source_id if marc_source_id\n # FIXME how do we generate ids?\n #self.marc.set_id self.id\n \n # parent source\n parent = marc.get_parent\n # If the 773 link is removed, clear the source_id\n # But before save it so we can update the parent\n # source.\n @old_parent = source_id if !parent\n self.source_id = parent ? parent.id : nil\n \n # record type\n self.record_type = 2 if marc.is_holding?\n \n # std_title\n self.std_title, self.std_title_d = marc.get_std_title\n \n # composer\n self.composer, self.composer_d = marc.get_composer\n \n # siglum and ms_no\n # in A/1 we do not have 852 in the bibliographic data\n # instead we store in ms_no the Book RISM ID (old rism id)\n if RISM::BASE == \"a1\" and record_type == 0\n self.book_id = marc.get_book_rism_id\n else\n self.lib_siglum, self.shelf_mark = marc.get_siglum_and_shelf_mark\n end\n \n # ms_title for bibliographic records\n self.title, self.title_d = marc.get_source_title if self.record_type != 2\n \n # physical_condition and urls for holding records\n self.ms_condition, self.urls, self.image_urls = marc.get_ms_condition_and_urls if self.record_type == 2\n \n # miscallaneous\n self.language, self.date_from, self.date_to = marc.get_miscellaneous_values\n\n self.marc_source = self.marc.to_marc\n end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def InsertPublication (publication)\n puts \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n raise \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n thePub = nil\n medline = Bio::MEDLINE.new(publication) # convert retrieved format into the medline format\n reference = medline.reference\n thePub = Abstract.find_by_pubmed(reference.pubmed)\n begin \n if thePub.nil? || thePub.id < 1 then\n thePub = Abstract.create!(\n :endnote_citation => reference.endnote, \n :abstract => reference.abstract,\n :authors => reference.authors.join(\"\\n\"),\n :full_authors => medline.full_authors,\n :publication_date => medline.publication_date,\n :electronic_publication_date => medline.electronic_publication_date,\n :deposited_date => medline.deposited_date,\n :status => medline.status,\n :publication_status => medline.publication_status,\n :title => reference.title,\n :publication_type => medline.publication_type[0],\n :journal => medline.full_journal[0..253],\n :journal_abbreviation => medline.ta, #journal Title Abbreviation\n :volume => reference.volume,\n :issue => reference.issue,\n :pages => reference.pages,\n :year => reference.year,\n :pubmed => reference.pubmed,\n :url => reference.url,\n :mesh => reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n )\n else\n if thePub.publication_date != medline.publication_date || thePub.status != medline.status || thePub.publication_status != medline.publication_status then\n thePub.endnote_citation = reference.endnote\n thePub.publication_date = medline.publication_date\n thePub.electronic_publication_date = medline.electronic_publication_date\n thePub.deposited_date = medline.deposited_date\n thePub.publication_status = medline.publication_status\n thePub.status = medline.status\n thePub.volume = reference.volume\n thePub.issue = reference.issue\n thePub.pages = reference.pages\n thePub.year = reference.year\n thePub.pubmed = reference.pubmed\n thePub.url = reference.url\n thePub.mesh = reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n thePub.save!\n end\n # HandleMeshTerms(thePub.mesh, thePub.id)\n end\n rescue ActiveRecord::RecordInvalid\n if thePub.nil? then # something bad happened\n puts \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n raise \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n end\n end \n thePub\nend",
"def book_title\n self.title\n end",
"def citation_title\n self.article_title || self.book_title || self.title\n end",
"def bio\n @data['bio']\n end",
"def initialize(title)\n self.title = title\n @ratings = []\n ALL << self\n end",
"def initialize(title, author)\n @title = title\n @author = author\nend",
"def publication_date\n end"
] |
[
"0.6491546",
"0.6231178",
"0.6039356",
"0.60168743",
"0.5929667",
"0.5821091",
"0.58083063",
"0.5790656",
"0.57471186",
"0.5736013",
"0.57207006",
"0.56932",
"0.5640132",
"0.56179243",
"0.560729",
"0.55908453",
"0.557538",
"0.5567378",
"0.5539262",
"0.55297214",
"0.5525825",
"0.55255544",
"0.5522975",
"0.55104667",
"0.5509201",
"0.54722714",
"0.5461441",
"0.5444317",
"0.54413116",
"0.5439412",
"0.54334855",
"0.5419005",
"0.5419005",
"0.5418926",
"0.54189044",
"0.5415793",
"0.5406937",
"0.54023635",
"0.54023635",
"0.53981113",
"0.538618",
"0.5373419",
"0.5369811",
"0.5369197",
"0.53647876",
"0.5358871",
"0.53565013",
"0.53504735",
"0.5337979",
"0.5325987",
"0.5325128",
"0.53215325",
"0.5300957",
"0.52886397",
"0.5288638",
"0.5285617",
"0.528263",
"0.52761775",
"0.5274459",
"0.52738774",
"0.5271376",
"0.5257959",
"0.52445585",
"0.5239011",
"0.52334255",
"0.52298635",
"0.5229704",
"0.5218826",
"0.52106667",
"0.52092946",
"0.5208962",
"0.5195205",
"0.51947415",
"0.51915306",
"0.519129",
"0.519129",
"0.5183536",
"0.51794857",
"0.5166698",
"0.51661325",
"0.51651037",
"0.51628405",
"0.5161143",
"0.51584625",
"0.51575",
"0.5155117",
"0.51540416",
"0.51540416",
"0.51540416",
"0.51540416",
"0.51540416",
"0.51540416",
"0.51540416",
"0.5147067",
"0.5139781",
"0.51360565",
"0.5135226",
"0.51263946",
"0.5125596",
"0.5124967"
] |
0.6225129
|
2
|
Load information for marc record. marc record is going to be in json format
|
def load_marc_record
@@sierra_api = SierraApi.new unless @@sierra_api
marc_record = @@sierra_api.bibs(id: @bibnumber)
relavent_tags = ['245', '500', '511', '520', '521', '546']
tags = {}
marc_record.each do |i|
tag = i['tag']
if relavent_tags.include?(tag)
tags[tag] = {} unless tags.key?(tag)
i['data']['subfields'].each do |j|
code = j['code']
if tags[tag].key?(code)
tags[tag][code] << ' ' + j['data']
else
tags[tag][code] = j['data']
end
end
end
end
#pp tags
# Extract fields.
@title = tags['245']['a'].gsub(' /', '') if defined?(tags['245']['a'])
@summary = tags['520']['a'] if defined?(tags['520']['a'])
@cast = tags['511']['a'] if defined?(tags['511']['a'])
@language = tags['546']['a'] if defined?(tags['546']['a'])
@rating = tags['521']['a'] if defined?(tags['521']['a'])
if tags.key?('500')
note = tags['500'].values.join(' ')
if match = /\d{4}/.match(note)
@year = match[0] if match.length == 1
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def marc_record_from_json\n return if marc_source.blank?\n\n begin\n marc_json = JSON.parse(marc_source)\n rescue JSON::ParserError => json_error\n Rails.logger.error \"#{self.class}: Failed to parse the MARC JSON: #{json_error}\"\n return\n end\n MARC::Record.new_from_hash marc_json\n end",
"def marc_record\n @marc_record ||= Folio::MarcRecordMapper.build(stripped_marc_json, holdings, instance)\n end",
"def load_marc\n marc_format = _marc_format_type.to_s\n\n case marc_format\n when 'marcxml'\n marc_record_from_marcxml\n when 'marc21'\n marc_record_from_marc21\n when 'json'\n marc_record_from_json\n else\n raise UnsupportedMarcFormatType, \"Only marcxml, marc21, and json are supported, this documents format is #{_marc_format_type} and the current extension parameters are #{self.class.extension_parameters.inspect}\"\n end\n rescue StandardError => e\n Rails.logger.error(\"Blacklight failed to parse MARC record. Exception was: #{e}\")\n nil\n end",
"def marc_record_from_marcxml\n id = fetch(_marc_source_field)\n\n response = Faraday.get(\"#{Requests.config['bibdata_base']}/bibliographic/#{id}\")\n @can_retry = response.status == 429\n response_stream = StringIO.new(response.body)\n marc_reader = ::MARC::XMLReader.new(response_stream)\n marc_records = marc_reader.to_a\n marc_records.first\n end",
"def load_record(rid, mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_record_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n url_get_records = url_get_records.gsub '{rid}', rid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n record = json['record']\n\n unless record\n raise 'Record key doesn\\'t present in response from Dynamicloud server.'\n end\n\n Dynamicloud::API::DynamicloudHelper.normalize_record record\n end",
"def _marc_format_type\n :json\n end",
"def load record\n end",
"def marc_record_from_marc21\n return if marc_source.blank?\n MARC::Record.new_from_marc marc_source\n end",
"def marc\n @marc ||= (\n Blacklight::Marc::Document.new fetch(self.class.marc_source_field), self.class.marc_format_type\n ) if key?(self.class.marc_source_field)\n end",
"def to_marc_json\n to_marc.to_hash.to_json\n end",
"def to_marc\n @_ruby_marc_obj ||= load_marc\n end",
"def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end",
"def load_fields(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_fields\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n fields = []\n fs = json['fields']\n fs.each do |key, jf|\n field = Dynamicloud::API::Model::RecordField.new\n field.id = jf['id'].to_i\n field.identifier = jf['identifier']\n field.label = jf['label']\n field.comment = jf['comment']\n field.uniqueness = jf['uniqueness']\n field.required = jf['required']\n field.type = Dynamicloud::API::Model::RecordFieldType.get_field_type jf['field_type'].to_i\n field.items = Dynamicloud::API::DynamicloudHelper.build_items jf['items']\n field.mid = mid.to_i\n\n fields.push field\n end\n\n fields\n end",
"def read_metadata; end",
"def initialize(marc_record)\n @record = marc_record\n @bib_format = BibFormat.new(record).code\n @types = BibTypes.new(@bib_format, record).codes\n end",
"def get_cr_json_object(cr_doi)\n crr = nil\n doi_file = '../json_files/' + cr_doi.gsub('/','_').downcase() + '.json'\n if !File.exists?(doi_file)\n crr = CrApiWrapper::CrRecord.find(cr_doi)\n File.open(doi_file,\"w\") do |f|\n f.write(JSON.pretty_generate(crr))\n end\n else\n File.open(doi_file,\"r\") do |f|\n crr = JSON.parse(f.read)\n end\n end\n # verify that the recoverd object matches the schema\n if verify_with_schema(doi_file)\n return crr\n else\n return nil\n end\nend",
"def load\n records.load\n end",
"def ___init_record_file\n return unless @opt.mcr_log?\n # ext_file must be after ext_rsp which includes time update\n @record.ext_local.ext_file.ext_save\n @record.mklink # Make latest link\n @record.mklink(@id) # Make link to /json\n end",
"def parse_details(line)\n @id, blob = line.split(\":\")\n @fullname, @date, @parent_id = blob.split(\",\")\n @owner, @name = fullname.split(\"/\")\n end",
"def load_record\n if persisted?\n @record = proxy.get_record(ref)\n # create proper variables from the underlying proxy structure\n @record = cast_attributes(@record)\n else\n @record = {}\n end\n rescue\n # TODO: Hmmmm, I should probably do something here\n raise\n end",
"def load_from_record(api_object)\n record = api_object.at_xpath(\"api:records/api:record[@format='native']/api:native\")\n\n unless record \n raise ArgumentError,\n \"Object given did not contain the nodes expected of a publication record.\"\n end\n \n xpath_queries = {\n doc_type: \"../../../@type\",\n id: \"../../../@id\",\n publisher: \"api:field[@name='publisher']/api:text\",\n title: \"api:field[@name='title']/api:text\",\n volume: \"api:field[@name='volume']/api:text\",\n abstract: \"api:field[@name='abstract']/api:text\",\n issue: \"api:field[@name='issue']/api:text\",\n page_start: \"api:field[@name='pagination']/api:pagination/api:begin-page\",\n page_end: \"api:field[@name='pagination']/api:pagination/api:end-page\",\n pages: \"api:field[@name='pagination']/api:pagination/api:page-count\",\n number: \"api:field[@name='number']/api:text\",\n doi: \"api:field[@name='doi']/api:links/api:link[@type='doi']/@href\",\n journal: \"api:field[@name='journal']/api:text\",\n\n }\n\n # Loop through all the xpath queries.\n xpath_queries.each do |field, xpath|\n if element = record.at_xpath(xpath)\n send(\"#{field}=\", element.text)\n end\n end\n\n extract_author_list(record.at_xpath(\"api:field[@name='authors']\"))\n extract_date(record.at_xpath(\"api:field[@name='publication-date']\"))\n extract_subject(record.at_xpath(\"api:field[@name='keywords']\"))\n end",
"def set_object_fields\n \n # source id\n ##marc_source_id = marc.get_marc_source_id\n ##self.id = marc_source_id if marc_source_id\n # FIXME how do we generate ids?\n #self.marc.set_id self.id\n \n # parent source\n parent = marc.get_parent\n # If the 773 link is removed, clear the source_id\n # But before save it so we can update the parent\n # source.\n @old_parent = source_id if !parent\n self.source_id = parent ? parent.id : nil\n \n # record type\n self.record_type = 2 if marc.is_holding?\n \n # std_title\n self.std_title, self.std_title_d = marc.get_std_title\n \n # composer\n self.composer, self.composer_d = marc.get_composer\n \n # siglum and ms_no\n # in A/1 we do not have 852 in the bibliographic data\n # instead we store in ms_no the Book RISM ID (old rism id)\n if RISM::BASE == \"a1\" and record_type == 0\n self.book_id = marc.get_book_rism_id\n else\n self.lib_siglum, self.shelf_mark = marc.get_siglum_and_shelf_mark\n end\n \n # ms_title for bibliographic records\n self.title, self.title_d = marc.get_source_title if self.record_type != 2\n \n # physical_condition and urls for holding records\n self.ms_condition, self.urls, self.image_urls = marc.get_ms_condition_and_urls if self.record_type == 2\n \n # miscallaneous\n self.language, self.date_from, self.date_to = marc.get_miscellaneous_values\n\n self.marc_source = self.marc.to_marc\n end",
"def build_record\n record = MARC::Record.new\n data_field = nil\n control_field = nil\n subfield = nil\n text = \"\"\n attrs = nil\n if Module.constants.index(\"Nokogiri\") && @parser.is_a?(Nokogiri::XML::Reader)\n datafield = nil\n cursor = nil\n open_elements = []\n @parser.each do |node|\n if node.value? && cursor\n if cursor.is_a?(Symbol) && (cursor == :leader)\n record.leader = node.value\n else\n cursor.value = node.value\n end\n cursor = nil\n end\n next unless node.namespace_uri == @ns\n if open_elements.index(node.local_name.downcase)\n open_elements.delete(node.local_name.downcase)\n next\n else\n open_elements << node.local_name.downcase\n end\n case node.local_name.downcase\n when \"leader\"\n cursor = :leader\n when \"controlfield\"\n record << datafield if datafield\n datafield = nil\n control_field = MARC::ControlField.new(node.attribute(\"tag\"))\n record << control_field\n cursor = control_field\n when \"datafield\"\n record << datafield if datafield\n datafield = nil\n data_field = MARC::DataField.new(node.attribute(\"tag\"), node.attribute(IND1), node.attribute(IND2))\n datafield = data_field\n when \"subfield\"\n raise \"No datafield to add to\" unless datafield\n subfield = MARC::Subfield.new(node.attribute(CODE))\n datafield.append(subfield)\n cursor = subfield\n when \"record\"\n record << datafield if datafield\n return record\n end\n end\n\n else\n while @parser.has_next?\n event = @parser.pull\n\n if event.text?\n text += REXML::Text.unnormalize(event[0])\n next\n end\n\n if event.start_element?\n text = \"\"\n attrs = event[1]\n case strip_ns(event[0])\n when \"controlfield\"\n text = \"\"\n control_field = MARC::ControlField.new(attrs[TAG])\n when \"datafield\"\n text = \"\"\n data_field = MARC::DataField.new(attrs[TAG], attrs[IND1],\n attrs[IND2])\n when \"subfield\"\n text = \"\"\n subfield = MARC::Subfield.new(attrs[CODE])\n end\n end\n\n if event.end_element?\n case strip_ns(event[0])\n when \"leader\"\n record.leader = text\n when \"record\"\n return record\n when \"controlfield\"\n control_field.value = text\n record.append(control_field)\n when \"datafield\"\n record.append(data_field)\n when \"subfield\"\n subfield.value = text\n data_field.append(subfield)\n end\n end\n end\n end\n end",
"def serialize\n MARCRecord.new(@doc).serialize.to_marc\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def recupera_json(nome_arq)\n linha = ''\n File.open(nome_arq, 'r').each_line do |line|\n if line.include? 'trackinfo: '\n linha = line\n break\n end\n end\n linha.slice!(-2..-1)\n linha.slice!(' trackinfo: ')\n JSON.parse linha\nend",
"def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end",
"def read_meta(node)\n t = decompress_revision(node)\n return {} unless has_metadata?(t)\n \n mt = t[metadata_start..(metadata_end(t) - 1)]\n mt.split(\"\\n\").inject({}) do |hash, line|\n k, v = line.split(\": \", 2)\n hash[k] = v\n hash\n end\n end",
"def initialize filename\n\t\tFile.open(filename) do |f|\n\t\t\ts = f.gets\n\t\t\tputs \"first line of the vineRecord file (should be the entire json string): #{string}\"\n\t\tend\n\n\t\t@record = JSON.parse(s)\n\tend",
"def get_record(identifier)\n doc = client.get!(CGI.escape(identifier)).body.to_json\n @record_class.build(mint_id(identifier), doc, 'application/json')\n end",
"def record_fields\n mappings = {}\n if log_record?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Mapping Record: #{self.record}\" }\n end\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n collection_id_components = [\n resource_obj[0]['id_0'],\n resource_obj[0]['id_1'],\n resource_obj[0]['id_2'],\n resource_obj[0]['id_3']\n ]\n\n mappings['collection_id'] = collection_id_components\n .reject {|id_comp| id_comp.blank?}\n .join('-')\n\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if self.record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if self.record.dates\n mappings['date_expression'] = self.record.dates\n .select{ |date| date['date_type'] == 'single' or date['date_type'] == 'inclusive'}\n .map{ |date| date['final_expression'] }\n .join(';')\n end\n\n if (self.record.notes['userestrict'])\n mappings['userestrict'] = self.record.notes['userestrict']\n .map { |note| note['subnotes'] }.flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true }\n .map { |subnote| subnote['content'] }.flatten\n .join(\"; \") \n end\n \n mappings\n end",
"def load_text_metadata\n str = self.client.getmd({}, @address)\n keymap = self.class.md_key_map # subclasses implement this function\n types = self.class.md_type_coercion_map # subclasses might implement this function\n \n # regular expression: matches lines with:\n # 4 whitespace characters at start of line\n # word containing uppercase characters and/or underscores (captured as var 1)\n # colon character immediately after that word\n # one or more whitespace characters\n # any characters following that whitespace, up to end of line (captured as var 2)\n # So, if the string matches, it gets the key as var 1, value as var 2\n re = /^\\W{4}([A-Z_]+):\\s+(.+)$/\n str.each_line do |line|\n md = re.match(line)\n next if md.nil?\n next if md.size < 3 # skip if we didn't get a value for a key (or didn't match)\n \n # insert the metadata value into the @metadata hash\n insert_metadata md[1], md[2], keymap, types\n end\n \n # note that we don't need to run this again\n @metadata_loaded = true\n end",
"def fetch_metadata\n {\n \"public_fqdn\" => fetch_metadata_item(\"getFullyQualifiedDomainName.txt\"),\n \"local_ipv4\" => fetch_metadata_item(\"getPrimaryBackendIpAddress.txt\"),\n \"public_ipv4\" => fetch_metadata_item(\"getPrimaryIpAddress.txt\"),\n \"region\" => fetch_metadata_item(\"getDatacenter.txt\"),\n \"instance_id\" => fetch_metadata_item(\"getId.txt\"),\n }\n end",
"def quick_marc\n @marc = Sierra::Data::Helpers::SierraMARC.compile_marc(\n self,\n ldr: @leader_field || Sierra::Data::LeaderField.\n by_record_id(record_id: id),\n cfs: @control_fields || Sierra::Data::ControlField.\n by_record_id(record_id: id),\n vfs: @varfields || Sierra::Data::Varfield.\n by_record_id(record_id: id)\n )\n end",
"def bib\n self.response = self.class.get(\"#{record_url}?view=full\")\n raise_error_if(\"Error getting bib from Aleph REST APIs.\") {\n (response.parsed_response[\"get_record\"].nil? or response.parsed_response[\"get_record\"][\"record\"].nil?)\n }\n MARC::XMLReader.new(StringIO.new(xml(xml: response.body).at_xpath(\"get-record/record\").to_xml(xml_options).strip)).first\n end",
"def entry_fields(rec, user:, serialize: JSON_SERIALIZE)\n user = user_id(user) unless user.is_a?(Integer)\n ed = rec.emma_metadata(refresh: true)\n fd = rec.file_data\n mime = fd&.deep_symbolize_keys&.dig(:metadata, :mime_type)\n fmt = mime_to_fmt(mime)\n ext = fmt_to_ext(fmt)\n {\n user_id: user,\n repository: ed[:emma_repository],\n submission_id: ed[:emma_repositoryRecordId],\n fmt: ed[:dc_format] || FileFormat.metadata_fmt(fmt),\n ext: ext,\n state: 'completed',\n phase: 'create',\n file_data: (serialize ? fd.to_json : fd),\n emma_data: (serialize ? ed.to_json : ed),\n }\n end",
"def rdf_metadata\n @rdf_metadata ||= Valkyrie::Persistence::Shared::JSONValueMapper.new(object[:metadata]).result\n end",
"def load\n super\n slice_records!\n\n self\n end",
"def to_mrc(opts={})\n defaults = {\n :record => MARC::Record.new\n }\n opts = defaults.merge(opts)\n set_opts_attribs(opts)\n @record.leader = @leader\n @record.leader = @leader\n @record.append(MARC::ControlField.new('008',@control_008)) # TODO Make this iterative for all control fields.\n @marc_lines.each do |line|\n @record.append(MARC::DataField.new(\n line.tag,\n line.ind_1,\n line.ind_2,\n *(line.subfield_codes.each_with_index.collect {|sfc,i| [sfc.gsub('|',''),line.values[i]]})\n ))\n end\n\n @record\n end",
"def node_to_record(model, node)\n record = { }\n xpathmap = model.xpathmap rescue { }\n xmlnamespaces = model.xmlnamespaces rescue nil\n# STDERR.puts \"MODEL node_to_record(#{model.properties}<#{node.class}>)\"\n model.properties.each do |property|\n xpath = xpathmap[property.name] || property.name\n# STDERR.puts \"PROPERTY node_to_record property(#{property.inspect})\"\n\tkey = property.name.to_s\n\tif key == \"raw\"\n\t record[key] = node.to_s\n\t next\n\tend\n\tchildren = node.xpath(\"./#{xpath}\", xmlnamespaces)\t\n#\tSTDERR.puts \"Property found: #{property.inspect} at #{xpath} with #{children.size} children\"\n\tcase children.size\n\twhen 0\n next\n\twhen 1\n\t value = children.text.strip\n#\t STDERR.puts \"done: #{value.inspect}\" if xpath =~ /done/\n\t value = children.to_xml if value.empty?\n\telse\n\t value = children.to_xml\n\tend\n#\tSTDERR.puts \"Key #{key}, Value #{value.inspect} <#{property.class}>\"\n\tcase property\n\twhen DataMapper::Property::Date\n\t require 'parsedate'\n\t record[key] = Time.utc(ParseDate.parsedate(value))\n\twhen DataMapper::Property::Integer\n\t record[key] = value.to_s\n\twhen DataMapper::Property::String\n\t record[key] = value.to_s\n\twhen DataMapper::Property::Boolean\n\t record[key] = !value.nil?\n\twhen DataMapper::Property::Class\n# STDERR.puts \"Class property #{property.name.capitalize} value #{value.inspect}\"\n case property.name\n when :productline\n val = DataMapper.const_get(property.name.capitalize).new\n val.id = children.attribute(\"id\")\n val.name = value.to_s\n when :actors\n val = Array.new\n children.each do |node|\n actor = DataMapper.const_get(\"Actor\").new\n actor.role = node.xpath(\"./role\").text.to_s\n actor.userid = node.xpath(\"./person/userid\").text.to_s\n actor.email = node.xpath(\"./person/email\").text.to_s\n actor.fullname = node.xpath(\"./person/fullname\").text.to_s\n val << actor\n end\n when :productcontexts\n val = Array.new\n children.each do |node|\n context = DataMapper.const_get(\"Productcontext\").new\n context.id = node.xpath(\"./product/productid\").text.to_i\n context.name = node.xpath(\"./product/name\").text.to_s\n context.done = !node.xpath(\"./status/done\").empty?\n context.rejected = !node.xpath(\"./status/rejected\").empty?\n context.duplicate = !node.xpath(\"./status/duplicate\").empty?\n val << context\n end\n else\n raise TypeError, \"'class' property #{property} not implemented\"\n end\n\t record[key] = val\n\telse\n\t raise TypeError, \"#{property} unsupported\"\n\tend\n end\n record\n end",
"def load_attributes\n @attributes = MultiJson.decode(File.new(file, 'r').read)\n end",
"def load_attributes\n puts \"Loading project information from #{project_file}\"\n @attributes = MultiJson.decode(File.new(project_file, 'r').read)\n end",
"def get_record(bibnumber)\n if record_exists?(bibnumber)\n marc_url = URI_FOR_MARC % ([@scope] + Array.new(3, bibnumber))\n record_url = URI_FOR_RECORD % [bibnumber, @scope]\n \n # Retrieve MARC data and convert to UTF-8 prior to decoding ...\n record_page = get_page(marc_url)\n record_data = MARC_REGEX.match(record_page)\n \n if record_data.nil?\n raise ParserError, \"Could not decode data: MARC data not found.\"\n else\n record_data = record_data[1].strip()\n record_data = Iconv.conv('UTF-8', 'LATIN1', record_data)\n end\n\n record = decode_pseudo_marc(record_data)\n unless record.nil?\n record.bibnum = bibnumber\n record.raw = record_data\n record.record_url = \"#{self.class.base_uri}#{record_url}\"\n record.marc_url = \"#{self.class.base_uri}#{marc_url}\"\n end\n return record\n else\n raise NonExistentRecordError, \"Record not found.\"\n end\n rescue NonExistentRecordError => error\n warn error.message\n return nil\n rescue ParserError => error \n warn error.message\n return nil\n end",
"def initialize(zonefile = \"\", file_name = nil, origin = nil)\n @data = zonefile\n @filename = file_name\n self.origin = origin || (file_name ? file_name.split(\"/\").last : \"\")\n\n @records = {}\n @soa = {}\n @lastname = nil\n @ttl = nil\n RECORDS.each do |name, _|\n @records[name] = []\n end\n parse\n end",
"def api_deserialize_impl(r)\n @is_new = (r).nil?\n r = {} if @is_new\n @is_incomplete = false\n if Saklient::Util::exists_path(r, 'ID')\n @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s\n else\n @m_id = nil\n @is_incomplete = true\n end\n @n_id = false\n if Saklient::Util::exists_path(r, 'Name')\n @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s\n else\n @m_name = nil\n @is_incomplete = true\n end\n @n_name = false\n if Saklient::Util::exists_path(r, 'StorageClass')\n @m_storage_class = (Saklient::Util::get_by_path(r, 'StorageClass')).nil? ? nil : Saklient::Util::get_by_path(r, 'StorageClass').to_s\n else\n @m_storage_class = nil\n @is_incomplete = true\n end\n @n_storage_class = false\n end",
"def initialize(hash)\n @marc_type = hash[:marc_type]\n @display_statement = hash[:display_statement]\n @note = hash[:note]\n end",
"def json_fields\n\n mappings = {}\n\n json = self.record.json\n return mappings unless json\n\n lang_materials = json['lang_materials']\n if lang_materials\n mappings['language'] = lang_materials\n .select { |lm| lm['language_and_script'].present? and lm['language_and_script']['language'].present?}\n .map{ |lm| lm['language_and_script']['language'] }\n .flatten\n .join(\";\")\n end\n\n language = json['language']\n if language\n mappings['language'] = language\n end\n\n\n notes = json['notes']\n if notes\n mappings['physical_location_note'] = notes\n .select { |note| note['type'] == 'physloc' and note['content'].present? and note['publish'] == true }\n .map { |note| note['content'] }\n .flatten\n .join(\"; \")\n\n mappings['accessrestrict'] = notes\n .select { |note| note['type'] == 'accessrestrict' and note['subnotes'] }\n .map { |note| note['subnotes'] }\n .flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true}\n .map { |subnote| subnote['content'] }\n .flatten\n .join(\"; \")\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n\n if json['linked_agents']\n mappings['creators'] = json['linked_agents']\n .select { |l| l['role'] == 'creator' and l['_resolved'] }\n .map { |l| l['_resolved']['names'] }.flatten\n .select { |n| n['is_display_name'] == true}\n .map { |n| n['sort_name']}\n .join(\"; \")\n end\n\n if json['rights_statements']\n mappings['rights_type'] = json['rights_statements'].map{ |r| r['rights_type']}.uniq.join(';')\n end\n\n digital_instances = json['instances'].select { |instance| instance['instance_type'] == 'digital_object'}\n if (digital_instances.any?)\n mappings[\"digital_objects\"] = digital_instances.map{|d| d['digital_object']['ref']}.join(';')\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = self.container_instances\n return mappings unless instances\n\n mappings['requests'] = instances\n .each_with_index\n .map { |instance, i|\n request = {}\n \n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n return request unless container\n\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n return request unless top_container\n\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n return request unless top_container_resolved\n\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n if (top_container_resolved['container_locations'])\n request[\"instance_top_container_location_note_#{instance_count}\"] = top_container_resolved['container_locations'].map{ |l| l['note']}.join{';'}\n end\n\n request[\"requestable_#{instance_count}\"] = (top_container_resolved['active_restrictions'] || [])\n .map{ |ar| ar['local_access_restriction_type'] }\n .flatten.uniq\n .select{ |ar| (self.repo_settings[:hide_button_for_access_restriction_types] || []).include?(ar)}\n .empty?\n\n locations = top_container_resolved[\"container_locations\"]\n if locations.any?\n location_id = locations.sort_by { |l| l[\"start_date\"]}.last()[\"ref\"]\n location = archivesspace.get_location(location_id)\n request[\"instance_top_container_location_#{instance_count}\"] = location['title']\n request[\"instance_top_container_location_id_#{instance_count}\"] = location_id\n request[\"instance_top_container_location_building_#{instance_count}\"] = location['building']\n end\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n\n end\n\n request\n }\n\n mappings\n end",
"def dissect_to_record_hashes\n end",
"def extract_metadata; end",
"def api_deserialize_impl(r)\n @is_new = (r).nil?\n r = {} if @is_new\n @is_incomplete = false\n if Saklient::Util::exists_path(r, 'ID')\n @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s\n else\n @m_id = nil\n @is_incomplete = true\n end\n @n_id = false\n if Saklient::Util::exists_path(r, 'Name')\n @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s\n else\n @m_name = nil\n @is_incomplete = true\n end\n @n_name = false\n if Saklient::Util::exists_path(r, 'CPU')\n @m_cpu = (Saklient::Util::get_by_path(r, 'CPU')).nil? ? nil : (Saklient::Util::get_by_path(r, 'CPU').to_s).to_s().to_i(10)\n else\n @m_cpu = nil\n @is_incomplete = true\n end\n @n_cpu = false\n if Saklient::Util::exists_path(r, 'MemoryMB')\n @m_memory_mib = (Saklient::Util::get_by_path(r, 'MemoryMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'MemoryMB').to_s).to_s().to_i(10)\n else\n @m_memory_mib = nil\n @is_incomplete = true\n end\n @n_memory_mib = false\n if Saklient::Util::exists_path(r, 'ServiceClass')\n @m_service_class = (Saklient::Util::get_by_path(r, 'ServiceClass')).nil? ? nil : Saklient::Util::get_by_path(r, 'ServiceClass').to_s\n else\n @m_service_class = nil\n @is_incomplete = true\n end\n @n_service_class = false\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def marc_source\n @_marc_source ||= fetch(_marc_source_field)\n end",
"def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = { }\n metas['build_date'] = @jsonData['build_date']\n metas['build_time'] = @jsonData['build_time']\n metas['git_revision'] = @jsonData['git_revision']\n metas['options'] = @jsonData['sim']['options']\n metas['overrides'] = @jsonData['sim']['overrides']\n metas['statistics'] = @jsonData['sim']['statistics']\n @jsonData['sim']['players'].each do |player|\n if player['name'] == 'Template'\n metas['player'] = player\n end\n end\n metas['profilesets_overrides'] = { }\n @jsonData['sim']['profilesets']['results'].each do |player|\n next unless player['overrides']\n metas['profilesets_overrides'][player['name']] = player['overrides']\n end\n\n # Timestamps\n metas['build_timestamp'] = DateTime.parse(@jsonData['build_date'] + ' ' + @jsonData['build_time'] + ' ' + Time.now.strftime('%:z')).to_time.to_i\n metas['result_timestamp'] = Time.now.to_i\n\n # Add additional data\n metas.merge!(@additionalMetadata)\n\n return metas\n end",
"def metadata_from_crate(crate, m)\n if crate['keywords'] && m[:tags].blank?\n m[:tags] = crate['keywords'].is_a?(Array) ? crate['keywords'] : crate['keywords'].split(',').map(&:strip)\n end\n\n m[:title] = crate['name'] if crate['name'].present?\n m[:description] = crate['description'] if crate['description'].present?\n m[:license] = crate['license'] if crate['license'].present?\n\n other_creators = []\n authors = []\n [crate['author'], crate['creator']].each do |author_category|\n if author_category.present?\n author_category = author_category.split(',').map(&:strip) if author_category.is_a?(String)\n author_category = author_category.is_a?(Array) ? author_category : [author_category]\n author_category.each_with_index do |author_meta|\n author_meta = author_meta.dereference if author_meta.respond_to?(:dereference)\n if author_meta.is_a?(::ROCrate::ContextualEntity) && !author_meta.is_a?(::ROCrate::Person)\n other_creators << author_meta['name'] if author_meta['name'].present?\n else\n author = extract_author(author_meta)\n authors << author unless author.blank?\n end\n end\n end\n end\n\n m[:other_creators] = other_creators.join(', ') if other_creators.any?\n authors.uniq!\n if authors.any?\n m[:assets_creators_attributes] ||= {}\n authors.each_with_index do |author, i|\n m[:assets_creators_attributes][i.to_s] = author.merge(pos: i)\n end\n end\n\n source_url = crate['isBasedOn'] || crate['url'] || crate.main_workflow['url']\n if source_url\n handler = ContentBlob.remote_content_handler_for(source_url)\n if handler.respond_to?(:repository_url)\n source_url = handler.repository_url\n elsif handler.respond_to?(:display_url)\n source_url = handler.display_url\n end\n m[:source_link_url] = source_url\n end\n\n m\n end",
"def record_fields\n mappings = {}\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n mappings['collection_id'] = \"#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}\".rstrip\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if record.notes\n accessrestrict = record.notes['accessrestrict']\n if accessrestrict\n arSubnotes = accessrestrict['subnotes']\n if arSubnotes\n mappings['accessrestrict'] = arSubnotes\n .select { |arSubnote| arSubnote['content'].present? }\n .map { |arSubnote| arSubnote['content'].strip }\n .join(\"; \")\n end\n end\n end\n\n return mappings\n end",
"def load\n records.__send__(:load)\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def load_customer_info(customer)\n self.customer_id = customer.id\n self.cardholder_email = customer.email\n\n customer_card = get_default_card(customer)\n\n self.cardholder_name = customer_card.name\n self.card_type = customer_card.type\n self.last4 = customer_card.last4\n self.expiration = customer_card.exp_month.to_s +\n '/' + customer_card.exp_year.to_s\n end",
"def api_deserialize_impl(r)\n @is_new = (r).nil?\n r = {} if @is_new\n @is_incomplete = false\n if Saklient::Util::exists_path(r, 'ID')\n @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s\n else\n @m_id = nil\n @is_incomplete = true\n end\n @n_id = false\n if Saklient::Util::exists_path(r, 'Name')\n @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s\n else\n @m_name = nil\n @is_incomplete = true\n end\n @n_name = false\n if Saklient::Util::exists_path(r, 'Description')\n @m_description = (Saklient::Util::get_by_path(r, 'Description')).nil? ? nil : Saklient::Util::get_by_path(r, 'Description').to_s\n else\n @m_description = nil\n @is_incomplete = true\n end\n @n_description = false\n if Saklient::Util::exists_path(r, 'NetworkMaskLen')\n @m_network_mask_len = (Saklient::Util::get_by_path(r, 'NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'NetworkMaskLen').to_s).to_s().to_i(10)\n else\n @m_network_mask_len = nil\n @is_incomplete = true\n end\n @n_network_mask_len = false\n if Saklient::Util::exists_path(r, 'BandWidthMbps')\n @m_band_width_mbps = (Saklient::Util::get_by_path(r, 'BandWidthMbps')).nil? ? nil : (Saklient::Util::get_by_path(r, 'BandWidthMbps').to_s).to_s().to_i(10)\n else\n @m_band_width_mbps = nil\n @is_incomplete = true\n end\n @n_band_width_mbps = false\n if Saklient::Util::exists_path(r, 'Switch.ID')\n @m_swytch_id = (Saklient::Util::get_by_path(r, 'Switch.ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'Switch.ID').to_s\n else\n @m_swytch_id = nil\n @is_incomplete = true\n end\n @n_swytch_id = false\n end",
"def initialize(input_record, extract_marc_memoizer:)\n super\n __setobj__(self.input_record)\n @extract_marcs = extract_marc_memoizer\n end",
"def getRecordJSON()\n return @sObjectRecords\nend",
"def decode_pseudo_marc(pseudo_marc)\n raise ParserError, \"Cannot decode empty string.\" if pseudo_marc == \"\"\n \n pseudo_marc = pseudo_marc.split(\"\\n\") \n raw_fields = []\n \n if pseudo_marc[0][0..5] == \"LEADER\"\n record = create_record_for_type(pseudo_marc[0][7..-1])\n else\n raise ParserError, \"Cannot decode record without a leader.\"\n end\n \n pseudo_marc[1..pseudo_marc.length].each do |field|\n data = @entities.decode(field[7..-1])\n if field[0..2] != ' '\n data = MARC::ControlField.control_tag?(field[0..2]) ? data : \"a#{data}\"\n raw_fields << { \n :tag => field[0..2], \n :indicator1 => field[4,1], \n :indicator2 => field[5,1], \n :value => data.strip, \n :raw => field.strip\n }\n else \n raw_fields.last[:value] += \" #{data}\"\n raw_fields.last[:raw] += field.strip\n end\n end\n \n raw_fields.each do |field|\n tag = field[:tag]\n field_data = field[:value]\n if MARC::ControlField.control_tag?(tag)\n record.append(MARC::ControlField.new(tag, field_data)) \n else\n datafield = MARC::DataField.new(tag)\n datafield.indicator1 = field[:indicator1]\n datafield.indicator2 = field[:indicator2]\n \n field_data.split('|').each{|sub| \n subfield = MARC::Subfield.new(sub[0,1], sub[1..-1])\n datafield.append(subfield)\n }\n record.append(datafield)\n end\n end\n \n return record\n end",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def initMetaData(csvfile,metamap,keyfield)\n\t\tallRows = CSV.read(csvfile,{:col_sep=>\";\"})\n\t\tif allRows and not allRows.empty?\n\t\t\ttitle = allRows[1]\n\t\t\tallRows.each_with_index do |row,i|\n\t\t\t\tif i > 1\n\t\t\t\t\tmetaData = Model::MetaData.new(title,row)\n\t\t\t\t\tkey = metaData.send(keyfield)\n\t\t\t\t\tmetamap[key] = metaData\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def parse_ccr(doc, patient_id_xpath=\"//ccr:ContinuityOfCareRecord/ccr:Patient/ccr:ActorID\")\n ccr_patient = {}\n entries = create_hash(doc)\n get_demographics(ccr_patient, doc, patient_id_xpath)\n process_events(ccr_patient, entries)\n Record.new(ccr_patient)\n end",
"def to_jq_record\n {\n \"id\" => read_attribute(:id),\n \"description\" => read_attribute(:description),\n \"name\" => read_attribute(:record),\n \"size\" => record.size,\n \"url\" => '/download_record?id=' + read_attribute(:id).to_s,\n \"thumbnail_url\" => is_image? ? '/thumbnail?id=' + read_attribute(:id).to_s : \"/assets/icon_file_lock_24.png\",\n \"delete_url\" => records_path.to_s + \"/\" + self.id.to_s,\n \"delete_type\" => \"DELETE\" \n }\n end",
"def metadata\n {\n district_council: response[\"consellBarri\"]&.strip,\n district: response[\"barri\"]&.strip,\n document_number: document_number,\n }\n end",
"def initialize(results_record)\n\n if results_record.key? 'Record'\n @record = results_record['Record'] # single record returned by retrieve api\n else\n @record = results_record # set of records returned by search api\n end\n\n @items = @record.fetch('Items', {})\n\n @bib_entity = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibEntity', {})\n\n @bib_relationships = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibRelationships', {})\n\n @bib_part = @record.fetch('RecordInfo', {})\n .fetch('BibRecord', {})\n .fetch('BibRelationships', {})\n .fetch('IsPartOfRelationships', {})[0]\n\n @bibtex = BibTeX::Entry.new\n end",
"def fetch_report\n\t\t\t\tbegin\n\t\t\t\t\treport = fetch(\"#{Middlecoin::MIDDLECOIN_URL}/json\")\n\t\t\t\t\t@report = JSON.parse(report.body)[\"report\"]\n\t\t\t\trescue => e\n\t\t\t\t\traise Middlecoin::MiddlecoinAPIError, \"Unable to collect JSON report from middlecoin.com\"\n\t\t\t\tend\n\t\t\tend",
"def read(params = {})\n {}.tap do |res|\n records = get_records(params)\n res[\"children\"] = records.map{|r| node_to_hash(r, final_columns(with_meta: true)).netzke_literalize_keys}\n res[\"total\"] = count_records(params) if config[:enable_pagination]\n end\n end",
"def initialize\n @json_file = JSON.parse(HTTParty.get('http://data.fixer.io/api/latest?access_key=8673ff340f8c9309e05687dc6d5454f9').body)\n end",
"def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end",
"def parse_record( parser, identifier )\n\t\t\texpires = parser.expires_on if parser.property_any_supported?( :expires_on )\n\n\t\t\tif !parser.registered?\n\t\t\t\treturn { error: 'Not registered.' }\n\t\t\telsif expires && expires <= Time.now\n\t\t\t\treturn { error: \"Expired on #{expires}\" }\n\t\t\tend\n\n\t\t\treturn Whois::Parser::PROPERTIES.each_with_object({}) do |prop, data|\n\t\t\t\tnext unless parser.property_any_supported?( prop )\n\n\t\t\t\tval = parser.public_send( prop )\n\n\t\t\t\tcase prop\n\t\t\t\twhen :nameservers\n\t\t\t\t\tdata[ 'nameservers' ] = val.map( &:name )\n\t\t\t\twhen :available?, :registered?\n\t\t\t\t\tdata[ prop.to_s[0..-2] ] = val\n\t\t\t\twhen :registrant_contacts, :admin_contacts, :technical_contacts\n\t\t\t\t\tdata[ prop ] = val.map do |contact|\n\t\t\t\t\t\t\"%s <%s>\" % [ contact.name, contact.email ]\n\t\t\t\t\tend\n\t\t\t\twhen :status\n\t\t\t\t\tdata[ prop ] = val.map( &:to_s )\n\t\t\t\telse\n\t\t\t\t\tdata[ prop ] = val.to_s\n\t\t\t\tend\n\t\t\tend\n\t\trescue Whois::ParserError, NoMethodError => err\n\t\t\tmsg = \"%p while parsing record for %s: %s\" %\n\t\t\t\t[ err.class, identifier, err.message ]\n\t\t\tself.log.error( msg )\n\t\t\tself.log.debug { err.backtrace.join(\"\\n \") }\n\n\t\t\treturn { warning: \"Record fetched, but the record could not be parsed.\" }\n\t\tend",
"def read_json(request_type)\n case request_type\n when :manga\n @json_key = \"unapproved_manga\".freeze\n @url_part = \"manga\".freeze\n else\n @json_key = \"unapproved_anime\".freeze\n @url_part = \"anime\".freeze\n end\n @parsed_json = $id_cache.get()\n @parsed_info = $info_cache.get()\n @ids = @parsed_json[@json_key].map(&:to_s)\n @info = @parsed_info[@json_key]\n @data = {}\n @ids.each do |i|\n @id_url = \"https://myanimelist.net/#{@url_part}/#{i}\".freeze\n @data[i] = if @info.key?(i)\n @info[i]\n else\n { \"name\".freeze => @id_url, \"type\".freeze => \"?\".freeze, \"nsfw\".freeze => false }\n end\n @data[i][\"url\".freeze] = @id_url\n end\n [@ids, @data]\nend",
"def load_data(_records, _loader)\n raise \"Implement in child\"\n end",
"def fetch_metadata\n self.title ||= biblio_commons.title\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n self.format ||= biblio_commons.format\n end",
"def read(uid)\n object = bucket.objects[uid]\n data = object.read\n meta = Serializer.json_decode(object.metadata[:json])\n [\n data, # can be a String, File, Pathname, Tempfile\n meta # the same meta Hash that was stored with write\n ]\n end",
"def load!\n JSON.load(File.read(@name))\n rescue JSON::ParserError => e\n raise LogFile::LoadError, e.message\n end",
"def parse_metadata(file)\n file_name = File.basename(file)\n puts \"\\n#{Time.now.strftime('%T')} Parsing #{file_name}\" unless Rails.env.test?\n attrs = parser.new(file).attributes\n\n if attrs.blank?\n errors << \"Failed to parse file: #{file_name}\"\n elsif record_exists?(attrs)\n # Don't re-import the record if this record already\n # exists in fedora.\n skipped_imports << file_name\n else\n create_record(attrs.merge(metadata_file: file, visibility: visibility, admin_set: admin_set))\n successful_imports << file_name\n end\n rescue => e\n errors << \"#{file_name}: #{e}\"\n end",
"def api_deserialize_impl(r)\n @is_new = (r).nil?\n r = {} if @is_new\n @is_incomplete = false\n if Saklient::Util::exists_path(r, 'ID')\n @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s\n else\n @m_id = nil\n @is_incomplete = true\n end\n @n_id = false\n if Saklient::Util::exists_path(r, 'Name')\n @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s\n else\n @m_name = nil\n @is_incomplete = true\n end\n @n_name = false\n if Saklient::Util::exists_path(r, 'Description')\n @m_description = (Saklient::Util::get_by_path(r, 'Description')).nil? ? nil : Saklient::Util::get_by_path(r, 'Description').to_s\n else\n @m_description = nil\n @is_incomplete = true\n end\n @n_description = false\n if Saklient::Util::exists_path(r, 'Region')\n @m_region = (Saklient::Util::get_by_path(r, 'Region')).nil? ? nil : Saklient::Cloud::Resources::Region.new(@_client, Saklient::Util::get_by_path(r, 'Region'))\n else\n @m_region = nil\n @is_incomplete = true\n end\n @n_region = false\n end",
"def fetch_details\n @csv_report_job = CsvReportJob.where(id: @csv_report_job_id).first\n\n @filters = @csv_report_job.extra_data[:filters]\n @sortings = @csv_report_job.extra_data[:sortings]\n\n @admin = Admin.get_from_memcache(@csv_report_job.admin_id)\n\n @client_id = @csv_report_job.client_id\n @client = Client.get_from_memcache(@client_id)\n end",
"def initialize(record)\n @record = record\n end",
"def parse_metadata(io)\n current_pos = io.pos\n io.rewind\n \n metadata = {}\n line = io.readline\n unless line =~ /MIME-Version: (\\d+\\.\\d+) \\(Generated by Mascot version (\\d+\\.\\d+)\\)/\n raise \"could not parse mime-version or mascot-version: #{line}\"\n end\n metadata[:mime_version] = $1\n metadata[:mascot_version] = $2\n \n line = io.readline\n unless line =~ /Content-Type: (.*?); boundary=(.*)/\n raise \"could not parse content-type: #{line}\"\n end\n metadata[:content_type] = $1\n metadata[:boundary] = $2\n \n io.pos = current_pos\n metadata\n end",
"def getMnoData \n if @dataType == 'employees_list'\n params = MultiJson.load('{\"engine\":\"hr/employees_list\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'employee_details'\n params = MultiJson.load('{\"engine\":\"hr/employee_details\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'invoices'\n params = MultiJson.load('{\"engine\":\"invoices/list\", \n \"metadata[organization_ids][]\": \"org-fbte\", \n \"metadata[entity]\": \"customers|suppliers\"}')\n else\n raise StandardError\n end \n \n auth = {username: @@username, password: @@password}\n options = {query: params, basic_auth: auth}\n \n @content = HTTParty.get(@@url, options)\n end",
"def fetch(type, fileinfo)\n if fileinfo.type == type\n current = {\n :format => fileinfo.format,\n :version => fileinfo.version,\n :checksum => fileinfo.checksum }\n end\n\n api.node_data(type, FORMATS[type], current)\n end",
"def parse_json\n attributes = JSON.parse(document)\n Omdb::Movie.new(attributes)\n end",
"def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n rows = []\n CSV.foreach(filename, headers: true, col_sep: ',') do |row|\n rows << row.to_hash\n end\n result = rows\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n result = JSON.parse( result.to_json ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"def load_raw_json(json_data)\n temp = Hashie::Mash.new(MultiJson.load(json_data))\n @structure = temp.structure ? temp.structure : Hashie::Mash.new\n @measure_instances = temp.measure_instances ? temp.measure_instances : Hashie::Mash.new\n # these could be set in the file\n @analysis_id = temp.structure.analysis_id if temp.structure.analysis_id\n @user_defined_id = temp.structure.user_defined_id if temp.structure.user_defined_id\n\n return true\n end",
"def readJson(jsonfile, logkey='')\n data_hash = Mcmlln::Tools.readjson(jsonfile)\n return data_hash\nrescue => logstring\n return {}\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def initialize(metadata, fields = {})\n @metadata = JSON.parse(metadata).merge(fields)\n end",
"def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end",
"def parse_file(filename)\n klass = class_name(filename)\n read_file(filename) do |data|\n data = JSON.parse(data, :object_class => Types::Base, :max_nesting => 100)\n store_schema(data) do\n if data.resources # discovery format\n parse_resource(data)\n else\n data_types[klass] = {}\n data_types[klass] = parse_object(data)\n end\n end\n end\n klass\n end",
"def load_json(filename); end",
"def read_from_jobinfo\n data = YAML.load(jobinfo.read)\n @desc = data[:desc]\n @ctime = Timestamp.parse(data[:ctime])\n @mtime = Timestamp.parse(data[:mtime])\n @ppg_filename = data[:ppg_filename]\n end",
"def json_ld; end",
"def fetch_record(pmid) \n pmid_url = self.url + \"?db=pubmed&retmode=xml&rettype=full&id=\"+pmid\n begin\n response = Net::HTTP.get_response(URI.parse(pmid_url))\n rescue\n return false\n end\n return false if response.body.match(\"<ERROR>Empty id list - nothing todo</ERROR>\")\n return response.body\n end",
"def get_attachments_metadata(node)\n files_md = {}\n md_list = FileTableKeys\n md_list.delete(RawContent)\n md_fields = md_list.join(\"`, `\")\n \n model_key = node.my_GlueEnv.model_key\n sql = \"SELECT `#{md_fields}` FROM `#{@file_table_name}`\n WHERE `#{NodeName}` = '#{node.__send__(model_key.to_sym)}'\"\n sth = @dbh.prepare(sql)\n rtn = []\n sth.execute\n while row=sth.fetch do\n rtn << row.to_h\n end\n #rtn\n sth.finish\n objects = rtn\n objects.each do |object|\n obj_md = object \n #speputs \"Obj It: #{obj_md.inspect}\"\n obj_md_file_modified = obj_md[\"modified_at\"]\n obj_md_content_type = obj_md[\"content_type\"]\n new_md = {:content_type => obj_md_content_type, :file_modified => obj_md_file_modified}\n new_md.merge(obj_md) #where does the original metadata go?\n #p new_md.keys\n files_md[obj_md[\"basename\"]] = new_md\n #puts \"Obj METADATA: #{new_md.inspect}\"\n end\n files_md\n end",
"def initialize(row)\n @row_hash = row\n\n @id = row[:id]\n @service = row[:service_name]\n @section = row[:section_name]\n @graph = row[:graph_name]\n @number = row[:number].to_i # NOT NULL DEFAULT 0\n @description = row[:description] || ''\n @sort = row[:sort].to_i # NOT NULL DEFAULT 0\n\n @meta = row[:meta]\n @parsed_meta = JSON.parse(@meta || '{}', :symbolize_names => true)\n\n @created_at_time = Time.at(row[:created_at].to_i)\n @updated_at_time = Time.at(row[:updated_at].to_i)\n end",
"def set_cfr_record\n @cfr_record = CfrRecord.includes( :cfr_locations ).find( params[ :id ])\n end"
] |
[
"0.7291279",
"0.7245152",
"0.67138",
"0.6338884",
"0.6319931",
"0.6259898",
"0.60112524",
"0.5970355",
"0.58653146",
"0.5814023",
"0.58040243",
"0.5630739",
"0.5559458",
"0.54400927",
"0.5402423",
"0.5353813",
"0.53187424",
"0.53108114",
"0.5279091",
"0.52457726",
"0.5221166",
"0.52189624",
"0.52104515",
"0.5194759",
"0.5192107",
"0.51779974",
"0.51736754",
"0.5170425",
"0.5155476",
"0.5154091",
"0.51354104",
"0.5132745",
"0.5126406",
"0.5081797",
"0.5079558",
"0.5077703",
"0.50393206",
"0.50341594",
"0.5033639",
"0.50237745",
"0.49948218",
"0.49847677",
"0.4978469",
"0.49757585",
"0.49698648",
"0.49601278",
"0.4956883",
"0.4953919",
"0.49414355",
"0.49348244",
"0.49166146",
"0.49139985",
"0.49021634",
"0.48961142",
"0.4886417",
"0.48862416",
"0.48745424",
"0.48745424",
"0.48727468",
"0.48705998",
"0.48644033",
"0.48625672",
"0.48590752",
"0.48575962",
"0.48560774",
"0.48534766",
"0.48468512",
"0.48316267",
"0.4822186",
"0.48194888",
"0.48193666",
"0.48160398",
"0.48082307",
"0.47973102",
"0.478019",
"0.4777137",
"0.47722298",
"0.477195",
"0.47718555",
"0.47699955",
"0.4769147",
"0.47620505",
"0.47449377",
"0.47405002",
"0.47276536",
"0.47246054",
"0.4717758",
"0.47126845",
"0.47098792",
"0.47070885",
"0.47022235",
"0.46992105",
"0.46938914",
"0.46865362",
"0.46862614",
"0.4684888",
"0.46839598",
"0.46822762",
"0.46779633",
"0.46732768"
] |
0.66911083
|
3
|
Override to disable heartbeat
|
def run
unless @heartbeat_type == :none
super
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shutdown\n\t\tself.stop_heartbeat\n\t\tsuper\n\tend",
"def stop_heartbeat\n\t\tself.reactor.remove_timer( @heartbeat_timer )\n\tend",
"def restart\n\t\tself.stop_heartbeat\n\t\tsuper\n\t\tself.start_heartbeat\n\tend",
"def heartbeat\n end",
"def cancel_heartbeat(&blk)\n raise 'This API endpoint cannot be used over HTTP.' unless block_given?\n\n websocket.subscribe :cancelheartbeat, &blk\n end",
"def heartbeat_timeout; Float::INFINITY; end",
"def setup_heartbeat_timer; end",
"def raise_heartbeat_event\n raise_event(HeartbeatEvent.new(self))\n end",
"def disable\n end",
"def disable(patch)\n @socket.disable\n end",
"def stop_polling!; end",
"def keep_alive=(enable); end",
"def disable_polling(reason = nil)\n self.deactivate\n self.deactivation_reason = reason.to_s\n self.deactivated_at = Time.now\n self.save!\n end",
"def disable\n if offline? && @state != :created\n Log.info(\"[offline] Connection to broker re-established\")\n @offline_stats.finish\n cancel_timer\n @state = :flushing\n # Wait a bit to avoid flooding the mapper\n EM.add_timer(rand(MAX_QUEUE_FLUSH_DELAY)) { flush }\n end\n true\n end",
"def unheartbeat(service_name)\n Thread.kill @@heartbeats[service_name]\n end",
"def ignore_disconnect; end",
"def default_task_heartbeat_timeout; Float::INFINITY; end",
"def disable\n {\n method: \"Performance.disable\"\n }\n end",
"def disable_threshold\n @enable_threshold = false\n end",
"def disable_offline_mode\n @offline_handler.disable if @options[:offline_queueing]\n end",
"def heartbeat_timeout\n data.heartbeat_timeout\n end",
"def disable\n @enabled = false\n end",
"def disable!\n @enabled = false\n end",
"def disable\n @queue << \"disable\"\n end",
"def handle_heartbeat_ack(_payload)\n @heartbeat_acked = true\n end",
"def disable!\n self.enabled = false\n end",
"def reset_on_timeout_state\n super\n end",
"def enable_heartbeat(interval = 60, &blk)\n raise 'This API endpoint cannot be used over HTTP.' unless block_given?\n\n websocket.subscribe :setheartbeat, params: { interval: interval }, &blk\n end",
"def disabled; end",
"def disable!\n @enabled = false\n end",
"def set_heartbeat_timer(buffer)\n # Cancel @disconnect_timer.\n SockJS.debug \"Cancelling @disconnect_timer as we're about to send a heartbeat frame in 25s.\"\n @disconnect_timer.cancel if @disconnect_timer\n @disconnect_timer = nil\n\n @alive_checker.cancel if @alive_checker\n\n # Send heartbeat frame after 25s.\n @heartbeat_timer ||= EM::Timer.new(25) do\n # It's better as we know for sure that\n # clearing the buffer won't change it.\n SockJS.debug \"Sending heartbeat frame.\"\n begin\n self.finish\n rescue Exception => error\n # Nah these exceptions are OK ... let's figure out when they occur\n # and let's just not set the timer for such cases in the first place.\n SockJS.debug \"Exception when sending heartbeat frame: #{error.inspect}\"\n end\n end\n end",
"def reenable_on_interrupt; end",
"def inactive_message; end",
"def inactive_message; end",
"def disable_close()\n #This is a stub, used for indexing\n end",
"def disable!\n @disabled = true\n end",
"def disable\n redis.set(flag_key, 0)\n end",
"def silence_single_worker_warning; end",
"def disable\n @disabled = true\n end",
"def poll_heartbeat_timeout\n now = Hastur::Util.timestamp\n delta = now - @last_heartbeat\n\n # perform heartbeat check\n if delta > @heartbeat\n @logger.debug \"Sending heartbeat\"\n\n msg = Hastur::Message::HB::Agent.new(\n :from => @uuid,\n :data => {\n :name => \"hastur.agent.heartbeat\",\n :value => delta,\n :timestamp => now,\n :labels => {\n :version => Hastur::SERVER_VERSION,\n :period => @heartbeat,\n }\n }\n )\n _send(msg)\n\n @last_heartbeat = now\n end\n end",
"def untick; end",
"def setup_heartbeat_timer\n @heartbeat_timer ||= event_loop.timer(BEAT_INTERVAL) do\n event_loop.post { connections.each(&:beat) }\n end\n end",
"def disabled!\n self\n end",
"def disable!\n tracers.each(&:disable!)\n end",
"def disable\n\n @enabled = false\n\n return self\n\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def disable\n @service.disabled = true\n end",
"def with_force_shutdown; end",
"def ignore_disconnect=(_arg0); end",
"def client_disconnected\n end",
"def heartbeat_command\n logger.debug(\"heartbeat_command: enter \")\n logger.debug(client.observers_overview.join(\", \"))\n begin\n client.refresh_observers_if_needed\n client.update_cluster if client.status == :down\n client.get(\"foo\")\n rescue Exception => e\n client.status = :down\n logger.debug \"heartbeat - #{e.message} #{e.backtrace}\"\n end\n sleep freq\n end",
"def handshake_timeout\n super\n end",
"def heartbeat\n request(Resources::RESOURCE_HEARTBEAT, HTTP_METHOD_POST)\n end",
"def bridge_in_standby_state\n super\n end",
"def unclean_shutdown_mode\n super\n end",
"def shutdown\n super\n end",
"def reset_liveness_timer\n @liveness_timer.cancel if @liveness_timer\n @liveness_timer = EventMachine::Timer.new(connection.heartbeat_interval + 0.1) do\n if connection.connected? && (connection.time_since_connection_confirmed_alive? >= connection.heartbeat_interval)\n msg = \"No activity seen from realtime in #{connection.heartbeat_interval}; assuming connection has dropped\";\n error = Ably::Exceptions::ConnectionTimeout.new(msg, Ably::Exceptions::Codes::DISCONNECTED, 408)\n connection.transition_state_machine! :disconnected, reason: error\n end\n end\n end",
"def inherit(node)\n ping.remove\n super\n end",
"def disable_until_finished_or_interrupted; end",
"def heartbeat\n me = WORKER_TEMPLATE.dup\n me['name'] = id\n @heartbeat_entry ||= write(me, @heartbeat_refresh + 10)\n @heartbeat_entry.renew(@heartbeat_refresh) unless @heartbeat_entry.canceled?\n end",
"def start_heartbeat\n\t\tself.log.info \"Starting heartbeat timer.\"\n\t\t@heartbeat_timer = self.reactor.add_periodic_timer( self.class.heartbeat_rate ) do\n\t\t\tself.cull_idle_sockets\n\t\t\tself.ping_all_sockets\n\t\tend\n\tend",
"def keep_alive= enable\n @agent.keep_alive = enable\n end",
"def stop_periodic_timers; end",
"def before_shutdown\n end",
"def before_shutdown\n end",
"def disabled_warnings; end",
"def start_heartbeat\n @hb_received_at = Time.now\n send_heartbeat\n @heartbeat_timer = @reactor.periodical_timer(@heartbeat_interval) { send_heartbeat }\n end",
"def wake_up()\n # Do nothing by default\n end",
"def start_timed_out\n end",
"def signal_server_down\n interrupt_server_polling_sleep\n nil\n end",
"def setnonblocking(enabled)\n\t\tsingleton_class.async_send_api = !enabled\n\t\tself.flush_data = !enabled\n\t\tsync_setnonblocking(true)\n\tend",
"def disable\n Puppet.notice \"Disabling Puppet.\"\n lockfile.lock(:anonymous => true)\n end",
"def keep_alive; end",
"def keep_alive; end",
"def handle_heartbeat(packet)\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def shutdown\n super\n end",
"def disable\n {\n method: \"WebAudio.disable\"\n }\n end",
"def disable_after_run_callback\n @after_run_callback_disabled = true\n end",
"def receive_disabled\n\n wrap_reply('disable' => Flor.true?(payload['ret']))\n end",
"def failsafe_timeout\n super\n end",
"def disable(&block)\n @disable_block = block\n end",
"def wakeup!(client); end",
"def heartbeat_frame\n OnStomp::Components::Frame.new\n end",
"def wakeup; end",
"def disabled?\n self.time_event <= Time.now\n end",
"def wake_event_loop!\n super\n end",
"def wake_event_loop!\n super\n end",
"def alert_timeout\n super\n end",
"def disable!\n swap_out_delegator\n end",
"def without_reconnect(&block); end",
"def disable\n admin_only do\n handle_recurring_schedule_failure 'disable', 'disabled' do\n # get the schedule object to be disabled.\n @test = get_test_with_rescue\n @test.active = nil\n @test.save!\n end\n redirect_to action: \"index\"\n end\n end",
"def inherited( subclass )\n\t\t\tsuper\n\t\t\tsubclass.instance_variable_set( :@idle_timeout, self.idle_timeout.dup )\n\t\t\tsubclass.instance_variable_set( :@heartbeat_rate, self.heartbeat_rate.dup )\n\t\tend",
"def disable\n redis.hset(FeatureGuard.flags_hkey, feature_name, 0)\n end",
"def with_background_worker_disabled(&block)\n original_background_worker_threads = configuration.background_worker_threads\n configuration.background_worker_threads = 0\n\n block.call\n ensure\n configuration.background_worker_threads = original_background_worker_threads\n end"
] |
[
"0.7354459",
"0.7045265",
"0.6943713",
"0.6819915",
"0.68168664",
"0.67524",
"0.67507195",
"0.63720876",
"0.6358187",
"0.6228595",
"0.62069905",
"0.61533964",
"0.61050314",
"0.6088258",
"0.60571915",
"0.6044343",
"0.60402095",
"0.60318863",
"0.59869087",
"0.5922061",
"0.591078",
"0.5872054",
"0.5862743",
"0.5860136",
"0.58548754",
"0.584596",
"0.583209",
"0.58235425",
"0.580531",
"0.5796206",
"0.5785189",
"0.5702438",
"0.56737447",
"0.56737447",
"0.5669665",
"0.5658096",
"0.5655377",
"0.5650494",
"0.5649034",
"0.5648028",
"0.56398666",
"0.56397206",
"0.5631872",
"0.5617465",
"0.5617128",
"0.56157285",
"0.5612912",
"0.56098473",
"0.55999446",
"0.5599839",
"0.5599031",
"0.5599029",
"0.5587768",
"0.5579577",
"0.5577363",
"0.55746746",
"0.5573873",
"0.5573797",
"0.5547161",
"0.5546363",
"0.55325025",
"0.5530434",
"0.5525332",
"0.55166584",
"0.55166584",
"0.5515531",
"0.55138195",
"0.5504807",
"0.549652",
"0.54929423",
"0.54870546",
"0.54793143",
"0.5469299",
"0.5469299",
"0.5468899",
"0.5465948",
"0.5465948",
"0.5465948",
"0.5465948",
"0.5465948",
"0.5465948",
"0.5465948",
"0.5464293",
"0.5463904",
"0.54636425",
"0.5460883",
"0.5457783",
"0.54467213",
"0.54350334",
"0.54343235",
"0.54287523",
"0.5428332",
"0.5428332",
"0.54101264",
"0.54084885",
"0.53959686",
"0.53868496",
"0.5383996",
"0.53822917",
"0.5377632"
] |
0.7274086
|
1
|
Override: I change weight algorithm
|
def rebuild_weight_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def weight; end",
"def set_weights(weights); self;end",
"def update_weights\n @weights_set.each_weights_with_index do |weights, i|\n weights.each_with_index do |wl, j|\n wl.each_with_index do |w, k|\n wl[k] = w - (@learning_rate * @layers[i].nodes[j].this_output * @layers[i+1].nodes[k].this_backward_output)\n end\n end\n end\n end",
"def weight\n 0\n end",
"def update_weight(target, ouput, weight)\n @eta * (target - output) * weight\n end",
"def reduce_weight \n @weight -= WEIGHT_INCREMENT\n # increment could be confusing and imply an increase rather than a decrease \n # but it is being reduced by increments of 10 so it makes sense??? \n # It's the best of the names that came to mind.\n end",
"def weight\n 2 # ounces\n end",
"def weight\n if !block_given?\n return @j_del.java_method(:weight, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling weight()\"\n end",
"def weight\n if !block_given?\n return @j_del.java_method(:weight, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling weight()\"\n end",
"def weight=(value)\n @weight = value\n end",
"def weight(i, j)\n return 1\n end",
"def weight_adjustment \n options.inject(0.0){|m,x| m + (x.weight_adjustment || 0.0)} \n end",
"def addweight(w)\n @weight += w\n end",
"def num_weights(); 0;end",
"def weight w=nil\n if w.nil?\n @weight\n else\n @weight = w\n end\n end",
"def weighting\n self.class.weighting\n end",
"def set_weights(weights)\r\n # Current index of 'weights'\r\n index = -1\r\n # There might be a better way to do this...\r\n @layers.each do |layer|\r\n layer = layer.map {index += 1; weights[index]} \r\n end\r\n # Update attributes.\r\n weights\r\n # Return self to facilitate method chaining.\r\n self\r\n end",
"def train\n @weights.each_index do |i| \n # alter weight and apply momentum\n @weights[i] = @weights[i] + (@rate * inputs[i] * @gradient)\n @weights[i] = @weights[i] + @momentum * @lastchange\n \n @lastchange = @rate * inputs[i] * @gradient\n end\n @weights\n end",
"def weight\n @graph.weight(source, target)\n end",
"def currentWeight() weighins.last.weight end",
"def adjustable_weighting\n @adjustable ? @weighting : 0\n end",
"def weight\n return @weight\n end",
"def calculate_weight\n update_attribute :weight, votes.sum(:value)\n weight\n end",
"def weight\n @mass * @hopper.size\n end",
"def minweight(w)\n @weight = w if w<@weight\n end",
"def initialize_weight_change\n @previous_weight_changes = initialize_weight_matrix(Proc.new { |a,b,c| 0.0 })\n end",
"def calc_total_weight\n 0\n end",
"def optimize(weight)\r\n return 0 if weight <= 0\r\n\r\n best = nil\r\n $items.each do |item|\r\n c = optimize(weight - item.weight) + item.cost\r\n best = c if best.nil? || c < best\r\n end\r\n best\r\nend",
"def weight\n sides.map(&:weight).reduce(&:+)\n end",
"def apply_weighting(clazz, loss, weight = nil, sample_weight = nil)\n unless sample_weight.nil?\n loss = clazz.broadcast_mul(loss, sample_weight)\n end\n unless weight.nil?\n raise ArgumentError, 'weight must be numeric' unless weight.is_a?(Numeric)\n loss *= weight\n end\n loss\n end",
"def weight\n product_weight * quantity\n end",
"def weight\n product_weight * quantity\n end",
"def mutate\n @weights = (1..@size).map { Random.rand(-0.5..0.5) }\n end",
"def weight\n puts 'used custom getter'\n 2\n end",
"def compute_weight object\n object.line_items.map { |li| (li.variant.weight || 0) * li.quantity }.sum\n end",
"def getNodeWeights()\n # (two possible sources: flipped and negated, so \n # add them for each node)\n \n tabRead(@edges){|arr|\n ordered = [arr[0],arr[2]].sort\n @allEdgeWeightScores[ordered.join(\"--\")] += arr[3].to_f\n @nodeList[arr[0]] = 1\n @nodeList[arr[2]] = 1\n }\nend",
"def calculate_weighted_sum(base, weight_factors); end",
"def maxweight(w)\n @weight = w if w>@weight\n end",
"def weighted_score\n score * metric.weight\n end",
"def calc_weight(mod, acc)\n fuel = calc_fuel(mod)\n fuel <= 0 ? acc : calc_weight(fuel, acc + fuel)\nend",
"def weight_function\n\t\tif @weightFunction != nil\n\t\t\t@weightFunction\n\t\telse\n\t\t\tlambda do |u,v|\n\t\t\t\t@edgeSet.each{|f| return f.weight if (f.s==u && f.d == v)}\n\t\t\t\treturn nil\n\t\t\tend\n\t\tend\n\tend",
"def weightPolls()\n\n end",
"def weight\n return data.weight\n end",
"def weight\n @parents.inject(1) { |res, p| res + p.weight * @parent_multiplier }\n end",
"def original_weight\n @original_weight ||= (1.0 / (wrapper1.render.length * wrapper2.render.length))\n end",
"def weight_adjustment_inputs(inputs,dendrites)\n\tfor i in 0...inputs.size\n\t\tnew_weights=Array.new\n\t\told_weights=Array.new\n\t\told_weights=dendrites[i].print_weight\n\t\tfor j in 0...old_weights.size\n\t\t\tnew_weights.push(inputs[i]*(1-inputs[i])*old_weights[j])\n\t\tend\n\t\tdendrites[i].adjust_weight(new_weights)\n\tend\n\tend",
"def weight(connections)\n\t\tweight_array=Array.new\n\t\tfor x in 0...connections.size \n\t\tweight_array[x]=(rand() * (rand(3)-1))\n\t\tend\n\t\t@weights = weight_array\n\tend",
"def weight\n options.reduce(0) { |memo, option| option.weight > 0 ? memo + option.weight : memo }\n end",
"def weighted_score\n return nil if self.points.nil?\n self.points * self.weighting / self.maximum_points\n end",
"def update_factor_weight(factor_name,weight)\n index = get_element_index(rand_factors, factor_name)\n factor_weights[index].set weight\n save.click\n end",
"def weight(index)\n index.nil? ? 0 : (FIRST_INTEGER_WEIGHT - index)\n end",
"def weight(connections)\n\t\t\tweight_array=Array.new\n\t\t\tfor x in 0...connections.size \n\t\t\t\tweight_array[x]=(rand() * (rand(3)-1))\n\t\t\tend\n\t\t\t@weights = weight_array\n\t\tend",
"def product_weight\n price_calculator.weight\n end",
"def set_weight(provider, weight, safe=true)\n get_yn(\"You're about to modify the weight of #{provider} to #{weight} are you sure (Y|N)?\") unless safe == false\n # do it\n @nodes.each do |node|\n old_weight = @weights[node][provider]['weight']\n address = @weights[node][provider]['address']\n\n if weight == old_weight\n puts \"** node #{node} weight is already #{old_weight} no change made\"\n else\n path = \"GSLBRegionPoolEntry/#{@zone}/#{node}/global/#{address}\"\n puts \"** setting weight = #{weight} on #{path}\"\n @dyn.put(path, { \"weight\" => weight })\n\n eventinate(\"modified weight of #{provider} to #{weight} for '#{node}'\")\n end\n end\n\n puts \"\"\n\n # fetch the updated values from dyn\n @weights = fetch_weights\n end",
"def increment_by(node, weight)\n raise ArgumentError.new('please use #decrement_by') if weight < 0\n change_by node, weight\n end",
"def weightedsum\n ws = 0\n @inputs.each_index { |i| ws = ws + @inputs[i]*@weights[i] }\n ws\n end",
"def activate\n @output = (1.0 / (1.0 + Math.exp(-1 * self.weightedsum - @bias)))\n @output\n end",
"def promote!( instance )\n # STDERR.puts \"Promoting: old weights => #{@model.weights.join(\",\")}\"\n # For every feature/attribute present, promote the corresponding weight\n instance.each_index{ |ii| @model.weights[ii] *= @alpha if instance[ii] }\n #STDERR.puts \"\\tnew weights => #{@model.weights.join(\",\")}\"\n end",
"def weight\n order_lines.inject(0) { |sum, l| sum + l.weight }\n end",
"def compute_weights\n\t\t@weight = Hash.new\n\t\t\n\t\t@terms.each do |term|\n\t\t\t@doc_list.values.each do |doc|\n\t\t\t\tvalue = doc.freq_rel(term) * @idf[term]\n\t\t\t\t@weight[[term,doc]] = value\n\n\t\t\t\tassert { value >= 0 }\n\t\t\tend\n\t\tend\n\tend",
"def imperialize(params)\n self.weight = (params[:weight].to_f * 0.00220462).round(2)\n self.height = (params[:height].to_f / 2.54).round(2)\n self.depth = (params[:depth].to_f / 2.54).round(2)\n self.width = (params[:width].to_f / 2.54).round(2)\n end",
"def path_weight_to(other)\n shortest_path_to(other,:method => :djikstra).map{|edge| edge.weight.to_f}.sum\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def weight(u, v)\n @weights[[u,v]]\n end",
"def weight_until_goal\n if weigh_ins.count > 0 && goal_weight > 0\n weigh_ins.first.current_weight - goal_weight\n elsif goal_weight > 0\n start_weight - goal_weight\n end\n end",
"def calc_total_weight\n @weight + @node_link.calc_total_weight\n end",
"def init_weight\n # (J, 1)\n @b = Matrix.columns([Array.new(@size) { 0.0 }])\n\n # (J, I)\n @W = Array.new(@J) do\n Array.new(@I) { Sabina::Utils.box_muller }\n end.tap { |ary| break Matrix[*ary] }\n end",
"def set(node, weight)\n change_by node, nil, weight\n end",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def weight\n (kyc_level == 'any' ? 0 : 10) + (group == 'any' ? 0 : 1)\n end",
"def has_weight(weight)\n @weight = weight\n end",
"def weight\n if box\n box.weight * self.quantity\n else\n raise \"Weight not known.\"\n end\n end",
"def adjustWeights(theTop)\n\n # The nonterminals are processed one by one.\n\n @ntIndex.each do |nonTerm, rSet| # nonTerm is used for debugging if needed.\n\n # Variable rules is an Array of Rules indexes.\n\n rules = rSet[:rules]\n\n # The first special case is when there is only one Rule for the\n # nonterminal. In that case, its weight is just the top weight\n # regardless of what it was before.\n\n if rules.length == 1\n @ruleTable[rules[0]][:weight] = theTop\n next\n end\n\n # Now we know that there are at least two rules. Find the maximum \n # weight from all of them.\n\n max = 0.0\n rules.each do |i|\n x = @ruleTable[i][:weight]\n max = x if max < x\n end\n\n # The second special case occurs when the maximum value is zero. That\n # means all the values are zero. In this case, we can just replace them\n # all with the top weight and go process the next nonterminal\n\n if max == 0.0\n rules.each { |i| @ruleTable[i][:weight] = theTop }\n next\n end\n\n # Now we know that there are at least two weights and that at least one\n # is not zero. Every weight will be multiplied by the ratio top/max.\n # This will make the maximum weight top and all the others smaller.\n # There may still be some zeros left and we will take care of those in a\n # moment.\n\n ratio = theTop.to_f/max\n rules.each { |i| @ruleTable[i][:weight] *= ratio }\n\n # AD HOC: Finally, make sure that no rule has a weight less than\n # 1/100-th of the top weight. By using the ceiling, we ensure\n # that this is at least 1 even for small top values. This step\n # eliminates any zeros.\n #\n # HACK: Eventually replace this with Good-Turing estimation.\n\n lowest = (0.01*theTop).ceil\n rules.each do |i|\n @ruleTable[i][:weight] = lowest if @ruleTable[i][:weight] < lowest \n end\n\n end\n \n # Now we have to reset all the weight totals so the grammar follows the\n # weight rules.\n\n @ntIndex.each_value do |v|\n total = 0\n v[:rules].each { |i| total += @ruleTable[i][:weight] }\n v[:total] = total\n end\n\n end",
"def assign(n, w)\n sum = w.inject(0) { |s, (k,v)| s + v }\n if (sum - 1.0).abs > 1e-6\n raise ArgumentError, \"Weights do not sum to 1: #{w.inspect}\"\n end\n @weights[n] = w.collect { |k,v| [k, v] }.sort { |a,b| a[1] <=> b[1] }\n end",
"def optimize3(weight, cost=0, items = $items)\r\n return cost if weight <= 0 || items.empty?\r\n # puts \"#{weight}\\t#{cost}\\t#{items.collect{|i| i.weight}.join(' ')}\"\r\n same_ratio = items.find_all { |i| i.ratio == items[0].ratio }\r\n global_best = nil\r\n same_ratio.size.times do |x|\r\n if weight % items[x].weight == 0\r\n return items[x].cost * (weight / items[x].weight) + cost\r\n end\r\n \r\n best = (x == 0) ? items[x].cost * (weight / items[x].weight + 1) + cost : nil\r\n \r\n (items - [items[x]]).each do |item|\r\n if x == 0\r\n c = optimize3(weight % items[x].weight, items[x].cost * (weight / items[x].weight) + cost, items - [items[x]])\r\n else\r\n c = optimize3(weight - items[x].weight, items[x].cost + cost, items)\r\n end\r\n best = c if (best.nil? || c < best)\r\n end\r\n global_best = best if best && (global_best.nil? || best < global_best)\r\n end\r\n global_best\r\nend",
"def compute_weights\n @weight = Hash.new\n \n @terms.each do |term|\n @doc_list.values.each do |doc|\n value = doc.freq_rel(term) * @idf[term]\n @weight[[term,doc]] = value\n\n assert { value >= 0 }\n end\n end\n end",
"def weight\n\t\tweight = 0\n\t\tself.order_line_items.each do |item|\n\t\t\tweight += item.quantity * item.product.weight\n\t\tend\n\t\treturn weight\n\tend",
"def weighted_probability(word)\n word = (Word === word ? word : get(word))\n\n p = BigDecimal.new(1)\n p = p * probability(word)\n p = p * file_probability(word, 1)\n #p = p * lexicon_weight(word)\n #p = p * weight_length(word)\n #p = p * weight_stem(word)\n #p = p * weight_plural(word)\n p\n end",
"def weight\n @weight || @confines.length\n end",
"def boost\n 1.0 #self.rating / 2.0\n end",
"def weight_in_stones\n\t\t((@weight * 2.20462) / 14).to_i\n\tend",
"def initialize\n @weights = { count: {}, first: {}, next: {}, last: {} }\n end",
"def weight\n self.ingredients.map{|i| i.quantity}.reduce(:+)\n end",
"def update!(**args)\n @discrete_weight = args[:discrete_weight] if args.key?(:discrete_weight)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n @discrete_weight = args[:discrete_weight] if args.key?(:discrete_weight)\n @id = args[:id] if args.key?(:id)\n end",
"def knapsack(weights, values, capacity)\n\n end",
"def set_Weight(value)\n set_input(\"Weight\", value)\n end",
"def set_Weight(value)\n set_input(\"Weight\", value)\n end",
"def smoothing; end",
"def weights(server, backend, weight=nil)\n if(weight.nil?)\n weight = @socket.execute \"get weight #{backend}/#{server}\"\n /(\\d*)\\s\\(initial\\s(\\d*)\\)/.match( weight[0])\n {:current => $1.to_i, :initial => $2.to_i}\n else\n @socket.execute \"set weight #{backend}/#{server} #{weight}\"\n end\n end",
"def weights(server, backend, weight=nil)\n if(weight.nil?)\n weight = @socket.execute \"get weight #{backend}/#{server}\"\n /(\\d*)\\s\\(initial\\s(\\d*)\\)/.match( weight[0])\n {:current => $1.to_i, :initial => $2.to_i}\n else\n @socket.execute \"set weight #{backend}/#{server} #{weight}\"\n end\n end",
"def molecular_weight\n Bio::AminoAcid.weight(self)\n end",
"def get_weight( nbr )\n @connected_to[ nbr ]\n end",
"def show_weight_label_method\n \"#{self.weight}\"\n end",
"def train(inputs, desired)\n # Guess the result\n guess = feedforward(inputs)\n # Compute the factor for changing the weight based on the error\n # Error = desired output - guessed output\n # Note this can only be 0, -2, or 2\n # Multiply by learning constant\n error = desired - guess\n # Adjust weights based on weightChange * input\n @weights.collect!.with_index { |w, i| w + error * inputs[i] }\n end",
"def weight(text)\n weight = @emphasis[:multiplier]\n\n if text.length >= @emphasis[:long_words_threshold]\n weight *= @emphasis[:long_words]\n end\n\n if text[0,1] == text[0,1].upcase\n weight *= @emphasis[:upper_case]\n end\n\n weight += vowels(text)\n weight += consonants(text)\n weight\n end",
"def boost_change\n if @boost == 5\n @boost = 3\n else\n @boost += 1\n end\n end"
] |
[
"0.7771894",
"0.7350258",
"0.73358625",
"0.72151726",
"0.72122884",
"0.7201554",
"0.71247655",
"0.69367415",
"0.69367415",
"0.6872903",
"0.68283975",
"0.6809486",
"0.67984533",
"0.6765138",
"0.6759455",
"0.66842264",
"0.668246",
"0.6656651",
"0.6633924",
"0.6616403",
"0.6559231",
"0.65532523",
"0.65450686",
"0.65003943",
"0.6480426",
"0.6477518",
"0.6468806",
"0.6457179",
"0.6442243",
"0.6364629",
"0.63555205",
"0.63555205",
"0.6332563",
"0.6314097",
"0.6311005",
"0.6288776",
"0.6283909",
"0.6283506",
"0.62777334",
"0.6276302",
"0.6250263",
"0.624063",
"0.6221741",
"0.6218239",
"0.6199678",
"0.6188897",
"0.6181615",
"0.61744636",
"0.6159259",
"0.6154803",
"0.6141378",
"0.6136017",
"0.613301",
"0.6126205",
"0.61134225",
"0.60830534",
"0.60825765",
"0.6076334",
"0.6070164",
"0.60427964",
"0.6033912",
"0.60168296",
"0.60074425",
"0.60074425",
"0.5998821",
"0.5982549",
"0.59763557",
"0.5967973",
"0.5967544",
"0.5965236",
"0.5965236",
"0.5965236",
"0.59430957",
"0.5937738",
"0.59262604",
"0.5916976",
"0.5913738",
"0.5913445",
"0.5907584",
"0.5902872",
"0.5902851",
"0.58996373",
"0.5881868",
"0.5880026",
"0.5879101",
"0.5869368",
"0.5831543",
"0.5831543",
"0.5824323",
"0.5819773",
"0.5819773",
"0.58184063",
"0.58087176",
"0.58087176",
"0.5804578",
"0.58006006",
"0.57924044",
"0.57872653",
"0.5772761",
"0.5758125"
] |
0.66801476
|
17
|
This is just a partial copy from ForwardOuputrebuild_weight_array
|
def build_weight_array(nodes)
weight_array = []
gcd = nodes.map {|n| n.weight }.inject(0) {|r,w| r.gcd(w) }
nodes.each {|n|
(n.weight / gcd).times {
weight_array << n
}
}
weight_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rebuild_weight_array\n end",
"def init_weight\n # (J, 1)\n @b = Matrix.columns([Array.new(@size) { 0.0 }])\n\n # (J, I)\n @W = Array.new(@J) do\n Array.new(@I) { Sabina::Utils.box_muller }\n end.tap { |ary| break Matrix[*ary] }\n end",
"def initialize_weight_change\n @previous_weight_changes = initialize_weight_matrix(Proc.new { |a,b,c| 0.0 })\n end",
"def update_weights\n @weights_set.each_weights_with_index do |weights, i|\n weights.each_with_index do |wl, j|\n wl.each_with_index do |w, k|\n wl[k] = w - (@learning_rate * @layers[i].nodes[j].this_output * @layers[i+1].nodes[k].this_backward_output)\n end\n end\n end\n end",
"def zero_one_bottom_up(w, c, max_weight)\n n = w.length\n r = Array.new(n+1) { Array.new(max_weight+1) }\n (0..n).each do |i|\n (0..max_weight).each do |j|\n if j == 0 || i == 0\n r[i][j] = 0\n elsif w[i-1] > j\n r[i][j] = r[i-1][j]\n else\n r[i][j] = [c[i-1] + r[i - 1][j - w[i - 1]], r[i - 1][j]].max\n end\n end\n end\n r\n end",
"def initialize\n @x = Array.new\n @y = Array.new\n @output = Array.new\n @weights = [0.0001,0.0001,0.0001]\n end",
"def weights\n return @weights if @weights\n return @weights = [] if array.empty?\n\n lo = edges.first\n step = edges[1] - edges[0]\n\n max_index = ((@max - lo) / step).floor\n @weights = Array.new(max_index + 1, 0)\n\n array.each do |x|\n index = ((x - lo) / step).floor\n @weights[index] += 1\n end\n\n return @weights\n end",
"def compute_weights\n\t\t@weight = Hash.new\n\t\t\n\t\t@terms.each do |term|\n\t\t\t@doc_list.values.each do |doc|\n\t\t\t\tvalue = doc.freq_rel(term) * @idf[term]\n\t\t\t\t@weight[[term,doc]] = value\n\n\t\t\t\tassert { value >= 0 }\n\t\t\tend\n\t\tend\n\tend",
"def zero_weight_update_values\n weight_update_values = []\n 26.times do weight_update_values << 0.0 end\n\n weight_update_values\n end",
"def mutate\n @weights = (1..@size).map { Random.rand(-0.5..0.5) }\n end",
"def num_weights(); 0;end",
"def set_weights(weights); self;end",
"def weight; end",
"def weight_adjustment_outputs(learning_rate,synapse,output_desired,neurons_array)\n\t\n\tfor i in 0...neurons_array.size\n\t\tdelta=Array.new\t\n\t\tfor j in 0...synapse.size \n\t\tdelta.push(-2*learning_rate*(synapse[j].print_value - output_desired[j])*synapse[j].print_value*(1-synapse[j].print_value)*neurons_array[i].print_value)\n\t\tend\n\t\tneurons_array[i].adjust_weight(delta)\n\tend\nend",
"def set_weights(weights)\r\n # Current index of 'weights'\r\n index = -1\r\n # There might be a better way to do this...\r\n @layers.each do |layer|\r\n layer = layer.map {index += 1; weights[index]} \r\n end\r\n # Update attributes.\r\n weights\r\n # Return self to facilitate method chaining.\r\n self\r\n end",
"def weight(connections)\n\t\tweight_array=Array.new\n\t\tfor x in 0...connections.size \n\t\tweight_array[x]=(rand() * (rand(3)-1))\n\t\tend\n\t\t@weights = weight_array\n\tend",
"def normalize_weights_array(rules)\n weight_total = rules.map { |rule| rule[:weight] }.reduce(0.0, &:+)\n rules.each do |rule|\n rule[:weight] = rule[:weight] / weight_total\n end\n end",
"def update_weight(target, ouput, weight)\n @eta * (target - output) * weight\n end",
"def weights_as_array() weighins.pluck(:created_at, :weight).map {|d,w| {\"created_at\" => d, \"weight\" => w}} end",
"def build_new_layer layer_size, input_layer, weights\n next_layer = Array.new(layer_size, 0)\n\n (0...weights.size).each do |index|\n combined_array = input_layer.zip(weights[index])\n z_value = combined_array.map{|v,w| v*w}.inject(:+)\n activation = sigmoid(z_value)\n next_layer[index] = activation\n end\n\n next_layer\n end",
"def compute_weights\n @weight = Hash.new\n \n @terms.each do |term|\n @doc_list.values.each do |doc|\n value = doc.freq_rel(term) * @idf[term]\n @weight[[term,doc]] = value\n\n assert { value >= 0 }\n end\n end\n end",
"def remove_all()\n @field_weights = Array.new\n end",
"def weights()\r\n @weights = @layers.map {|layer| layer.to_a}.flatten\r\n @num_weights = @weights.size\r\n return @weights\r\n end",
"def original_weight\n @original_weight ||= (1.0 / (wrapper1.render.length * wrapper2.render.length))\n end",
"def weighted_random_index(array)\n\nend",
"def getNodeWeights()\n # (two possible sources: flipped and negated, so \n # add them for each node)\n \n tabRead(@edges){|arr|\n ordered = [arr[0],arr[2]].sort\n @allEdgeWeightScores[ordered.join(\"--\")] += arr[3].to_f\n @nodeList[arr[0]] = 1\n @nodeList[arr[2]] = 1\n }\nend",
"def initializeWeights\n @matrixWeights = Array.new\n @umbral = Array.new\n for i in 0..@numNeuronas-1\n aux = Array.new\n for j in 0..@numEntradas-1\n aux << (2*0.05*rand-0.05)\n end\n @matrixWeights << aux\n @umbral << (2*0.05*rand-0.05)\n end\n end",
"def weight_adjustment \n options.inject(0.0){|m,x| m + (x.weight_adjustment || 0.0)} \n end",
"def apply_usage_weights(word_hash)\n max_usage = @word_list.values.max.to_f\n max_usage = 1 if max_usage == 0\n\n weighted_array = word_hash.map do |word, bigram_score|\n usage_score = @word_list[word].to_f / max_usage\n [word, (bigram_score * (1 - @alpha)) + (usage_score * @alpha)]\n end\n\n Hash[weighted_array]\n end",
"def anything\n EDGE_LIST.each do |record|\n from, to, weight = record\n @adj_matrix[from.id][to.id] = weight\n @adj_matrix[to.id][from.id] = weight\n end\n end",
"def weight(connections)\n\t\t\tweight_array=Array.new\n\t\t\tfor x in 0...connections.size \n\t\t\t\tweight_array[x]=(rand() * (rand(3)-1))\n\t\t\tend\n\t\t\t@weights = weight_array\n\t\tend",
"def size=(size)\n dif = size - @size\n dif < 0 ? @weights.pop(-dif) : @weights.push(Array.new(dif, 0)).flatten!\n dif < 0 ? @inputs.pop(-dif) : @inputs.push(Array.new(dif, 0)).flatten!\n @size = size\n end",
"def fill_path_weights\r\n\r\n #for each vertex, each level, find the shortest path to every node from that node and then add that data to path_weights\r\n hashkeys = @vertices.keys\r\n hashkeys.each do |n|\r\n @current_world.rooms.each {\r\n |key, value|\r\n vertex = Vertex.new(key,value)\r\n @vertices[key] = vertex\r\n }\r\n\r\n vertex = @vertices[n]\r\n return_shortest_path(vertex)\r\n vertices2 = @vertices.clone\r\n @path_weights[vertex.title]=vertices2\r\n end\r\n end",
"def weights=(input_weights)\n if !(input_weights.instance_of? Array)\n return nil\n end\n input_weights.map! {|x| x.to_f}\n @weights = input_weights if input_weights.size == self.size\n end",
"def reduce_weight \n @weight -= WEIGHT_INCREMENT\n # increment could be confusing and imply an increase rather than a decrease \n # but it is being reduced by increments of 10 so it makes sense??? \n # It's the best of the names that came to mind.\n end",
"def weight_adjustment_inputs(inputs,dendrites)\n\tfor i in 0...inputs.size\n\t\tnew_weights=Array.new\n\t\told_weights=Array.new\n\t\told_weights=dendrites[i].print_weight\n\t\tfor j in 0...old_weights.size\n\t\t\tnew_weights.push(inputs[i]*(1-inputs[i])*old_weights[j])\n\t\tend\n\t\tdendrites[i].adjust_weight(new_weights)\n\tend\n\tend",
"def initialize\n @weights = { count: {}, first: {}, next: {}, last: {} }\n end",
"def imperialize(params)\n self.weight = (params[:weight].to_f * 0.00220462).round(2)\n self.height = (params[:height].to_f / 2.54).round(2)\n self.depth = (params[:depth].to_f / 2.54).round(2)\n self.width = (params[:width].to_f / 2.54).round(2)\n end",
"def weightedsum\n ws = 0\n @inputs.each_index { |i| ws = ws + @inputs[i]*@weights[i] }\n ws\n end",
"def weight\n 0\n end",
"def print_weight\n\t\treturn @weights\n\tend",
"def weight\n @mass * @hopper.size\n end",
"def weight w=nil\n if w.nil?\n @weight\n else\n @weight = w\n end\n end",
"def backtrace(values, weights)\n results = Array.new(weights.size)\n w = values.size - 1\n i = weights.size\n while i >= 1\n if values[w][i] == values[w][i - 1]\n results[i - 1] = 0\n else\n results[i - 1] = 1\n w -= weights[i - 1]\n end\n i -= 1\n end\n\n results\nend",
"def sg_weights(half_window, order, deriv=0)\n mat = SVDMatrix[ *(-half_window..half_window).map {|k| (0..order).map {|i| k**i }} ]\n mat.pinv.row(deriv).to_a\n end",
"def addweight(w)\n @weight += w\n end",
"def fully_extend_all reps=nil\n dist.branches.times do |i|\n hits = mapee(i).hits\n len = mapee(i).length\n mapee(i).clear_hits\n reps = (@len.to_f / len).round if reps.nil?\n mapee(i).length = @len\n reps.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/reps)\n new_hits + (j.to_f / reps)\n# puts new_hits.hits.inspect\n mapee(i) << new_hits\n end\n# puts mapee(i).hits.hits.inspect\n end\n end",
"def zero_one_memoized(w, c, max_weight, n = w.length)\n r = Array.new(n+1) { Array.new(max_weight) }\n r.each { |x| x[0] = 0 }\n zero_one_memoized_aux(w, c, max_weight, n, r)\n end",
"def weight\n sides.map(&:weight).reduce(&:+)\n end",
"def train\n @weights.each_index do |i| \n # alter weight and apply momentum\n @weights[i] = @weights[i] + (@rate * inputs[i] * @gradient)\n @weights[i] = @weights[i] + @momentum * @lastchange\n \n @lastchange = @rate * inputs[i] * @gradient\n end\n @weights\n end",
"def populateValidWeights()\n @allWeights.collection.each { |weight|\n if (weight.srcHostname == @hostname && saidHello?(weight.dstIp))\n validWeights.push(weight)\n end\n }\n end",
"def to_weights\n weights = []\n @ruleTable.each_index { |i| weights << @ruleTable[i][:weight] }\n weights\n end",
"def adjustable_weighting\n @adjustable ? @weighting : 0\n end",
"def currentWeight() weighins.last.weight end",
"def init_activation_nodes\n @activation_nodes = Array.new(@structure.length) do |n|\n Array.new(@structure[n], 1.0)\n end\n if not disable_bias\n @activation_nodes[0...-1].each {|layer| layer << 1.0 }\n end\n end",
"def fill_arr_withmodel(arr_ids, add_fn_target, model_classname, sort_on_weight = false)\n #p 'fill_arr_withmodel'\n #p arr_ids\n if arr_ids\n tmp = model_classname.find(arr_ids)\n if tmp\n tmp.sort!{|a,b| (b.get_always_weight <=> a.get_always_weight)} if sort_on_weight\n tmp.each do |item|\n send add_fn_target, item\n end\n end\n end\n end",
"def backpropagate(expected_output_values)\n check_output_dimension(expected_output_values.length)\n calculate_output_deltas(expected_output_values)\n calculate_internal_deltas\n update_weights\n end",
"def edge_weight(id_1, id_2)\n @arr[id_1][id_2]\n end",
"def feedforward(input_values)\n input_values.each_index do |input_index|\n @activation_nodes.first[input_index] = input_values[input_index]\n end\n @weights.each_index do |n|\n @structure[n+1].times do |j|\n sum = 0.0\n @activation_nodes[n].each_index do |i|\n sum += (@activation_nodes[n][i] * @weights[n][i][j])\n end\n @activation_nodes[n+1][j] = @propagation_function.call(sum)\n end\n end\n end",
"def weight\n return data.weight\n end",
"def initialize_wave_function(size:, patterns:)\n coefficients = []\n\n (0..size[0] - 1).each do |_col|\n row = []\n (0..size[1] - 1).each do |_r|\n row.push(patterns)\n end\n coefficients.push(row)\n end\n coefficients\nend",
"def output(input)\n result = input.zip(weights).inject(0) do |result, temp_array|\n result + temp_array[0] * temp_array[1]\n end\n (result > threshold)? 1 : 0\n end",
"def from_weighted_table( table )\n raise 'Table must contain at least one element' if table.empty?\n\n # We may call this method many time for an existing object, so we must clear it\n @weights.clear\n\n base = BASE_WEIGHT\n w = nil\n\n table.each do |weight, data|\n w = base + weight\n @weights << [base, w, data]\n base = w\n end\n\n @max_weight = w\n\n # p @weights, @max_weight\n\n self\n end",
"def knapsack_dp(w, w_arr, v_arr, n)\n return 0 if w == 0 || n == 0\n cache = {}\n\n (0..n).each do |nn|\n cache[nn] = {}\n (0..w).each do |ww|\n cache[nn][ww] = if ww == 0 || nn == 0\n 0\n elsif w_arr[nn - 1] > ww\n cache[nn - 1][ww]\n else\n [v_arr[nn - 1] + cache[nn - 1][ww - w_arr[nn - 1]], cache[nn - 1][ww]].max\n end\n end\n end\n cache[n][w]\nend",
"def init_coefficients\n weight_keys = @model.weights.keys\n \n @model.output_size[0].times do\n row = []\n @model.output_size[1].times do\n row << weight_keys\n end\n @coefficients << row\n end\n end",
"def blur(distance)\r\n # instantiate variables\r\n @b_array = Array.new(array.length) { Array.new(array[0].length,0) }\r\n min_y= 0\r\n max_y = b_array.length - 1\r\n min_x = 0 \r\n max_x = b_array[0].length - 1\r\n blurred_coordinates = []\r\n #iterate through each row of the array, passing down index and value\r\n array.each_with_index do |row,row_i|\r\n #iterate through each column (value) passing index and value\r\n row.each_with_index do |col,col_i| \r\n if row[col_i] == 1 \r\n blurred_coordinates << get_manhattan_set(row_i,col_i,distance)\r\n end\r\n end\r\n end\r\n\r\n blurred_coordinates.each do |set|\r\n set.each do |point|\r\n unless point[0]< min_x || point[1] < min_y || point[0]> max_y || point[1] > max_x\r\n @b_array[point[0]][point[1]] = 1\r\n end\r\n end \r\n end\r\n end",
"def knapsack0(weights, values, capacity) #C = 6 #W = [1,2,3] #V = [10, 4, 8]--equal-sized\n @knapsack = {}\n @capacity_cache = {}\n @value_cache = {}\n #First, store & cache weight-value pairs\n weights.each_index do |idx|\n @knapsack[weights[idx]] = values[idx] #{1: 10, 2: 4, 3: 8}\n @capacity_cache[weights[idx]] = [ values[idx] ] #{1: [10], 2: [4], 3: [8]}\n @value_cache[values[idx]] = [ weights[idx] ] #{10: [1], 4: [2], 8: [3]}\n end\n\n weight_keys = weights.sort #[1,2,3] #[23...]\n @min = weight_keys[0]\n #Check if any valid weights\n return 0 if capacity < @min #6 < 1 => false\n return @capacity_cache[@min].first if capacity == @min\n\n #set base case; value keyed to weights array # 10: [1] #92: [23]\n latest_value = @knapsack[@min]\n latest_weights = @value_cache[latest_value].dup\n #Combine valid weights' values w/ cached weight-value sets\n #Cache highest value set to current weight\n (@min + 1..capacity).each do |weight| #2 | 3 | 4 | 5 | 6\n #select possible keys\n valid_keys = weight_keys.select{|key| key <= weight && !latest_weights.include?(key)} #[1,2] | [1,2,3]\n\n (0...valid_keys.length).each do |i| #0 |, 1\n\n current_value_set = @capacity_cache[@min]\n (@min + 1..weight).each do |cap_weight|\n\n new_weight = valid_keys[i] + latest_weights.inject(:+) #2+1= 3|, 3+1+2= 6 |,|2+1+3= 6\n #can either:\n #Add a weight to the set,\n if new_weight <= weight #3 <= 2 => false | #3 <= 3 => true, 6 <= 3 => false ||| 6 <= 6 => true\n #set new value to weights array\n latest_sum = 0\n latest_weights.each {|wt| latest_sum += @knapsack[wt]} #=> 10 |||| 10+8\n latest_value = @knapsack[valid_keys[i]] + latest_sum #| 10+4= 14 ||| +4= 22\n @value_cache[latest_value] = latest_weights << valid_keys[i] #| 14: [1,2] ||| 22: [1,3,2]\n latest_weights = @value_cache[latest_value] #[1] | [1,2] | [1,3,2]\n #Replace a weight from the set,\n else\n smallest = @knapsack[valid_keys[i]] #4 |. 8\n weight_of_smallest = valid_keys[i] #2 |. 3\n latest_weights.each do |wt|\n #10 < 4 => false |. 10 < 8 => false, 4 < 8 but 1+3 <= 3 => false |\n #1+3 <= 4 => true |. 8 < 4 => false\n if @knapsack[wt] < smallest && #one weight's value is less\n latest_weights.inject(:+) - wt + valid_keys[i] <= capacity\n #and replacing it w/ new weight would be valid\n smallest = @knapsack[wt] #||4\n weight_of_smallest = wt #||2\n end\n end\n\n #or Do nothing\n if smallest != @knapsack[valid_keys[i]] #false |. false | true | false\n latest_weights.delete(weight_of_smallest)\n latest_weights.push(valid_keys[i]) #||[1,3]\n latest_value = latest_value - smallest + @knapsack[valid_keys[i]] #||14-4+8= 18\n @value_cache[latest_value] = latest_weights #18: [1,3]\n end\n end\n end\n end\n\n capacity_array = [] #[1] | [1,2] | [1,3] || [1,3,2]\n @value_cache[latest_value].each{ |wt| capacity_array.push(@knapsack[wt]) }\n @capacity_cache[weight] = capacity_array #2: [10] | 3: [10,4] | 4: [10, 8] | 5: [10, 8] | 6: [10, 8, 4]\n end\n p '----'\n p @capacity_cache[capacity]\n sum = @capacity_cache[capacity].inject(:+) #22\n sum\n end",
"def print_weight\n\t\t\treturn @weights\n\t\tend",
"def regress(x,y)\n weights = Array.new(x.length)\n for f in 0..(x.length - 1)\n weights[f] = WeightedFeature.new(x[f].name,0.0)\n end\n w0 = 0.0\n weight_magnitude = 0\n old_gradient = 0\n gradient = 0\n begin\n weight_magnitude = 0\n old_gradient = gradient\n gradient = 0\n old_weights = weights.clone\n h_ary = Array.new\n w0sum = 0\n for j in 0..(x[0].length - 1) #loop over training examples\n z = w0\n for k in 0..(x.length - 1) #calculate weightsT * X\n z += old_weights[k].weight*x[k][j]\n end\n h_ary[j] = 1 / (1 + Math.exp(-z)) #calculate and store hypotheses\n w0sum += (y[j] - h_ary[j])\n end\n for i in 0..(x.length - 1) #update features\n wisum = 0\n for j in 0..(x[0].length - 1) #loop over training examples\n wisum += x[i][j]*(y[j] - h_ary[j]) #recall precomputed hypotheses\n end\n wisum = wisum - (old_weights[i].weight / SIGMA**2)\n weights[i].weight = old_weights[i].weight + ETA*wisum\n weight_magnitude += weights[i].weight**2\n gradient += wisum**2\n end\n w0sum = w0sum - (w0 / SIGMA**2)\n w0 = w0 + ETA*w0sum\n gradient += w0sum**2\n gradient = gradient**(1.0/2)\n weight_magnitude = weight_magnitude**(1.0/2)\n end while((old_gradient - gradient).abs > EPSILON)\n weights.w0 = w0\n return weights\nend",
"def weight\n if witness?\n serialize_old_format.bytesize * (WITNESS_SCALE_FACTOR - 1) + serialize_witness_format.bytesize\n else\n serialize_old_format.bytesize * WITNESS_SCALE_FACTOR\n end\n end",
"def weight(i, j)\n return 1\n end",
"def calc_total_weight\n 0\n end",
"def flatten!\n\t\t@array = make_flat(@array)\n\tend",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def add_weighted_elem(elem, weight)\n # (native code)\n end",
"def field_weights(field_weight)\n @options[:field_weights].merge!(field_weight) if field_weight.kind_of?(Hash)\n end",
"def weight=(value)\n @weight = value\n end",
"def prime_weights=(new_weights)\n if new_weights.size != PRIMES.size\n PRIMES.size.times do |i|\n if new_weights[i] == nil\n new_weights[i] = 0.0\n end\n end\n end\n @prime_weights = ::NArray.to_na(new_weights)\n end",
"def knapsack(weights, values, capacity)\n @knapsack_matrix = Array.new\n weights.unshift(0)\n values.unshift(0)\n (capacity + 1).times { @knapsack_matrix << Array.new }\n 0.upto(capacity) do |i|\n 0.upto(weights.length - 1) do |j|\n @knapsack_matrix[i][j] = knapsack_helper(j, i, weights, values)\n end\n end\n @knapsack_matrix[capacity][weights.length - 1]\n end",
"def blur!(distance = 1) #needs the !, is a bang, syntax is telling that is going to change the state of what we are operating on.\r\n distance.times do #looping for distance\r\n\r\n blur_pixels = coords # accessing array from previous method\r\n @array.each_with_index do |row, row_int|\r\n row.each_with_index do |int, col_index|\r\n blur_pixels.each do |row_int_coord, col_index_coord|\r\n\r\n if row_int == row_int_coord && col_index == col_index_coord\r\n # left of 1\r\n @array[row_int][col_index -1] = 1 unless col_index == 0\r\n # right of 1\r\n @array[row_int][col_index +1] = 1 unless col_index >= @col_length-1\r\n # above 1\r\n @array[row_int -1][col_index] = 1 unless row_int == 0\r\n # below 1\r\n @array[row_int +1][col_index] = 1 unless row_int >= @row_length-1\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end",
"def fillout\n count.times do |j|\n self[j].clear_hits\n reps = (@len.to_f / (mapee(j).length)).round\n self[j] << reps.eqly_spaced\n end\n end",
"def weight\n if !block_given?\n return @j_del.java_method(:weight, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling weight()\"\n end",
"def weight\n if !block_given?\n return @j_del.java_method(:weight, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling weight()\"\n end",
"def knapsack_table(weights, values, capacity)\n # iterate over the weights\n # nested - iterate over the table array\n # For each capacity_idx < weight, push into the current capacity array..\n # either a 0 or the last value in the current capacity array (which ever is larger)\n # For capacity_idx >= weight\n # compare capacity[idx].last to (capacity[idx-weight].second_to_last + value of current weight)\n # Which ever is larger, push into capacity[idx]\n\n table = Array.new(capacity + 1) { Array.new }\n\n weights.each_with_index do |weight, wv_id|\n table.each_with_index do |local_solutions, current_cap|\n new_value = 0\n if current_cap < weight\n new_value = local_solutions[-1] || new_value\n else\n if wv_id == 0\n new_value = values[wv_id]\n else\n with_weight = table[current_cap - weight][-2] + values[wv_id]\n without_weight = local_solutions.last\n new_value =[with_weight, without_weight].max\n end\n end\n local_solutions << new_value\n end\n end\n\n table\n end",
"def assign(n, w)\n sum = w.inject(0) { |s, (k,v)| s + v }\n if (sum - 1.0).abs > 1e-6\n raise ArgumentError, \"Weights do not sum to 1: #{w.inspect}\"\n end\n @weights[n] = w.collect { |k,v| [k, v] }.sort { |a,b| a[1] <=> b[1] }\n end",
"def smooth ary\n edge_extend(ary).each_cons(3)\n .map {|l,m,r| (l+2.0*m+r)/4.0 }\nend",
"def magic_weight\n binding.pry\n \n @result.arrayofcards.each do |bundle|\n \n end\n end",
"def layout_weight=(weight)\n @needs_finalize = true\n layout_params.weight = weight\n end",
"def promote!( instance )\n # STDERR.puts \"Promoting: old weights => #{@model.weights.join(\",\")}\"\n # For every feature/attribute present, promote the corresponding weight\n instance.each_index{ |ii| @model.weights[ii] *= @alpha if instance[ii] }\n #STDERR.puts \"\\tnew weights => #{@model.weights.join(\",\")}\"\n end",
"def weighting\n self.class.weighting\n end",
"def feed_forward\n # light up the input nodes corresponding to the\n # words in our query\n word_ids.size.times do |i|\n all_in[i] = 1.0\n end\n \n # hidden activations\n hidden_ids.size.times do |j|\n sum = 0.0\n word_ids.size.times do |i|\n sum += all_in[i] * weights_in[i][j]\n end\n all_hidden[j] = Math.tanh(sum)\n end\n\n #output activations\n url_ids.size.times do |k|\n sum = 0.0\n hidden_ids.size.times do |j|\n sum += all_hidden[j] * weights_out[j][k]\n end\n all_out[k] = Math.tanh(sum)\n end\n\n all_out\n end",
"def set_w(edge, weight)\n if edge[0].nil? || edge[1].nil?\n raise ArgumentError, \"Invalid edge: #{edge}\"\n end\n unless weight.is_a?(Integer)\n raise TypeError, 'Edge weight must be integer'\n end\n init_weights if @weight.nil?\n i = edge[0] - 1\n j = edge[1] - 1\n raise \"Edge not found: #{edge}\" unless has_edge?(*edge)\n @weight[i] ||= []\n @weight[j] ||= []\n @weight[i][j] = weight\n @weight[j][i] = weight\n end",
"def computed_values\n unless defined?(@computed_values) && @computed_values\n # Do nothing if all weights are 1, as n * 1 is n\n @computed_values = hashes if weights.all? {|weight| weight == 1 }\n # Otherwise, multiply the values in each hash by that hash's weighting\n @computed_values ||= hashes.each_with_index.map do |hash, index|\n weight = weights[index]\n Hash[hash.map {|k, v| [k, (v * weight)]}]\n end\n end\n @computed_values\n end",
"def compute_weight object\n object.line_items.map { |li| (li.variant.weight || 0) * li.quantity }.sum\n end",
"def initialize( floating_points: false )\n @weights = []\n @max_weight = BASE_WEIGHT\n @floating_points = floating_points\n end",
"def build_layer(max_weight, m, n)\r\n # Create the mxn randomized weight matrix.\r\n w = Matrix.build(m, n) { rand (-max_weight..max_weight) }\r\n # Add the bias vector.\r\n w.horiz_concat(Matrix.build(m,1){Params::BIAS})\r\n end",
"def zero_one_memoized_aux(w, c, max_weight, n, r)\n if n == 0 || max_weight == 0\n q = 0\n elsif w[n-1] > max_weight\n q = r[n-1][max_weight] ||= zero_one_memoized_aux(w, c, max_weight, n-1, r).first\n else\n q = [\n c[n-1] +\n r[n-1][max_weight - w[n-1]] ||= zero_one_memoized_aux(w, c, max_weight - w[n-1], n-1, r).first,\n r[n-1][max_weight] ||= zero_one_memoized_aux(w, c, max_weight, n-1, r).first\n ].max\n end\n r[n][max_weight] = q\n [q, r]\n end",
"def extend mult\n self.length = @len*mult\n dist.branches.times do |i|\n hits = self[i].hits\n self[i].clear_hits\n mult.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/mult)\n new_hits + (j.to_f / mult)\n self[i] << new_hits\n end\n end\n end",
"def knapsack(weights, values, capacity)\n\n end"
] |
[
"0.890922",
"0.64295125",
"0.6135029",
"0.60382813",
"0.596401",
"0.5890184",
"0.58395296",
"0.5710417",
"0.5702419",
"0.56929415",
"0.56827074",
"0.5675019",
"0.5639994",
"0.56141794",
"0.5597027",
"0.55936295",
"0.5583926",
"0.5578726",
"0.5577199",
"0.5553593",
"0.55495054",
"0.5517422",
"0.55048394",
"0.5467606",
"0.5466032",
"0.54486346",
"0.5442804",
"0.5422009",
"0.54150325",
"0.5412598",
"0.5410222",
"0.5382879",
"0.53450096",
"0.5310824",
"0.5308026",
"0.5297112",
"0.52564716",
"0.52323675",
"0.52294695",
"0.5225577",
"0.5222353",
"0.5198332",
"0.51927584",
"0.5183761",
"0.51761603",
"0.5173279",
"0.51501334",
"0.5133201",
"0.5131662",
"0.5127842",
"0.512215",
"0.512102",
"0.5120858",
"0.51173687",
"0.51117605",
"0.5097997",
"0.508778",
"0.5081562",
"0.5081092",
"0.5080555",
"0.50795007",
"0.5079191",
"0.50767076",
"0.5076219",
"0.50736845",
"0.5066765",
"0.50634587",
"0.50619084",
"0.5053297",
"0.5048975",
"0.5030415",
"0.50216556",
"0.49992302",
"0.49903533",
"0.49903533",
"0.49903533",
"0.49897954",
"0.49791405",
"0.49732748",
"0.49701893",
"0.496863",
"0.49680984",
"0.49662834",
"0.49662834",
"0.496428",
"0.49555153",
"0.49545285",
"0.49538392",
"0.49499318",
"0.49461782",
"0.49396846",
"0.4931743",
"0.4924614",
"0.49235085",
"0.49234638",
"0.49205396",
"0.4918178",
"0.49134922",
"0.49086317",
"0.48881203"
] |
0.62761456
|
2
|
Get nodes (a regular_node and a standby_node if available) using hash algorithm
|
def nodes(tag)
if nodes = @cache_nodes[tag]
return nodes
end
hash_key = @hash_key_slice ? perform_hash_key_slice(tag) : tag
regular_index = @regular_weight_array.size > 0 ? get_index(hash_key, @regular_weight_array.size) : 0
standby_index = @standby_weight_array.size > 0 ? get_index(hash_key, @standby_weight_array.size) : 0
nodes = [@regular_weight_array[regular_index], @standby_weight_array[standby_index]].compact
@cache_nodes[tag] = nodes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def node_subhashes(node)\n l_hash = node.left ? node.left._hash : self.class.null_hash_at(node.depth + 1)\n r_hash = node.right ? node.right._hash : self.class.null_hash_at(node.depth + 1)\n [l_hash, r_hash]\n end",
"def node_hash(node_id)\n \n end",
"def hash_nodes(statements, nodes, grounded_hashes)\n hashes = grounded_hashes.dup\n ungrounded_hashes = {}\n hash_needed = true\n\n # We may have to go over the list multiple times. If a node is marked as\n # grounded, other nodes can then use it to decide their own state of\n # grounded.\n while hash_needed\n starting_grounded_nodes = hashes.size\n nodes.each do | node |\n unless hashes.member? node\n grounded, hash = node_hash_for(node, statements, hashes)\n if grounded\n hashes[node] = hash\n end\n ungrounded_hashes[node] = hash\n end\n end\n\n # after going over the list, any nodes with a unique hash can be marked\n # as grounded, even if we have not tied them back to a root yet.\n uniques = {}\n ungrounded_hashes.each do |node, hash|\n uniques[hash] = uniques.has_key?(hash) ? false : node\n end\n uniques.each do |hash, node|\n hashes[node] = hash if node\n end\n hash_needed = starting_grounded_nodes != hashes.size\n end\n [hashes, ungrounded_hashes]\n end",
"def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end",
"def roothash\n root_node._hash || recalculate_hash_at(root_node)\n end",
"def get_responsible_nodes key\n responsible_hash_keys = []\n if @@dynamo_nodes.size <= ENV['REPLICATION'].to_i\n return @@dynamo_nodes\n end\n responsible_node_key = 0\n previous = 0\n\n sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second}\n\n sorted_hash_keys.each do |hash_key|\n #log_message('Comparing key '+key.to_i.to_s+' to hash_key '+hash_key.to_i.to_s)\n if key.to_i <= hash_key.to_i && key.to_i > previous.to_i #key.to_i.between?(previous.to_i,hash_key.to_i)\n responsible_node_key = hash_key\n break\n elsif hash_key.to_i == sorted_hash_keys.last.to_i && hash_key.to_i < key.to_i\n responsible_node_key = sorted_hash_keys.first\n else\n previous = hash_key\n end\n end\n\n sorted_hash_keys.each_with_index do |key, index|\n if key == responsible_node_key\n 3.times.each_with_index { |_e, iterator| responsible_hash_keys << sorted_hash_keys[(index - iterator) % sorted_hash_keys.size]}\n end\n end\n\n @@dynamo_nodes.select { |_k, v| v.first.second.in?(responsible_hash_keys) }\n\n end",
"def get_true_node_objects get_all_nodes=false\r\n nodes, all_nodes, names, iter_arr, file_cache_nodes, h = [],[],[],[],[],{}\r\n\r\n @config['chef_nodes'] = @config['ridley'].node.all\r\n\r\n @config['helper'].completion_rate? 0, __method__\r\n\r\n file_cache_nodes = @config['filesystem'].check_nodes_file_cache if @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n @config['chef_nodes'].each do |n|\r\n true_obj = if !file_cache_nodes.empty? && @config['parser'].array_of_nodes_contains_node_name?(file_cache_nodes, n.name)\r\n file_cache_nodes[@config['parser'].index_of_node_name_in_array_of_nodes(file_cache_nodes, n.name)]\r\n else\r\n @config['filesystem'].cleanup_file_caches('current-nodes')\r\n\r\n @config['ridley'].node.find(n.name)\r\n end\r\n\r\n iter_arr << n.name\r\n\r\n progress_value = (( iter_arr.length.to_f/@config['chef_nodes'].length.to_f )*100 ).floor\r\n\r\n @config['helper'].completion_rate? progress_value, __method__\r\n\r\n all_nodes << true_obj\r\n\r\n next if !get_all_nodes && true_obj.chef_environment != @options['env'] && true_obj.chef_environment != '_default'\r\n\r\n if get_all_nodes\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['role'] == 'all'\r\n next if true_obj.chef_environment == '_default'\r\n\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['node_name'] && true_obj.name == @options['node_name']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['address'] && true_obj.public_ipaddress == @options['address']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n unless ( @options['address'] || @options['node_name'] )\r\n if true_obj.run_list.include?(\"role[#{ @options['role'] }]\")\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next #not needed here but good to keep in mind\r\n end\r\n end\r\n end\r\n\r\n names.sort.each { |name| nodes << h[name] }\r\n\r\n @config['filesystem'].write_nodes_file_cache(all_nodes) unless @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n puts(\"\") unless @options['quiet']\r\n \r\n nodes\r\n end",
"def correct_node_hash(node_id)\n SpStore::Crypto.hash_for_tree_node node_id, node_hash(left_child(node_id)),\n node_hash(right_child(node_id))\n end",
"def node_hash_for(node, statements, hashes)\n statement_signatures = []\n grounded = true\n statements.each do | statement |\n if statement.to_quad.include?(node)\n statement_signatures << hash_string_for(statement, hashes, node)\n statement.to_quad.compact.each do | resource |\n grounded = false unless grounded?(resource, hashes) || resource == node\n end\n end\n end\n # Note that we sort the signatures--without a canonical ordering, \n # we might get different hashes for equivalent nodes.\n [grounded,Digest::SHA1.hexdigest(statement_signatures.sort.to_s)]\n end",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= {}\n end",
"def collect_node_nei_hashes\n @log.info(\"#{__method__.to_s} started[#{self.class.to_s}]\")\n\n node_nei_hash = @redis_connector.fetch_relations\n end",
"def root_hash\n self.node_hash root_node_id\n end",
"def hash\n node_id.hash\n end",
"def nodes(hsh={})\n results = describe_instances(:status=>'running').select_with_hash({:keypair_name => keypair.basename})\n results.select_with_hash(hsh)\n end",
"def hash\n @node.sort.push(@edge).hash\n end",
"def disk_hash_tree\n tree_size = SpStore::Merkle::HashTreeHelper.full_tree_node_count @blocks\n node_hashes = Array.new(tree_size+1)\n File.open(disk_hash_file, 'rb') do |file|\n file.seek(hash_byte_size, IO::SEEK_SET)\n (1..tree_size).each do |idx|\n node_hashes[idx] = file.read(hash_byte_size)\n end\n end\n node_hashes\n end",
"def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end",
"def initialize\n @nodes_hash = Hash.new\n end",
"def nodes\n nodes_by_id.values\n end",
"def [](node)\n return @hash[node.sha1]\n end",
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n node_map = changelog.node_map\n search = []\n unknown = []\n fetch = {}\n seen = {}\n seen_branch = {}\n opts[:base] ||= {}\n opts[:heads] ||= remote.heads\n \n # if we've got nothing...\n if changelog.tip == NULL_ID\n opts[:base][NULL_ID] = true # 1 is stored in the Python\n \n return [NULL_ID], [NULL_ID], opts[:heads].dup unless opts[:heads] == [NULL_ID]\n return [NULL_ID], [], [] # if we didn't trip ^, we're returning this\n end\n \n # assume we're closer to the tip than the root\n # and start by examining heads\n UI::status 'searching for changes'\n \n opts[:heads].each do |head|\n if !node_map.include?(head)\n unknown << head\n else\n opts[:base][head] = true # 1 is stored in the Python\n end\n end\n \n opts[:heads] = unknown # the ol' switcheroo\n return opts[:base].keys, [], [] if unknown.empty? # BAIL\n \n # make a hash with keys of unknown\n requests = Hash.with_keys unknown\n count = 0\n \n # Search through the remote branches\n # a branch here is a linear part of history, with 4 (four)\n # parts:\n #\n # head, root, first parent, second parent\n # (a branch always has two parents (or none) by definition)\n #\n # Here's where we start using the Hashes instead of Arrays\n # trick. Keep an eye out for opts[:base] and opts[:heads]!\n unknown = remote.branches(*unknown)\n until unknown.empty?\n r = []\n \n while node = unknown.shift\n next if seen.include?(node[0])\n UI::debug \"examining #{short node[0]}:#{short node[1]}\"\n \n if node[0] == NULL_ID\n # Do nothing...\n elsif seen_branch.include? node\n UI::debug 'branch already found'\n next\n elsif node_map.include? node[1]\n UI::debug \"found incomplete branch #{short node[0]}:#{short node[1]}\"\n search << node[0..1]\n seen_branch[node] = true # 1 in the python\n else\n unless seen.include?(node[1]) || fetch.include?(node[1])\n if node_map.include?(node[2]) and node_map.include?(node[3])\n UI::debug \"found new changset #{short node[1]}\"\n fetch[node[1]] = true # 1 in the python\n end # end if\n \n node[2..3].each do |p|\n opts[:base][p] = true if node_map.include? p\n end\n end # end unless\n \n node[2..3].each do |p|\n unless requests.include?(p) || node_map.include?(p)\n r << p\n requests[p] = true # 1 in the python\n end # end unless\n end # end each\n end # end if\n \n seen[node[0]] = true # 1 in the python\n end # end while\n \n unless r.empty?\n count += 1\n \n UI::debug \"request #{count}: #{r.map{|i| short i }}\"\n \n (0 .. (r.size-1)).step(10) do |p|\n remote.branches(r[p..(p+9)]).each do |b|\n UI::debug \"received #{short b[0]}:#{short b[1]}\"\n unknown << b\n end\n end\n end # end unless\n end # end until\n \n # sorry for the ambiguous variable names\n # the python doesn't name them either, which\n # means I have no clue what these are\n find_proc = proc do |item1, item2|\n fetch[item1] = true\n opts[:base][item2] = true\n end\n \n # do a binary search on the branches we found\n search, new_count = *binary_search(:find => search,\n :repo => remote,\n :node_map => node_map,\n :on_find => find_proc)\n count += new_count # keep keeping track of the total\n \n # sanity check, because this method is sooooo fucking long\n fetch.keys.each do |f|\n if node_map.include? f\n raise RepoError.new(\"already have changeset #{short f[0..3]}\")\n end\n end\n \n if opts[:base].keys == [NULL_ID]\n if opts[:force]\n UI::warn 'repository is unrelated'\n else\n raise RepoError.new('repository is unrelated')\n end\n end\n \n UI::debug \"found new changesets starting at #{fetch.keys.map{|f| short f }.join ' '}\"\n UI::debug \"#{count} total queries\"\n \n # on with the show!\n [opts[:base].keys, fetch.keys, opts[:heads]]\n end",
"def recalculate_hash_at(node)\n return node._hash = node.value if node.value\n recalculate_hash_at(node.left) if node.left\n recalculate_hash_at(node.right) if node.right\n node._hash = self.class.hash_children(*node_subhashes(node))\n end",
"def make_branch connected_nodes_number, avalable_nodes\n nodes = []\n\n num = rand(1..connected_nodes_number)\n\n num = 0 unless num\n\n num.times do\n node = gen_uniq_rand_hash(4, avalable_nodes)\n nodes << node\n\n # increiment the count of each avalable node so we can enforce a limit the\n # number of connections TO each node\n avalable_nodes[node] += 1\n end\n\n nodes\nend",
"def shiny_gold_reachable_nodes\n # Init\n unvisited_nodes = @nodes_by_color.values\n # Nodes that can reach shiny gold node\n gold_reachable_nodes = Set.new\n\n until unvisited_nodes.empty?\n next_node = unvisited_nodes.pop\n\n # Can we find shiny gold?\n path = shiny_gold_path(next_node)\n\n # Cannot reach or at shiny gold. Try next node\n next if path.empty?\n\n # We can reach gold! Mark nodes in path as shiny gold reachable\n path.each do |node|\n # Shiny gold bag cannot contain itself\n next if is_shiny_gold_node?(node)\n\n gold_reachable_nodes << node\n\n # Mark as visited\n unvisited_nodes.delete(node)\n end\n end\n\n gold_reachable_nodes\n end",
"def current_node_snapshots\n nodes = {}\n snapshots = Hash.new { |h, k| h[k] = NodeSnapshot.new(k) }\n fetch_node_manager_states.each do |node_manager, states|\n available, unavailable = states.values_at(:available, :unavailable)\n available.each do |node_string, latency|\n node = nodes[node_string] ||= node_from(node_string)\n snapshots[node].viewable_by(node_manager, latency)\n end\n unavailable.each do |node_string|\n node = nodes[node_string] ||= node_from(node_string)\n snapshots[node].unviewable_by(node_manager)\n end\n end\n\n snapshots\n end",
"def node_list\n list = {}\n search = Chef::Search::Query.new\n query = config[:query]\n\n ui.msg \"Search nodes '#{query}'\"\n search.search('node', query) do |node|\n if node['chef'] && node['chef']['client_version']\n version = node['chef']['client_version']\n\n list[version] ||= []\n list[version] << node\n end\n end\n ui.msg ''\n\n list\n end",
"def nodes(data)\n\tnodes = \n\t\tdata.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t.collect do |data|\n\t\t\t\t{\n\t\t\t\t\t'id' => data\n\t\t\t\t\t# 'r' => data.split(' ')[1][0].to_i, # first digit\n\t\t\t\t}\n\t\t\tend\n\t\n\treturn nodes\nend",
"def graph(hash_graph)\n next_node = 0\n result = [0]\n\n while next_node != 4\n next_node = hash_graph[next_node].first\n result << next_node\n end\n\n result\nend",
"def node_list\n Chef::Node.list.keys\n end",
"def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"def nodes\n return @nodes_structure if @nodes_structure\n @nodes_structure = {}\n cib_section_nodes_state.each do |node_state|\n node = attributes_to_hash node_state\n node_name = node['uname']\n next unless node_name\n lrm = node_state.elements['lrm']\n next unless lrm\n lrm_resources = cib_section_lrm_resources lrm\n next unless lrm_resources\n resources = decode_lrm_resources lrm_resources\n node.store 'primitives', resources\n @nodes_structure.store node_name, node\n end\n @nodes_structure\n end",
"def get_host_keys(_nodes, metadata)\n updated_metadata = {}\n # Get the list of nodes, per hostname (just in case several nodes share the same hostname)\n # Hash<String, Array<String> >\n hostnames = Hash.new { |hash, key| hash[key] = [] }\n metadata.each do |node, node_metadata|\n if node_metadata[:host_ip]\n hostnames[node_metadata[:host_ip]] << node\n elsif node_metadata[:hostname]\n hostnames[node_metadata[:hostname]] << node\n end\n end\n unless hostnames.empty?\n host_keys_for(*hostnames.keys).each do |hostname, ip|\n hostnames[hostname].each do |node|\n updated_metadata[node] = ip\n end\n end\n end\n updated_metadata\n end",
"def graph(hash_graph)\n # write your code here\n next_node = 0\n result = [0]\n \n while next_node != 4\n next_node = hash_graph[next_node].first\n result << next_node\n end\n \n result\nend",
"def nodes_head(args = {})\n return node_pids.map {|pid| Node.latest_version(pid)}\n end",
"def select_branch(hash)\n #if RIPPLE_VERIFY_NODEOBJECT_KEYS\n raise if depth >= 64\n raise if (hash.to_bn & mask.to_bn) != key.to_bn\n #end\n\n # Extract hash byte at local node depth\n br = hash[depth / 2].ord\n\n # Reduce to relevant nibble\n if (depth & 1) == 1\n br &= 0xf\n else\n br >>= 4\n end\n\n raise unless (br >= 0) && (br < 16)\n br\n end",
"def get_nethash\n blocks = self.blocks_get_nethash\n if blocks[\"success\"]\n return blocks[\"nethash\"]\n else\n return nil\n end\n end",
"def get_all_roles_nodes\n result = search(:node, \"chef_environment:#{node.chef_environment}\")\n if result.any? { |x| x['hostname'] == node['hostname'] }\n result.map! { |x| x['hostname'] == node['hostname'] ? node : x }\n else\n result.push(node)\n end\n return result.sort! { |a, b| a['hostname'] <=> b['hostname'] }\nend",
"def singleton_nodes\n all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.uniq\n all_nodes_in_ways = Way_Query.new(analysis_window: aw).run.first[:objects].collect{|w| w.nodes}.flatten.uniq\n # all_nodes_in_rels = Relation_Query.new(analysis_window: aw).run.first[:objects].collect{|r| r.nodes}.flatten.uniq\n nodes_not_in_ways_or_rels = (all_node_ids - all_nodes_in_ways).length\n puts \"Total Nodes: #{all_node_ids.length}, Nodes not in ways or relations: #{nodes_not_in_ways_or_rels}\"\n puts \"Percentage: #{nodes_not_in_ways_or_rels.to_f / all_node_ids.length.to_f}\"\n end",
"def get_all_nodes(state)\n rc = []\n machines = state[:machines]\n chef_server = Cheffish::CheffishServerAPI.new(Cheffish.enclosing_chef_server)\n nodes = chef_server.get(\"/nodes\")\n nodes.each_key do |key|\n if (machines.include?(key))\n node_url = nodes[key]\n node = chef_server.get(node_url)\n rc.push(node)\n end\n end\n return rc\n end",
"def get_registered_nodes\n update_nodes\n @registered_nodes\n end",
"def get_zk_nodes\n rl_results = search(:node, \"role:Kafka-Head-Zookeeper AND chef_environment:#{node.chef_environment}\")\n rl_results.map!{|x| x[:hostname] == node[:hostname] ? node : x}\n ro_results = search(:node, \"roles:Kafka-Head-Zookeeper AND chef_environment:#{node.chef_environment}\")\n ro_results.map!{|x| x[:hostname] == node[:hostname] ? node : x}\n results = rl_results.concat ro_results\n return results.uniq{|x| x[:hostname]}.sort\nend",
"def resolve_node_hw_id_collision\n # Get all nodes\n nodes = get_data.fetch_all_objects(:node)\n # This will hold all hw_id's (not unique)'\n all_hw_id = []\n # Take each hw_id and add to our all_hw_id array\n nodes.each { |node| all_hw_id += node.hw_id }\n # Loop through each hw_id\n all_hw_id.each do\n |hwid|\n # This will hold nodes that match\n matching_nodes = []\n # loops through each node\n nodes.each do\n |node|\n # If the hwid is in the node.hw_id array then we add to the matching ndoes array\n matching_nodes << node if (node.hw_id & [hwid]).count > 0\n end\n # If we have more than one node we have a conflict\n # We sort by timestamp ascending\n matching_nodes.sort! { |a, b| a.timestamp <=> b.timestamp }\n # We remove the first one, any that remain will be cleaned of the hwid\n matching_nodes.shift\n # We remove the hw_id from each and persist\n matching_nodes.each do\n |node|\n node.hw_id.delete(hwid)\n node.update_self\n end\n end\n nil\n end",
"def ret_matching_nodes(parent_idh)\n if parent_idh[:model_name] == :node\n return [parent_idh]\n end\n filter = [:eq, :assembly_id, parent_idh.get_id()]\n if node_filter = ret_filter(pattern, :node)\n filter = [:and, filter, node_filter]\n end\n sp_hash = {\n cols: [:id, :group_id, :display_name],\n filter: filter\n }\n Model.get_objs(parent_idh.createMH(:node), sp_hash)\n end",
"def get_node_ready(nodes)\n ready_nodes = nodes.select { |node| check_node_status(node) == \"ready\" }\n idle_nodes = []\n ready_nodes.each { |node| idle_nodes << node if !(DRbObject.new(nil, \"druby://#{node.ip}:9000\").executando_job) }\n idle_nodes.min{|a,b| DRbObject.new(nil, \"druby://#{a.ip}:9000\").cpu <=> DRbObject.new(nil, \"druby://#{b.ip}:9000\").cpu }\n end",
"def subtree_with_all_paths(nodes)\n hash = {}\n nodes.each { |x| hash[x] = true }\n nodes.each_index do |i|\n node1 = nodes[i]\n (0...i).each do |j|\n node2 = nodes[j]\n unless node1 == node2 then\n begin\n path = self.path(node1, node2)\n rescue IndexError, NoPathError\n path = []\n end\n path.each { |x| hash[x] = true }\n end\n end\n end\n self.subtree(hash.keys)\n end",
"def hash\n self.class.hash ^ left.hash ^ right.hash\n end",
"def initialize\n @nodes = Hash.new\n @rootlist = nil\n @min = nil\n @length = 0\n end",
"def search_missing_node_of(other_state)\n results = []\n\n other_state.job_names.each do |other_job_name|\n other_state.job_nodes(other_job_name).size.times do |i|\n other_node = other_state.job_nodes(other_job_name)[i]\n found_node = job_nodes(other_job_name)[i] || job_extra_node(other_job_name, i)\n # found in other state or this state doens't has it either\n if (other_node && other_node.existing?) || found_node.nil?\n results.push(other_node)\n else\n results.push(found_node)\n end\n end\n end\n\n other_state.resource_pool_names.each do |other_resource_pool_name|\n my_exisiting_nodes = (\n idle_nodes(other_resource_pool_name) +\n idle_extra_nodes(other_resource_pool_name)\n ).select(&:existing?)\n\n other_exisiting_nodes = other_state\n .idle_nodes(other_resource_pool_name)\n .select(&:existing?)\n\n my_exclusive_nodes = my_exisiting_nodes.select do |my_node|\n other_exisiting_nodes.find do |other_node|\n my_node.id == other_node.id\n end.nil?\n end\n\n other_state.idle_nodes(other_resource_pool_name).size.times do |i|\n other_node = other_state.idle_nodes(other_resource_pool_name)[i]\n if other_node && other_node.existing?\n results.push(other_node)\n else\n my_node = my_exclusive_nodes.pop\n if my_node\n results.push(my_node)\n else\n results.push(other_node)\n end\n end\n end\n end\n\n results\n end",
"def lookup_node_by_hw_id(options = { :hw_id => [] })\n unless options[:hw_id].count > 0\n return nil\n end\n matching_nodes = []\n nodes = get_data.fetch_all_objects(:node)\n nodes.each do\n |node|\n matching_hw_id = node.hw_id & options[:hw_id]\n matching_nodes << node if matching_hw_id.count > 0\n end\n\n if matching_nodes.count > 1\n # uh oh - we have more than one\n # This should have been fixed during reg\n # this is fatal - we raise an error\n resolve_node_hw_id_collision\n matching_nodes = [lookup_node_by_hw_id(options)]\n end\n\n if matching_nodes.count == 1\n matching_nodes.first\n else\n nil\n end\n end",
"def node_hash_from_node(ast)\n hash = {}\n ast.children.each { |cn| hash[cn.children[0]] = cn.children[1] }\n hash\n end",
"def hg_tags_nodes\n return_list = {}\n self.heads.reverse.each do |node|\n changeset = self[node]\n rev = changeset.revision\n file_node = changeset.get_file(\".hgtags\") rescue next\n return_list[file_node] = [rev, node, file_node]\n end\n return return_list.values\n end",
"def get_node(key); end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def get_values_for_verification\n \t@intermediate_nodes = self.get_intermediate_nodes\n @array = []\n\n @intermediate_nodes.each do |node|\n @array << node.sha.to_s\n if node.is_right_child\n @array << \"rchild\"\n else\n @array << \"lchild\"\n end\n end\n\n \t@array << Node.get_root_node.sha.to_s\n @array << \"root\"\n\n \treturn @array\n #return @intermediate_nodes\n end",
"def nodes_hash(nodes)\n nodes.each_with_object({}) do |node, hash|\n model = node.get(:model)\n attributes = model.to_hash\n\n attributes.merge!(node.properties.except(:model, :cc_in, :cc_out))\n\n attributes.each do |key, value|\n attributes[key] = value.to_hash if value.is_a?(ValueObject)\n end\n\n if model.max_demand\n attributes[:max_demand] = model.max_demand\n elsif !model.queries.key?(:max_demand)\n # Keep the Refinery value if it was set by a query.\n attributes.delete(:max_demand)\n end\n\n attributes[:demand] = node.demand.to_f\n attributes[:input] = slots_hash(node.slots.in)\n attributes[:output] = slots_hash(node.slots.out)\n\n attributes.delete(:queries)\n\n hash[node.key] = attributes\n end\n end",
"def traverseNodes(nodes, nextNode)\n tVec = Array.new\n #puts \"***********************\\ntraverseNodes :#{nextNode} \\n_______________________________\\n#{nodes}\\n***********************************\"\n for i in 0..nodes.size\n tmp = nodes[i]\n @xmlTool.setCountToZero()\n at = 0\n #tmpNode = @xmlTool.getHashForNameAtPos(tmp, nextNode, at)\n while ((tmpNode =@xmlTool.getHashForNameAtPos(tmp, nextNode, at) )!= nil)\n at = at.next\n @xmlTool.setCountToZero()\n tVec.push(tmpNode) # alternative is tVec.push(tmpNode)\n #tmpNode = @xmlTool.getHashForNameAtPos(tmp, nextNode, at)\n end\n end\n return tVec\n end",
"def get_node_names\n Chef::Node.list.keys\n end",
"def nodes\n return @nodes if (not @nodes.nil? and @nodes.size > 0)\n init_nodes\n @nodes\n end",
"def update_hash\n nh = nil\n\n if is_branch != 0\n sha512 = OpenSSL::Digest::SHA512.new\n sha512 << HASH_+PREFIXES[:inner_node]\n hashes.each { |k,h|\n sha512 << v\n }\n nh = sha512.digest\n end\n\n return false if nh == self.hash\n self.hash = nh\n return true\n end",
"def nodes\n # Find the nodes that were down but are ready to be refreshed, or those\n # with stale connection information.\n needs_refresh, available = seeds.partition do |node|\n refreshable?(node)\n end\n\n # Refresh those nodes.\n available.concat(refresh(needs_refresh))\n\n # Now return all the nodes that are available and participating in the\n # replica set.\n available.reject{ |node| node.down? }\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def remove_nonsense_nodes\n _clear_cache\n hash = {}\n self.each_node do |node|\n hash[node] = true if @pathway.graph[node].size == 2\n end\n hash.each_key do |node|\n adjs = @pathway.graph[node].keys\n edges = @pathway.graph[node].values\n new_edge = get_edge_merged(edges[0], edges[1])\n @pathway.graph[adjs[0]].delete(node)\n @pathway.graph[adjs[1]].delete(node)\n @pathway.graph.delete(node)\n @pathway.append(Bio::Relation.new(adjs[0], adjs[1], new_edge))\n end\n #@pathway.to_relations\n @pathway.relations.reject! do |rel|\n hash[rel.node[0]] or hash[rel.node[1]]\n end\n return hash.keys\n end",
"def test_nonequal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"m1p0\")\n\n assert_equal(0, block.check_curr())\n end",
"def shortest_distance_to_all_nodes(initial)\n Hash[shortest_path_to_all_nodes(initial).map {|n| [n, n.distance]}]\n end",
"def get_nodes\n @known_nodes\n end",
"def find_nodes_to_verify(references)\n nodes = {}\n\n references.each do |uri, _digest_value|\n uri = uri.sub(/^#/, '')\n node = find_node_by_uri(uri)\n\n nodes[uri] = calculate_digest(node)\n end\n\n nodes\n end",
"def detect_cycle_with_hash(head)\n seen_nodes = {}\n\n current_node = head\n\n while current_node != nil\n if seen_nodes[current_node.object_id]\n return true\n end\n\n seen_nodes[current_node.object_id] = true\n current_node = current_node.next_node\n end\n\n return false\nend",
"def nodes\n @nodes.frozen? ? @nodes : @nodes.dup.freeze\n end",
"def uuid_or_hostname_to_uuids(nodes)\n # avoid the Cassandra lookup if all the nodes are already UUIDs\n return nodes unless nodes.reject { |node| Hastur::Util.valid_uuid?(node) }.any?\n\n # node registration is daily, bucket the lookup on day boundary if unspecified\n day_start_ts, day_end_ts = get_start_end :one_day\n\n uuid_lookup = Hastur::Cassandra.lookup_by_key(cass_client, \"host-uuid\", day_start_ts, day_end_ts)\n\n nodes.flatten.map do |maybe_uuid|\n if Hastur::Util.valid_uuid?(maybe_uuid)\n maybe_uuid\n else\n uuid_lookup[maybe_uuid]\n end\n end.compact\n end",
"def paired_nodes(node)\n to_return_node_ids = Set.new\n log.debug \"Found #{node.short_reads.length} short reads associated with node #{node}\" if log.debug?\n node.short_reads.each do |read|\n pair_read_id = @velvet_sequences.pair_id(read.read_id)\n unless pair_read_id.nil? #i.e. if read is paired\n @read_to_nodes[pair_read_id].each do |node_id|\n to_return_node_ids << node_id\n end\n end\n end\n # Convert node IDs to node objects and return\n return to_return_node_ids.to_a\n end",
"def ceph_chef_mon_nodes\n results = nil\n if node['ceph']['search_by_environment']\n results = search(:node, ceph_chef_mon_env_search_string)\n else\n results = search(:node, \"tags:#{node['ceph']['mon']['tag']}\")\n if !results.include?(node) && node.run_list.roles.include?(node['ceph']['mon']['role'])\n results.push(node)\n end\n end\n\n results.map! { |x| x['hostname'] == node['hostname'] ? node : x }\n results.sort! { |a, b| a['hostname'] <=> b['hostname'] }\nend",
"def adjacent_nodes(node)\n h = @pathway.graph[node]\n h ? h.keys : []\n end",
"def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tnodeArray = Array.new\n\t\tnodeQuery.each do |node|\n\t\t\tnodeArray.push [node.node_id]\n\t\tend\n\t\treturn nodeArray\n\tend",
"def list_cycles?(head_node)\n\n node_hash = Hash.new([])\n\n current_node = head_node\n while true\n return true if node_hash[current_node.value].include?(current_node)\n return false unless current_node.next\n node_hash[current_node.value].push(current_node)\n current_node = current_node.next\n end\nend",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hgetall(key)\n node_for(key).hgetall(key)\n end",
"def get_inflated_node_list\n Chef::Node.list(true)\n end",
"def to_hash\n h = hash.dup\n @hash.each do |name, node|\n h[name] = node.to_hash if node.respond_to? :to_hash\n end\n h\n end",
"def sorted_keys(nodes)\n keys = []\n nodes.each do |n|\n n.cells.each do |c|\n keys << c.key\n end\n end\n keys.uniq.sort { |a, b| a <=> b }\n end",
"def node_ids() ; ext_info[:nodes] ; end",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def recurse_and_hash_tree(node)\n\n ## exit program if given a bunk file/dir\n print_and_exit \"given a bunk file/node\" unless File.exist? node\n\n ## if we have a file then return it's hash\n return Digest::MD5.hexdigest( node + File.read(node) ) if File.file? node\n\n ## we should have a directory now. exit otherwise...\n print_and_exit \"is there a strange device in this dir?\" unless File.directory? node\n\n ## recurse through each element in the directory and remember their hashes\n children_hash = \"\"\n Dir.glob(File.join node, '*' ) { |element| children_hash << recurse_and_hash_tree(element) }\n \n ## return the mashed up hash\n return Digest::MD5.hexdigest( node + children_hash ) \n\n end",
"def fetch_nodes(nodes, dns_cache)\n ret = []\n nodes.each_with_index do |item, index|\n ip, port = item\n host = dns_cache.fetch(ip) {\n |missing_ip|\n host = Resolv.getname(missing_ip)\n dns_cache[ip] = host\n host\n }\n name = \"#{host}:#{port}\"\n role = index == 0 ? 'master' : 'slave'\n node = {\n :host => host, :port => port,\n :name => name, :ip => ip,\n :role => role\n }\n ret << node\n end\n ret\n end",
"def get(key)\n @nodes[hash(Zlib::crc32(key), @nodes.size)]\n end",
"def replicate_data_before_registration\n sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second}\n sorted_hash_keys << @@my_key\n sorted_hash_keys = sorted_hash_keys.sort\n\n hash = Hash[sorted_hash_keys.map.with_index.to_a]\n\n nodes_to_be_replicated = []\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 1 ) % sorted_hash_keys.size]\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 2 ) % sorted_hash_keys.size]\n\n @@dynamo_nodes.each do |ip, data|\n if data.first.second.in?(nodes_to_be_replicated)\n data = JSON.parse(HTTPService.get_request('http://' + ip.to_s + '/node/get_data').body)['response']\n data.each do |key, value|\n store_value_simply(key, value)\n end\n end\n end\n end",
"def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end",
"def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end",
"def [](leaf_id)\n node_hash leaf_node_id(leaf_id)\n end",
"def serializable_hash\n @node = links.any? ? super.merge(_links: links) : super\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def get_nodes\n\tq = '[\"=\", [\"node\", \"active\"], true]'\n\n\tif ! q.is_a? String then\n\t\tq=JSON[q]\n\t\tend\n\tparams = {:query => q}\n\n response_nodelist = RestClient.get\"http://#{Tayu.puppetdb_server}:#{Tayu.puppetdb_port}/nodes\", { :accept => :json, :params => params }\n return JSON.parse(response_nodelist)\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end"
] |
[
"0.69388294",
"0.6933611",
"0.6772091",
"0.6542052",
"0.6268432",
"0.624462",
"0.62066424",
"0.6096661",
"0.6095306",
"0.60625297",
"0.60625297",
"0.6060467",
"0.6044555",
"0.60007113",
"0.5966244",
"0.5960455",
"0.5942243",
"0.59072876",
"0.5894821",
"0.5880932",
"0.5868486",
"0.58276826",
"0.58230036",
"0.5814846",
"0.5791269",
"0.57701296",
"0.5766451",
"0.5728081",
"0.567984",
"0.5658234",
"0.56419885",
"0.56171507",
"0.5588692",
"0.5552017",
"0.5543626",
"0.55261034",
"0.55216265",
"0.55163884",
"0.55000114",
"0.5497734",
"0.5483132",
"0.54793024",
"0.54674786",
"0.54630125",
"0.5454232",
"0.5432597",
"0.542798",
"0.541049",
"0.5409208",
"0.5399748",
"0.5391785",
"0.539082",
"0.5388696",
"0.5387559",
"0.5379684",
"0.5365222",
"0.53602386",
"0.53481615",
"0.5347687",
"0.5344486",
"0.533905",
"0.5338536",
"0.5338536",
"0.5338536",
"0.5338536",
"0.5338536",
"0.5338536",
"0.5338536",
"0.53375643",
"0.5334068",
"0.5327851",
"0.5326421",
"0.5325739",
"0.53249776",
"0.52866113",
"0.52864057",
"0.52851593",
"0.52845687",
"0.528349",
"0.5282147",
"0.52812326",
"0.5268538",
"0.5268538",
"0.52638435",
"0.5258479",
"0.52579194",
"0.5248589",
"0.52462834",
"0.5243902",
"0.5235957",
"0.5235587",
"0.52319044",
"0.52314895",
"0.5231381",
"0.52228785",
"0.5213216",
"0.51991266",
"0.5186393",
"0.51834595",
"0.51727194"
] |
0.63879544
|
4
|
the simplest hashing ever
|
def str_hash(key)
key.bytes.inject(&:+)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash(*) end",
"def hash(key); end",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def rehash() end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def fnvhash( key, len=key.length )\n state = 0x811C9DC5\n\n len.times{ |i|\n state ^= key[i]\n state *= 0x1000193\n }\n\n return state\nend",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def sha256; end",
"def get_lh_hash(key)\n res = 0\n key.upcase.bytes do |byte|\n res *= 37\n res += byte.ord\n end\n return res % 0x100000000\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash=(_arg0); end",
"def hashing(i)\n \n return ALPHABET[0] if i == 0\n hash = ''\n base = ALPHABET.length\n while i > 0\n hash<< ALPHABET[i.modulo(base)]\n i /= base\n end\n hash.reverse\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end",
"def hash_code; end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def hash()\n #This is a stub, used for indexing\nend",
"def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend",
"def hash\n 0\n end",
"def hash_this(word)\n\t\tdigest = Digest::MD5.hexdigest(word) # get the hex version of the MD5 for the specified string\n\t\tdigest[@offset, @digits].to_i(16) % @max_value # offset it using the initial seed value and get a subset of the md5. then modulo it to get the bit array location\n\tend",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hashfunction(key, size)\n #key.hash % size\n key % size\n end",
"def djbhash( key, len=key.length )\n state = 5381\n \n len.times{ |i|\n state = ((state << 5) + state) + key[i]\n }\n return state\nend",
"def hash_secure\n sha256 = OpenSSL::Digest::SHA256.new\n enc64(sha256.digest)\n end",
"def hash\n num = @high << 64\n num |= @low\n num.hash\n end",
"def H(n, *a)\n nlen = 2 * ((('%x' % [n]).length * 4 + 7) >> 3)\n hashin = a.map {|s|\n next unless s\n shex = s.class == String ? s : \"%x\" % s\n if shex.length > nlen\n raise \"Bit width does not match - client uses different prime\"\n end\n \"0\" * (nlen - shex.length) + shex\n }.join('')\n sha1_hex(hashin).hex % n\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end",
"def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def secure_hash(string)\n\t Digest::SHA2.hexdigest(string)\n\tend",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def jshash( key, len=key.length )\n state = 1315423911\n len.times{ |i|\n state ^= ( ( state << 5 ) + key[i] + ( state >> 2 ) )\n }\n return state\nend",
"def sha512; end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"def hash(*tokens)\n result = tokens.flatten.join(joiner)\n cost.times { result = Digest::SHA512.hexdigest(result) }\n result\n end",
"def H(n, *a)\n nlen = 2 * (((n.to_hex_string).length * 4 + 7) >> 3)\n hashin = a.map {|s|\n next unless s\n shex = s.class == String ? s : s.to_hex_string\n if shex.length > nlen\n raise 'Bit width does not match - client uses different prime'\n end\n '0' * (nlen - shex.length) + shex\n }.join('')\n sha512_hex(hashin).hex % n\n end",
"def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend",
"def hash(*args, **_arg1, &block); end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash() source.hash ^ target.hash; end",
"def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend",
"def hash_byte_size\n return 20\n end",
"def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end",
"def hash_secure\n # TODO: Use sha256 from openssl to create a cryptographically secure hash.\n # Credit cards with identical information should produce the same hash.\n\n sha256 = OpenSSL::Digest::SHA256.new\n sha256.digest(self.to_s).unpack('h*')\nend",
"def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def sha1; end",
"def sha1; end",
"def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend",
"def hash_secure\n # TODO: implement this method\n # - Use sha256 from openssl to create a cryptographically secure hash.\n # - Credit cards with identical information should produce the same hash\n OpenSSL::Digest::SHA256.digest(to_s).unpack(\"H*\")\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def fnv_hash(bytes)\n hash = FNV_BASIS\n bytes.each_byte do |byte|\n hash = (hash ^ byte) * FNV_PRIME % 2**64\n hash -= 2**64 if hash >= 2**63 # simulate overflow of signed long\n end\n\n # cast signed long to signed int\n hash = hash % 2**32\n hash -= 2**32 if hash >= 2**31\n\n # modified absolute value, as per voldemort.routing.ConsistentRoutingStrategy.abs(int)\n hash = 2**31 - 1 if hash == -2**31\n hash = -hash if hash < 0\n hash\n end",
"def hash256(hex)\n binary = [hex].pack(\"H*\")\n hash1 = Digest::SHA256.digest(binary)\n hash2 = Digest::SHA256.digest(hash1)\n result = hash2.unpack(\"H*\")[0]\n return result\nend",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def _hash_digest(key)\n m = Digest::MD5.new\n m.update(key)\n\n # No need to ord each item since ordinary array access\n # of a string in Ruby converts to ordinal value\n return m.digest\n end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def get_hash(s)\r\n\t\tvals = s.unpack('U*').map {|x| ((x ** 2000) * ((x + 2) ** 21) - ((x + 5) ** 3))}\r\n\t\tvals = vals.inject(0, :+) % 65536\r\n\t\treturn vals.to_s(16)\r\n\tend",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash_length\n super\n end",
"def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end",
"def hard_hash(password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n salt = RbNaCl::Random.random_bytes(RbNaCl::PasswordHash::SCrypt::SALTBYTES)\n digest = RbNaCl::PasswordHash.scrypt(password, salt,\n opslimit, memlimit, digest_size)\n [Base64.strict_encode64(digest), Base64.strict_encode64(salt)].join(\"\\n\")\nend"
] |
[
"0.83535093",
"0.83535093",
"0.83535093",
"0.83535093",
"0.83535093",
"0.83535093",
"0.83535093",
"0.81338674",
"0.7614914",
"0.76110756",
"0.75337726",
"0.7368831",
"0.72189116",
"0.7218189",
"0.7121973",
"0.71174353",
"0.71089965",
"0.7096447",
"0.7096447",
"0.70950156",
"0.7092571",
"0.7088192",
"0.706789",
"0.7049337",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.70475644",
"0.7012055",
"0.7004361",
"0.6995952",
"0.69657373",
"0.69356793",
"0.6930929",
"0.6895122",
"0.6894904",
"0.6847528",
"0.6846245",
"0.68451005",
"0.68428665",
"0.68197155",
"0.68069416",
"0.6802481",
"0.68017936",
"0.67994964",
"0.6798786",
"0.67849624",
"0.67849255",
"0.6781895",
"0.6779903",
"0.6764822",
"0.67528814",
"0.67340106",
"0.6730708",
"0.67291224",
"0.67146367",
"0.67119867",
"0.6710183",
"0.6708154",
"0.6707477",
"0.6701601",
"0.670151",
"0.67005247",
"0.6692164",
"0.6692164",
"0.668871",
"0.66758925",
"0.6653901",
"0.66483295",
"0.6620543",
"0.6617798",
"0.6617176",
"0.66076577",
"0.66076577",
"0.66068536",
"0.6602428",
"0.6600484",
"0.6600053",
"0.6582996",
"0.6575502",
"0.6570693",
"0.65629804",
"0.6560134",
"0.6555654",
"0.65384173",
"0.65349644",
"0.65349644",
"0.65349644",
"0.6522009",
"0.65212744",
"0.6513861",
"0.65128976",
"0.649664",
"0.6493123",
"0.64895403"
] |
0.0
|
-1
|
Returns an ordidinal date eg July 22 2007 > July 22nd 2007
|
def ordinalize(date)
date = datetime(date)
d = "<span class='date-month'>#{date.strftime('%b')}</span> "
d = "<span class='date-day'>#{date.strftime('%e')}</span> "
d += "<span class='date-suffix'>#{ordinal_suffix(date)}</span>, "
d += "<span class='date-year'>#{date.strftime('%Y')}</span>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ordinal_date(date)\n date - date.beginning_of_year\n end",
"def ordinalDate\n ordinal = DAYS_THUS_FAR[@month].to_i + @day.to_i\n if leapYear? && @month > 2\n ordinal = ordinal + 1\n end\n return ordinal\n end",
"def ordinalize(date)\n\t date = datetime(date)\n\t \"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}\"\n\tend",
"def formal_publication_date\n publication_date.to_s(:formal_wo_ordinal)\n end",
"def beginning_date\n Date.new(@number, 1, 1).tuesday? ? Date.new(@number, 1, 2) : Date.new(@number, 1, 1)\n end",
"def end_date\n Date.new((@number + 1), 1, 1).tuesday? ? Date.new((@number + 1), 1, 1) : Date.new(@number, 12, 31)\n end",
"def fy_end(date)\n year = date.year\n # are we in the first three months of the year?\n if(date.month < 4)\n Date.new(date.year,3,31)\n else\n Date.new(date.year+1,3,31)\n end\n end",
"def ordinalize(date)\n date = datetime(date)\n \"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}\"\n end",
"def status_to\n TermsCalculator.this_year_end.to_date\n end",
"def wrong_date(num)\n first_day(num).text\nend",
"def end_date\n Date.new(date.year, 12, 31)\n end",
"def next_yahrzeit_date(from=Date.today)\n return unless death_date\n # TODO: use Marlena rules\n h_from = Hebruby::HebrewDate.new(from)\n h_death = Hebruby::HebrewDate.new(death_date)\n # yahrzeit date from year\n h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year)\n date = Date.jd(h_yahrzeit.jd)\n if date < from\n h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year+1)\n date = Date.jd(h_yahrzeit.jd)\n end\n date\n end",
"def <=>(other_date)\n if self.year < other_date.year\n return -1\n elsif self.year > other_date.year\n return 1\n else\n if self.month < other_date.month\n return -1\n elsif\n self.month > other_date.month\n return 1\n else\n if self.day < other_date.day\n return -1\n elsif\n self.day > other_date.day\n return 1\n else\n return 0\n end\n end\n end\n end",
"def extention_valid_date\n if service_learning_risk_date_extention?\n if service_learning_risk_date > DateTime.new(service_learning_risk_date.year, 9, 1) \n DateTime.new(service_learning_risk_date.year.next, 9, 1)\n else \n DateTime.new(service_learning_risk_date.year, 9, 1)\n end\n end\n end",
"def fy(d)\n\t\td = d.to_date\n\t\tif(d.month >= 2)\n\t\t\treturn (d.year+1)\n\t\telse\n\t\t\treturn d.year\n\t\tend\n\tend",
"def to_date()\n #This is a stub, used for indexing\n end",
"def pub_date_facet\n return nil unless pub_date\n return \"#{pub_date.to_i + 1000} B.C.\" if pub_date.start_with?('-')\n return pub_date unless pub_date.include? '--'\n\n \"#{pub_date[0, 2].to_i + 1}th century\"\n end",
"def easy_date; date; end",
"def palindrome_date_after ( starting_date )\n if not starting_date.valid?\n print \"ERROR: \\\"#{starting_date}\\\" is not a valid date\\n\"\n return\n end\n\n # cut the year into the first two and last two digits\n starting_date_year_beginning = starting_date.year[0..1]\n starting_date_year_ending = starting_date.year[2..3]\n\nend",
"def human_occurrence_date(occurrence)\n if date = occurrence.date\n if date.year == Date.today.year\n date.strftime '%B %d'\n else\n date.strftime '%B %d, %Y'\n end\n end\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def ordinalize(date)\n \"#{date.strftime('%b %-d')}#{ordinal_suffix(date)}, #{date.strftime('%Y')}\"\n end",
"def ordinal_dayindex(num, day_index)\n # create a date object at the first occurrence of day_index\n first_occ_date = ZDate.new(ZDate.format_date(year_str, month_str)).this(day_index)\n # confirm that the day actually falls in the month\n this_month = ZDate.new(ZDate.format_date(year_str, month_str)).month\n if first_occ_date.month != this_month\n num += 1\n end\n\n # if num is 1 through 4, we can just add (num-1) weeks\n if num <= 4\n d = first_occ_date.add_weeks(num - 1)\n else\n # we want the last occurrence of this month\n # add 4 weeks to first occurrence, see if we are in the same month, subtract 1 week if we are not\n d = first_occ_date.add_weeks(4)\n if d.month != month\n d = d.sub_weeks(1)\n end\n end\n d\n end",
"def format_start_end_date(s_date, e_date)\n # Format the dates based on month and year.\n if (s_date.mon == e_date.mon) && (s_date.year == e_date.year)\n date = s_date.strftime(\"%b %d-\").to_s + e_date.strftime(\"%d, %Y\").to_s\n elsif s_date.year == e_date.year\n date = s_date.strftime(\"%b %d - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n else\n date = s_date.strftime(\"%b %d, %Y - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n end\n date\n end",
"def pub_date_sort\n if pub_date\n pd = pub_date\n pd = '0' + pd if pd.length == 3\n pd = pd.gsub('--', '00')\n end\n fail \"pub_date_sort was about to return a non 4 digit value #{pd}!\" if pd && pd.length != 4\n\n pd\n end",
"def edad\n hoy = Date.today\n hoy.year - fecha_de_nacimiento.year -\n ((hoy.month > fecha_de_nacimiento.month ||\n (hoy.month == fecha_de_nacimiento.month && hoy.day >= fecha_de_nacimiento.day)) ? 0 : 1)\n end",
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def my_date ( time )\n\t\treturn if time.nil?\n\t\t#past_day = -2.day.from_now\n\t\tif time > -2.day.from_now\n\t\t\treturn time_ago_in_words(time)\n\t\telse\n\t\t\treturn time.strftime(\"%b %d %Y\")\n\t\tend\n\tend",
"def return_date\n\t\tif(last_line_modified_date && last_modified_date != nil)\n\t\t\tif(last_line_modified_date <= last_modified_date)\n\t\t\t\treturn last_line_modified_date()\n\t\t\telse\n\t\t\t\treturn last_modified_date()\n\t\t\tend\n\t\telse\n\t\t\treturn '2000-01-01'\n\t\tend\n\tend",
"def date()\n\t\t(@start_date.to_time + (10**9)).to_date\n\tend",
"def date\n (birthday.to_time + 10**9).to_date\n end",
"def last_run\n DateTime.parse(\"1 Jan 2007\")\n end",
"def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end",
"def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end",
"def eBY_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%e %B %Y\")\n end\n result\n end",
"def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end",
"def humanize_date(date)\n current = Date.today\n case\n when (3..6).include?(date.yday - current.yday)\n date.strftime(\"This %A\")\n when date.yday == (current.yday + 2)\n \"In two days\"\n when date.yday == (current.yday + 1)\n \"Tomorrow\"\n when date.yday == current.yday\n \"Today\"\n when date.yday == (current.yday - 1)\n \"Yesterday\"\n when date.yday == (current.yday - 2)\n \"Two days ago\"\n when (3..6).include?((current.yday - date.yday).abs)\n date.strftime(\"%A\")\n when date.year != current.year\n date.strftime(\"%m/%d/%Y\")\n when date.cweek == (current.cweek + 2)\n date.strftime(\"%A in two weeks\")\n when date.cweek == (current.cweek + 1)\n date.strftime(\"Next %A\")\n when date.cweek == (current.cweek - 1)\n date.strftime(\"Last %A\")\n when date.cweek == (current.cweek - 2)\n date.strftime(\"%A two weeks ago\")\n else\n date.strftime(\"%b %d\")\n end\n end",
"def ano\n Date.today.strftime('%y')\n end",
"def yday() end",
"def get_object_sortable_date\n\t\tdate = nil\n if descMetadata.origin_info && (descMetadata.origin_info.date_issued || descMetadata.origin_info.date_valid)\n\t\t\tbegin\n\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first.to_s\n\t\t\t\tdate_issued = descMetadata.origin_info.date_issued.first.to_s\n\t\t\t\t\t\n\t\t\t\tif date_valid.size > 0\n\t\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first\n\t\t\t\t\tif date_valid.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_valid[date_valid.index('/')+1..date_valid.size])\n\t\t\t\t\telse\n\t\t\t\t\t\t\tval = to_long_date(date_valid) \n\t\t\t\t\tend\n\t\t\t\telsif\tdate_issued.size > 0\n\t\t\t\t\tif date_issued.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_issued[date_issued.index('/')+1..date_issued.size])\n\t\t\t\t\telse\t\t\t\n\t\t\t\t\t\tval = to_long_date(descMetadata.origin_info.date_issued.first)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\t\t\tif val\n\t\t\t\t\tdate = Time.parse val\n\t\t\t\tend\n\t\t\trescue ArgumentError => e\n #nop\n end\n\t\tend\n\tend",
"def date_string\n times = []\n showtimes.all.each do |time|\n times << time.date_time\n end\n times = times.sort\n first_date = times.first.to_date.strftime('%m/%d')\n last_date = times.last.to_date.strftime('%m/%d')\n output = first_date\n if last_date != first_date\n output += \" - \" + last_date\n end\n return output\n end",
"def to_date\n find\n end",
"def published_natural\n @published.strftime(\"#{@published.day.ordinalize} %B %Y\")\n end",
"def sortable_year_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n\n if orig_date_str =~ /^\\-/\n # negative number becomes x - 1000 for sorting; -005 for -995\n num = orig_date_str[1..-1].to_i - 1000\n return '-' + num.to_s[1..-1].rjust(3, '0')\n else\n return orig_date_str.rjust(4, '0')\n end\n end",
"def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend",
"def human_date() # for Date object\n # return 'tomorrow' if tomorrow?\n # return 'today' if today?\n # return 'yesterday' if yesterday?\n # return \"HumanDateBoh(#{to_s})\" # TBD\n cool_date2()\n end",
"def book_return_date\n max_brw_days = Library.find(self[:library_id]).max_borrow_days\n start_date = self[:start]\n\n if !start_date.nil?\n last_date = start_date + max_brw_days.days\n return last_date.to_date.strftime(\"%b-%d-%Y\")\n end\n end",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def to_s\n return last_day if start_date == end_date\n \n format = ELEMENTS\n format = format.chomp(' %Y') if start_date.year == end_date.year\n format = format.chomp(' %b') if start_date.month == end_date.month\n first_day = start_date.strftime(format)\n first_day + ' - ' + last_day\n end",
"def next_yahrzeit_date(from=Date.today)\n return unless death_hebrew_date_day && death_hebrew_date_month\n @next_yahrzeit_date ||= begin\n # TODO: use Marlena rules\n h_from = Hebruby::HebrewDate.new(from)\n # yahrzeit date from year\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year)\n date = Date.jd(h_yahrzeit.jd)\n if date < from\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year+1)\n date = Date.jd(h_yahrzeit.jd)\n end\n date\n end\n end",
"def date\n Date.civil(year, month, 1)\n end",
"def year_rome_founded\n bce(753)\n end",
"def date\n calc_date = self.day % 30\n calc_date == 0 ? 30 : calc_date\n end",
"def nice_dob\n\t\t@nice_dob = @dob.strftime(\"%A the #{@dob.day.ordinalize} %B %Y\")\n\tend",
"def dmy_date(date)\n Time.gm(date.year, date.month, date.day)\n end",
"def date(date_name)\r\n case date_name\r\n when :start\r\n return self.accommodation_histories.last.from\r\n when :end\r\n return self.accommodation_histories.last.to\r\n else\r\n return 0\r\n end\r\n end",
"def get_revdate(doc_path)\n doc = Nokogiri::HTML(File.open(doc_path)) { |config| config.strict.nonet}\n revdate = doc.search('//span[@id=\"revdate\"]').text.strip\n DateTime.strptime(revdate, '%Y-%m-%d') if /^\\d{4}-\\d{2}-\\d{2}$/.match(revdate)\nend",
"def idade\n if nascimento != nil\n now = Time.now.utc.to_date\n now.year - nascimento.year - ((now.month > nascimento.month || (now.month == nascimento.month && now.day >= nascimento.day)) ? 0 : 1)\n else\n '--'\n end \n end",
"def next_anniversary_date\n while (@due_date <= Date.today)\n @due_date = Date.new(@year += 1, @month, @day)\n end\n end",
"def easter\n y = year\n a = y % 19\n b = y / 100\n c = y % 100\n d = b / 4\n e = b % 4\n f = (b + 8) / 25\n g = (b - f + 1) / 3;\n h = (19 * a + b - d - g + 15) % 30\n i = c / 4\n k = c % 4\n l = (32 + 2 * e + 2 * i - h - k) % 7\n m = (a + 11 * h + 22 * l) / 451\n month = (h + l - 7 * m + 114) / 31\n day = ((h + l - 7 * m + 114) % 31) + 1\n Date.civil(year, month, day)\n end",
"def expense_at\n object.expense_date ? object.expense_date.strftime(\"%a %d/%m//%y\") : 'Not defined'\n end",
"def date_accounting(date, date_accounting)\n return date unless date_accounting\n\n if date.month == 1 && date_accounting[0..1] == \"12\"\n year = date.year - 1\n else\n year = date.year\n end\n\n parse_date(year.to_s[2..3] + date_accounting)\n end",
"def sortable_year_int_for_early_numeric\n return orig_date_str.to_i if orig_date_str.match(EARLY_NUMERIC)\n\n orig_date_str.to_i if orig_date_str =~ /^-\\d{4}$/\n end",
"def get_date(index:)\n\t\t\treturn (@start_date + index).to_s\n\t\tend",
"def due_date\n students = self.accessible_students \n return nil if students.length == 0\n\n date = students.first.due_date\n students.find_each do |student|\n if student.due_date \n if !date || student.due_date > date\n date = student.due_date\n end\n end\n end\n\n date\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def stop_date\n\t\t#return Date.new(y=year+1, m=START_MONTH, d=START_DAY) - 1\n\t\treturn start_date.next_year.prev_day()\n\tend",
"def wrong_day_30(num)\n if two_30_one_31_last(num)\n calendar_date(num, 1)\n elsif two_30_one_31_not_last(num) || two_30_two_31\n calendar_date(num, 2)\n end\nend",
"def fiscal_year_start_date\n Date.today.month < 7 ? \"07/01/#{Date.today.year - 1}\" : \"07/01/#{Date.today.year}\"\n end",
"def new_driver_date\n Chronic.parse('16 years ago').strftime('%m/%d/%Y')\n end",
"def display_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n # return 1 B.C. when the date is 0 since there is no 0 year\n return '1 B.C.' if orig_date_str == '0'\n # negative number becomes B.C.\n return \"#{orig_date_str[1..-1].to_i + 1} B.C.\" if orig_date_str =~ /^\\-/\n\n # remove leading 0s from early dates\n \"#{orig_date_str.to_i} A.D.\"\n end",
"def longdate(d)\n d.strftime(\"%b %d\")\n end",
"def date\n page.version.authored_date.strftime(\"%B %d, %Y\")\n end",
"def born_date\n super.to_s(:long)\n end",
"def compute_date_to\n\t\t\t\t\tif self.period.to_sym == :year\n\t\t\t\t\t\tself.to = self.from + 1.year - 1.day\n\t\t\t\t\telsif self.period.to_sym == :month\n\t\t\t\t\t\tself.to = self.from + 1.month - 1.day\n\t\t\t\t\tend\n\t\t\t\tend",
"def serial_to_date (s)\r\n\t\t# round down and convert from string if need be\r\n\t\t# zero day is actually \"Jan 0\" and indexing starts from 1, so subtract 2\r\n\t\ts = s.to_i() - 2\r\n\t\t# add to zero day\r\n\t\treturn JAN_1_1900 + s\r\n\tend",
"def end_date\n @records.max { |a,b| a[:date] <=> b[:date] }[:date]\n end",
"def date\n object.date.strftime('%a %b %e') rescue nil\n end",
"def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end",
"def to_date string\n \n end",
"def printHTMLDateShort(tobj)\n return alStrftime(tobj,'%y-%m-%d')\n end",
"def get_date\n format_date DateTime.new(2011, 1, 1, 17, 9, 59)\n end",
"def nextDate\n sd = SimpleDate.new(@month, @day, @year)\n\n if (sd.month == 12 && sd.day == 31)\n return SimpleDate.new(1, 1, @year+1)\n\n elsif (leapYear? && sd.month == 2 && sd.day == DAYS_IN_MONTH[sd.month] )\n return SimpleDate.new(2, 29, @year)\n\n elsif(sd.day == SimpleDate.daysInMonth(month, year))\n return SimpleDate.new(@month + 1, 1, @year)\n\n else\n return SimpleDate.new(@month, @day + 1, @year)\n end\n end",
"def unusual_day_4(num)\n if one_30_last(num)\n calendar_date(num, 1)\n elsif one_30_not_last(num) || two_30_one_31_last(num)\n calendar_date(num, 2)\n elsif two_30_one_31_not_last(num) || two_30_two_31\n calendar_date(num, 3)\n end\nend",
"def date_humanized(date_as_integer)\n begin\n Time.at(date_as_integer).to_date.strftime(\"%m/%d/%y\")\n rescue\n nil\n end\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def base_date\n @base_date ||= lambda do\n date_base_element = workbook.search('workbookPr').attribute('date1904')\n if date_base_element && date_base_element.value.to_i == 1\n Date.parse('1904-01-01')\n else\n Date.parse('1900-01-01')\n end\n end.call\n end",
"def test_Date_001_Ruby_DateManipulation\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Date_001_Ruby_DateManipulation\")\n puts2(\"#######################\")\n\n sDateString = \"2/29/2000\"\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"2/29/2004\"\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"12/31/2018\"\n\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"/\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n\n ######################\n sDateString = \"12-31-18\"\n puts2(\"######################\")\n puts2(\"Convert #{sDateString}\")\n\n aDate = sDateString.split(\"-\")\n\n iMonth = aDate[0].to_i\n iDay = aDate[1].to_i\n iYear = aDate[2].to_i\n\n puts2(\" Month: #{iMonth.to_s}, Day #{iDay.to_s}, Year #{iYear.to_s}\")\n\n puts2(\"\")\n puts2(\"Create a date object from the MM, DD, YY strings\")\n\n # Convert 2 digit years into 4-digit years\n if(iYear <= 99)\n iYear = (2000 + iYear)\n puts2(\"Now try with a 4-digit year: #{iYear.to_s}\")\n end\n\n # Create a date object\n #\n # Syntax: Date.new(y=-4712, m=1, d=1, sg=ITALY)\n tDate = Date.new(iYear, iMonth, iDay)\n puts2(\"The date is #{tDate.to_s}\")\n\n tDayBefore = tDate -1\n puts2(\"The day before is #{tDayBefore.to_s}\")\n puts2(\"The day before is also #{tDayBefore.strftime(\"%m/%d/%Y\")}\")\n\n tDayAfter = tDate.next\n puts2(\"The day after is #{tDayAfter.to_s}\")\n\n tMonthBefore = tDate << 1\n puts2(\"The month before is #{tMonthBefore.to_s}\")\n\n tMonthAfter= tDate >> 1\n puts2(\"The month after is #{tMonthAfter.to_s}\")\n\n tYearBefore = tDate << 12\n puts2(\"The year before is #{tYearBefore.to_s}\")\n\n tYearAfter = tDate >> 12\n puts2(\"The year after is #{tYearAfter.to_s}\")\n ######################\n\n end",
"def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self.date_completed\n #Parse date into DATETIME format\n date = DateTime.parse(date_string)\n #if the action has not been completed return string anouncing when the action\n #will occur. Logic needed to check if the date is upcoming or overdue.\n if @completed == 'f'\n if date.to_date > Date.today\n return \"DUE: #{date.strftime(\"%B %e, %Y\")}\"\n elsif date.to_date == Date.today\n return \"DUE Today\"\n elsif date.to_date < Date.today\n return \"OVERDUE: #{date.strftime(\"%B %e, %Y\")}\"\n end\n #if action has already been completed, return the date completed.\n else\n return \"#{date.strftime(\"%B %e, %Y\")}\"\n end\n end",
"def openurl_date(date_xml)\n date = \"\"\n \n if y = date_xml.at(\"Year\")\n date << (\"%04d\" % y.inner_text.strip[0,4].to_i )\n if m = date_xml.at(\"Month\")\n # Month name to number\n date << ( \"%02d\" % DateTime.parse(m.inner_text.strip).month )\n if d = date_xml.at(\"Day\")\n date << (\"%02d\" % d.inner_text.strip[0,2].to_i)\n end\n end\n end\n \n return date \n end",
"def start_date_of_roll_period(year, month)\n # todo, to be truly accurate with respect to the description, this should figure out the date of the Tuesday prior to the settlement date, but I think subtracting one day is the real intention.\n vix_futures_settlement_date(year, month) - 1\n # prior_cboe_business_day(vix_futures_settlement_date(year, month))\nend",
"def date_page_format\n '%B %d, %Y'\n end"
] |
[
"0.70651805",
"0.6544691",
"0.6328653",
"0.6306783",
"0.62496173",
"0.6229167",
"0.6201334",
"0.61696476",
"0.6149758",
"0.6097611",
"0.60683614",
"0.6061975",
"0.6058672",
"0.6047912",
"0.6009844",
"0.60011184",
"0.5972587",
"0.5970493",
"0.5957971",
"0.59431934",
"0.59406775",
"0.59406775",
"0.59406775",
"0.59406775",
"0.59353936",
"0.5929576",
"0.5908827",
"0.59008527",
"0.58945745",
"0.5894066",
"0.58901757",
"0.58829725",
"0.58482313",
"0.5828724",
"0.57847166",
"0.5782443",
"0.57791805",
"0.57773834",
"0.5774827",
"0.5756714",
"0.5740604",
"0.572717",
"0.5723967",
"0.57095534",
"0.5706606",
"0.5697965",
"0.5697104",
"0.5690967",
"0.5689329",
"0.56764203",
"0.56759316",
"0.56631726",
"0.5658293",
"0.5641886",
"0.5632217",
"0.5632165",
"0.5630922",
"0.56181294",
"0.5608639",
"0.5607756",
"0.560543",
"0.56050766",
"0.560401",
"0.55951446",
"0.5581947",
"0.5571613",
"0.5571375",
"0.5568045",
"0.5566623",
"0.55575985",
"0.5550582",
"0.5550582",
"0.5550582",
"0.5546286",
"0.55437225",
"0.5536755",
"0.5536667",
"0.5531035",
"0.55302954",
"0.5521593",
"0.55177414",
"0.5517093",
"0.55151093",
"0.55132765",
"0.55106723",
"0.55082095",
"0.5507504",
"0.5503547",
"0.55027425",
"0.5501789",
"0.5497189",
"0.54970396",
"0.54960525",
"0.54960525",
"0.54896194",
"0.54880595",
"0.5485576",
"0.54767936",
"0.5473163",
"0.5470955"
] |
0.61111826
|
9
|
Returns an ordinal number. 13 > 13th, 21 > 21st etc.
|
def ordinal_suffix(date)
number = date.strftime('%e').to_i
if (11..13).include?(number % 100)
"th"
else
case number % 10
when 1; "st"
when 2; "nd"
when 3; "rd"
else "th"
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ordinal; end",
"def ordinal\n self.to_s +\n if (11..13).include?(self % 100)\n \"th\"\n else\n case self % 10\n when 1 then \"st\"\n when 2 then \"nd\"\n when 3 then \"rd\"\n else \"th\"\n end\n end\n end",
"def ordinal( number )\n\t\tcase number\n\t\twhen Integer\n\t\t\treturn number.to_s + (Nth[ number % 100 ] || Nth[ number % 10 ])\n\n\t\telse\n\t\t\treturn number.to_s.sub( /(#{OrdinalSuffixes})\\Z/ ) { Ordinals[$1] }\n\t\tend\n\tend",
"def ordinal(num)\ncase num\n when 1\n \"1st\"\n when 2\n '2nd'\n when 3\n '3rd'\n when 4\n '4th'\n when 5\n '5th'\n when 6\n 'last'\n end\nend",
"def ordinal(number)\n \tending =\n case number % 100\n when 11, 12, 13 then 'th'\n else\n case number % 10\n when 1 then 'st'\n when 2 then 'nd'\n when 3 then 'rd'\n else 'th'\n end\n end\n\t\treturn number.to_s + ending\n end",
"def ordinal\n case self % 100\n when 11..13; \"#{self}th\"\n else\n case self % 10\n when 1; \"#{self}st\"\n when 2; \"#{self}nd\"\n when 3; \"#{self}rd\"\n else \"#{self}th\"\n end\n end\n end",
"def ordinal(n)\n ending = case n % 100\n when 11, 12, 13 then 'th'\n else\n case n % 10\n when 1 then 'st'\n when 2 then 'nd'\n when 3 then 'rd'\n else 'th'\n end\n end\n\n \"#{n}#{ending}\"\nend",
"def ordinal(number)\n abs_number = number.to_i.abs\n\n if (11..13).include?(abs_number % 100)\n \"th\"\n else\n case abs_number % 10\n when 1; \"st\"\n when 2; \"nd\"\n when 3; \"rd\"\n else \"th\"\n end\n end\nend",
"def ordinalize(number)\n if (number.to_i==-1)\n\t'last'\n elsif (number.to_i==-2)\n\t'second to last'\n elsif (11..13).include?(number.to_i % 100)\n\t\"#{number}th\"\n else\n\tcase number.to_i % 10\n\t when 1 then \"#{number}st\"\n\t when 2 then \"#{number}nd\"\n\t when 3 then \"#{number}rd\"\n\t else \"#{number}th\"\n\tend\n end\n end",
"def ordinalize\n if (11..13).include?(self % 100)\n \"#{self}th\"\n else\n case self % 10\n when 1; \"#{self}st\"\n when 2; \"#{self}nd\"\n when 3; \"#{self}rd\"\n else \"#{self}th\"\n end\n end\n end",
"def ordinalDate\n ordinal = DAYS_THUS_FAR[@month].to_i + @day.to_i\n if leapYear? && @month > 2\n ordinal = ordinal + 1\n end\n return ordinal\n end",
"def ordinal_indicator(number)\n if number == 0\n return \"zero\"\n elsif number.to_s.chars.map(&:to_i).last == 1 && number != 11\n return \"#{number}st\"\n elsif number.to_s.chars.map(&:to_i).last == 2 && number != 12\n return \"#{number}nd\"\n elsif number.to_s.chars.map(&:to_i).last == 3 && number != 13\n return \"#{number}rd\"\n else\n return \"#{number}th\"\n end\nend",
"def number_to_ordinal(num)\n if params[:locale] == \"en\"\n num = num.to_i\n if (10...20)===num\n \"#{num}th\"\n else\n g = %w{ th st nd rd th th th th th th }\n a = num.to_s\n c=a[-1..-1].to_i\n a + g[c]\n end\n else\n num = num.to_i\n raw \"#{num}ª\"\n end\n end",
"def english_ordinal n\n str = n.to_s\n str +\n case str\n when /11$/, /12$/, /13$/\n 'th'\n when /1$/\n 'st'\n when /2$/\n 'nd'\n when /3$/\n 'rd'\n else\n 'th'\n end\nend",
"def ordinal(num)\n\tnum = num.to_s\n\tnum2 = num.to_i\n\n if num == \"1\" || num2 % 10 == 1 && num[num.length-2] != \"1\"\n return \"st\"\n elsif num == \"2\" || num2 % 10 == 2 && num[num.length-2] != \"1\"\n return \"nd\"\n elsif num == \"3\" || num2 % 10 == 3 && num[num.length-2] != \"1\"\n return \"rd\"\n else\n return \"th\"\n end\nend",
"def ordinal(int)\n ActiveSupport::Inflector.ordinalize(int.to_i)\n end",
"def ordinalize(number)\n if (11..13).include?(number.to_i.abs % 100)\n \"#{number}th\"\n else\n case number.to_i.abs % 10\n when 1; \"#{number}st\"\n when 2; \"#{number}nd\"\n when 3; \"#{number}rd\"\n else \"#{number}th\"\n end\n end\n end",
"def ordinal(input)\n if (11..13).include?(input.to_i % 100)\n \"#{input}th\"\n else\n case input.to_i % 10\n when 1 then \"#{input}st\"\n when 2 then \"#{input}nd\"\n when 3 then \"#{input}rd\"\n else \"#{input}th\"\n end\n end\n end",
"def ordinalize(number)\n if (11..13).include?(number.to_i.abs % 100)\n \"#{number}th\"\n else\n case number.to_i.abs % 10\n when 1; \"#{number}st\"\n when 2; \"#{number}nd\"\n when 3; \"#{number}rd\"\n else \"#{number}th\"\n end\n end\n end",
"def ordinalize(number)\n if (11..13).include?(number.to_i.abs % 100)\n \"#{number}th\"\n else\n case number.to_i.abs % 10\n when 1; \"#{number}st\"\n when 2; \"#{number}nd\"\n when 3; \"#{number}rd\"\n else \"#{number}th\"\n end\n end\n end",
"def ordinal(number)\n Geode::FastInflector.ordinal(number.to_i)\n end",
"def ordinalize(number)\n if (11..13).include?(number.to_i % 100)\n \"#{number}th\"\n else\n case number.to_i % 10\n when 1; \"#{number}st\"\n when 2; \"#{number}nd\"\n when 3; \"#{number}rd\"\n else \"#{number}th\"\n end\n end\n end",
"def ordinalize(num_str)\n if num_str[-2] == '1'\n \"#{num_str}th\"\n else\n case num_str[-1]\n when '0' || '4' || '5' || '6' || '7' || '8' || '9' \n \"#{num_str}th\"\n when '1'\n \"#{num_str}st\"\n when '2'\n \"#{num_str}nd\"\n when '3'\n \"#{num_str}rd\"\n end\n end\nend",
"def ordinal(number)\n if (11..13).include?(number.to_i % 100)\n \"#{number}<span>th</span>\"\n else\n case number.to_i % 10\n when 1; \"#{number}<span>st</span>\"\n when 2; \"#{number}<span>nd</span>\"\n when 3; \"#{number}<span>rd</span>\"\n else \"#{number}<span>th</span>\"\n end\n end\n end",
"def ordinal(number)\n\t if (11..13).include?(number.to_i % 100)\n\t \"#{number}<sup>th</sup>\"\n\t else\n\t case number.to_i % 10\n\t when 1; \"#{number}<sup>st</sup>\"\n\t when 2; \"#{number}<sup>nd</sup>\"\n\t when 3; \"#{number}<sup>rd</sup>\"\n\t else \"#{number}<sup>th</sup>\"\n\t end\n\t end\n\tend",
"def ordinal\n ActiveSupport::Inflector.ordinal(self)\n end",
"def ordinal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 56 )\n value = nil\n ordinal_start_index = @input.index\n t = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return value\n end\n # at line 346:26: t= ( ST | ND | RD | TH )\n t = @input.look\n if @input.peek( 1 ).between?( ST, TH )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = t.text[/^\\d+/].to_i\n # <-- action\n end\n\n success = true\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__, 56 )\n memoize( __method__, ordinal_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end",
"def format_ordinal(number)\n number.to_s + ORDINALS.fetch(number.to_s[-1].to_sym, 'th')\nend",
"def ordinal(number, rule: nil, **)\n ordinal_rules.format(number, \"digits-ordinal#{\"-#{rule}\" if rule}\")\n rescue Nii::RBNF::MissingRuleSet\n ordinal_rules.format(number, 'digits-ordinal')\n end",
"def ordinal_dayindex(num, day_index)\n # create a date object at the first occurrence of day_index\n first_occ_date = ZDate.new(ZDate.format_date(year_str, month_str)).this(day_index)\n # confirm that the day actually falls in the month\n this_month = ZDate.new(ZDate.format_date(year_str, month_str)).month\n if first_occ_date.month != this_month\n num += 1\n end\n\n # if num is 1 through 4, we can just add (num-1) weeks\n if num <= 4\n d = first_occ_date.add_weeks(num - 1)\n else\n # we want the last occurrence of this month\n # add 4 weeks to first occurrence, see if we are in the same month, subtract 1 week if we are not\n d = first_occ_date.add_weeks(4)\n if d.month != month\n d = d.sub_weeks(1)\n end\n end\n d\n end",
"def get_next_ordinal\n # largest_ordinal = 0\n # self.lesson_modules.each do | lesson_module | \n # largest_ordinal = lesson_module.lesson_ordinal if lesson_module.lesson_ordinal > largest_ordinal\n # end\n # return largest_ordinal + 1\n\n # Alternative\n return self.lesson_modules.max_by(&:lesson_ordinal).lesson_ordinal + 1\n end",
"def ordinalize(number)\n Geode::FastInflector.ordinalize(number.to_i)\n end",
"def __next_ordinal__\n\t\t\t\treturn_value = @ordinal\n\t\t\t\t@ordinal = @ordinal.next\n\t\t\t\treturn_value\n\t\t\tend",
"def ordinals(numbers)\n numbers.map do |x|\n if x % 10 == 1\n \"#{x}st\"\n elsif x % 10 == 2\n \"#{x}nd\"\n elsif x % 10 == 3\n \"#{x}rd\"\n else\n \"#{x}th\"\n end\n end\nend",
"def number_to_ord(i)\n nums_hash = { \n \"1\" =>\t\"First\",\n \"2\" =>\t\"Second\",\n \"3\" =>\t\"Third\",\n \"4\" =>\t\"Fourth\",\n \"5\" =>\t\"Fifth\",\n \"6\" =>\t\"Sixth\",\n \"7\" =>\t\"Seventh\",\n \"8\" =>\t\"Eighth\",\n \"9\" =>\t\"Ninth\",\n \"10\" =>\t\"Tenth\",\n \"11\" => \"Eleventh\",\n \"12\" =>\t\"Twelfth\",\n \"13\" => \"Thirteenth\",\n \"14\" => \"Fourteenth\",\n \"15\" => \"Fifteenth\",\n \"16\" => \"Sixteenth\",\n \"17\" => \"Seventeenth\",\n \"18\" => \"Eighteenth\",\n \"19\" => \"Nineteenth\",\n \"20\" => \"Twentieth\"\n }\n nums_hash[i.to_s]\nend",
"def ordinalize(date)\n\t date = datetime(date)\n\t \"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}\"\n\tend",
"def numericize_ordinals(text) #:nodoc:\n text = text.gsub(/\\b(\\d*)(st|nd|rd|th)\\b/, '\\1')\n end",
"def ordinalize(date)\n date = datetime(date)\n \"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}\"\n end",
"def ordinal_suffix(number)\n last_two_digits = number.abs % 100\n\n if (11..13).include?(last_two_digits)\n \"th\"\n else\n last_digit = number.abs % 10\n case last_digit\n when 1; \"st\"\n when 2; \"nd\"\n when 3; \"rd\"\n else \"th\"\n end\n end\nend",
"def day_num_to_index(day_num)\n check_pre((\n (day_num.int?)\n ))\n\n return day_num - 1\nend",
"def ordinal_abbreviation; end",
"def ordinal_date(date)\n date - date.beginning_of_year\n end",
"def append_ordinal_suffix(num)\n right_most_digit = num % 10\n case right_most_digit\n when 1 \n puts \"#{num}st\"\n when 2\n puts \"#{num}nd\"\n when 3\n puts \"#{num}rd\"\n else\n puts \"#{num}th\"\n end\nend",
"def ordinal_suffix(date)\n number = date.strftime('%e').to_i\n if (11..13).include?(number % 100)\n \"th\"\n else\n case number % 10\n when 1; \"st\"\n when 2; \"nd\"\n when 3; \"rd\"\n else \"th\"\n end\n end\n end",
"def ordinal_rules = rbnf(:ordinal_rules)",
"def statement_day_ordinal\n return '' if statement_day.nil?\n statement_day.ordinalize\n end",
"def append_ordinal_suffix(num)\n case num % 10\n when 1 \n \"st\"\n when 2\n \"nd\"\n when 3\n \"rd\"\n else\n \"th\"\n end\nend",
"def num_into_string(number)\n puts number.ordinalize\nend",
"def day_to_index(day_num)\n check_pre((\n (day_num.int?)\n ))\n\n return day_num - 1\nend",
"def dayNum\n ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'].index(self.day.downcase)\n end",
"def ordinals(numbers)\n# ordinals = []\n# numbers.map do |number|\n# if number = 1\n# number.to_s + 'st'\n# elsif number = 2\n# number.to_s + 'nd'\n# elsif number = 3\n# number.to_s + 'rd'\n# elsif\n# number.to_s + 'th'\n# end\n# end\nend",
"def ordinals(numbers)\n rules = {\n 1 => 'st',\n 2 => 'nd',\n 3 => 'rd'\n }\n # Exceptions: 11th, 12th, 13th, 0th\n\n numbers.map do |n|\n if n == 11 || n == 12 || n == 13 || n == 0\n \"#{n}th\"\n else\n last_digit = n % 10\n predicate = rules[last_digit] || \"th\"\n n.to_s + predicate\n end\n end\n\n # numbers.map do |x|\n # x = x.to_s\n # if(x[x.length-1] == \"1\")\n # x = \"#{x}st\"\n # elsif(x[x.length-1] == \"2\")\n # x = \"#{x}nd\"\n # elsif(x[x.length-1] == \"3\")\n # x = \"#{x}rd\"\n # elsif(x == '11')\n # x = \"#{x}th\"\n # else\n # x = \"#{x}th\"\n # end\n # end\n\nend",
"def ordinal_special\n return 'once' if self == 1\n self.ordinal\n end",
"def to_i\n 9999\n end",
"def ordinalize(date)\n \"#{date.strftime('%b %-d')}#{ordinal_suffix(date)}, #{date.strftime('%Y')}\"\n end",
"def next_order_number\n return 0 unless highest_order_number\n highest_order_number + 1\n end",
"def ordinalize(date)\n date = datetime(date)\n d = \"<span class='date-month'>#{date.strftime('%b')}</span> \"\n d = \"<span class='date-day'>#{date.strftime('%e')}</span> \"\n d += \"<span class='date-suffix'>#{ordinal_suffix(date)}</span>, \"\n d += \"<span class='date-year'>#{date.strftime('%Y')}</span>\"\n end",
"def to_index(input)\n input.to_i - 1\n end",
"def index_to_day_num(index)\n check_pre((\n (index.int?)\n ))\n\n return index + 1\nend",
"def jd_to_ordinal(j, sg=nil)\n jd(j).send(:ordinal)\n end",
"def input_to_index(num)\n return num.to_i - 1\n end",
"def nth(n)\n if n > 9 and n.to_s[-2..-1].to_i.between?(10,19)\n \"#{n}th\"\n elsif n.to_s[-1].to_i == 1\n \"#{n}st\"\n elsif n.to_s[-1].to_i == 2\n \"#{n}nd\"\n elsif n.to_s[-1].to_i == 3\n \"#{n}rd\"\n else\n \"#{n}th\"\n end \n end",
"def get_actual_number(number)\n if number >= 31\n return number + 2\n else\n return number + 1\n end\n end",
"def order\n @num\n end",
"def input_to_index(d)\n digit = d.to_i\n digit -= 1\n return digit\nend",
"def input_to_index(masuk)\n tes=masuk.to_i\n tes=tes-1\n return tes\nend",
"def next_game_ordinal\n last_set ? last_set.set_games.count + 1 : 0\n end",
"def ord\n self\n end",
"def nth\n num = self.class.all_in_current_meeting.index(self)\n num ? num.ordinalize : nil\n end",
"def td_number_before_saison\n return 3\n end",
"def input_to_index(input)\r\n return input.to_i - 1\r\n end",
"def getMonthOrderNumber(str)\n months_dictionary = {\"Jan\" => 1, \"January\" => 1, \"Januari\" => 1,\n \"Feb\" => 2, \"February\" => 2, \"Februari\" => 2,\n \"Mar\" => 3, \"March\" => 3, \"Maret\" => 3,\n \"Apr\" => 4, \"April\" => 4,\n \"May\" => 5, \"Mei\" => 5,\n \"Jun\" => 6, \"Juny\" => 6, \"Juni\" => 6,\n \"Jul\" => 7, \"July\" => 7, \"Juli\" => 7,\n \"Aug\" => 8, \"August\" => 8, \"Agu\" => 8, \"Agustus\" => 8,\n \"Sep\" => 9, \"September\" => 9,\n \"Oct\" => 10, \"October\" => 10, \"Okt\" => 10, \"Oktober\" => 10,\n \"Nov\" => 11, \"November\" => 11, \"Nop\" => 11, \"Nopember\" => 11,\n \"Dec\" => 12, \"December\" => 12, \"Des\" => 12, \"Desember\" => 12}\n\n return months_dictionary[str]\nend",
"def input_to_index(input)\n return input.to_i - 1\n end",
"def to_digit\n return NUMBER[self] if self <= 9 && self >= 0\n NUMBER[0]\n end",
"def strftime_ordinalized(fmt, format=nil)\n strftime(fmt.gsub(/(^|[^-])%d/, '\\1_%d_')).gsub(/_(\\d+)_/) { |s| s.to_i.ordinalize }\n end",
"def input_to_index(input)\n\t\tinput.to_i - 1\n\tend",
"def with_ordinality\n with_opts(:with_ordinality=>true)\n end",
"def next_sort_index\n (todo.items.map(&:sort_index).max rescue 0).to_f + 1\n end",
"def input_to_index(input)\n input.to_i - 1\n end",
"def input_to_index(input)\n input.to_i-1\nend",
"def input_to_index(input)\n input.to_i-1\nend",
"def decode_int\n # @index is at the position of the the 'i' so we just need everything between it\n # and the next appearance of 'e'.\n index_of_last_digit = self[@index..self.length - 1].index 'e'\n number_string = self[(@index + 1)..(@index + index_of_last_digit - 1)]\n @index += index_of_last_digit\n number_string.to_i\n end",
"def input_to_index(input)\r\n input.to_i - 1 \r\nend",
"def input_to_index(int)\n return int.to_i - 1\nend",
"def sequence_number; end",
"def column_name_to_num(name)\n num = 0\n name.upcase.each_char do |c|\n num *= 26 if num > 0\n add = c.ord - \"A\".ord + 1\n raise \"Invalid symbol in Excel column name: '#{c}'\" if add < 1 || add > 26\n num += add\n end\n num - 1\n end",
"def current_comic_number\r\n \tcomic_number = Array.new(sorted_articles.reverse)\r\n \tcomic_number.index(item) + 1\r\n end",
"def input_to_index tato\n tato.to_i - 1\nend",
"def input_to_index(input)\n (input.to_i) - 1\nend",
"def input_to_index(inni)\n (inni.to_i - 1)\n \nend",
"def input_to_index(x)\n\n return x.to_i-1\nend",
"def ord\n self\n end",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend"
] |
[
"0.7952719",
"0.77893436",
"0.7652014",
"0.76424587",
"0.76253253",
"0.7611344",
"0.7590462",
"0.74581045",
"0.7259988",
"0.72439486",
"0.71933925",
"0.71654654",
"0.716448",
"0.7158124",
"0.71265537",
"0.71008736",
"0.7089188",
"0.70479774",
"0.70152426",
"0.70152426",
"0.69916683",
"0.6985847",
"0.69646025",
"0.6908709",
"0.68542004",
"0.6800469",
"0.6685188",
"0.6643136",
"0.6611221",
"0.6572029",
"0.6561666",
"0.6559548",
"0.6556205",
"0.6490487",
"0.6478043",
"0.6383321",
"0.6345175",
"0.632522",
"0.63115215",
"0.62045866",
"0.6178796",
"0.6173279",
"0.61722475",
"0.6164396",
"0.613836",
"0.611254",
"0.6094832",
"0.6092852",
"0.60518146",
"0.60132027",
"0.6012488",
"0.5981405",
"0.59779596",
"0.59453356",
"0.5916181",
"0.5910209",
"0.58814776",
"0.5869626",
"0.58560586",
"0.5832238",
"0.58288294",
"0.5765352",
"0.5761596",
"0.5737918",
"0.56938195",
"0.5686899",
"0.56844836",
"0.5653624",
"0.5633958",
"0.56027496",
"0.56008875",
"0.55964285",
"0.5589023",
"0.5587758",
"0.55824894",
"0.55715674",
"0.556424",
"0.55634636",
"0.5544735",
"0.553798",
"0.553798",
"0.5532797",
"0.55191195",
"0.5519094",
"0.5507668",
"0.550757",
"0.55033934",
"0.5502236",
"0.5493924",
"0.5490328",
"0.5488843",
"0.5479263",
"0.5476934",
"0.5476934",
"0.5476934",
"0.5476934",
"0.5476934",
"0.5476934",
"0.5476934",
"0.5476934"
] |
0.6189238
|
40
|
short title for lists and callback for ...ables
|
def list_title(n=40)
st = title[0..n].to_s
st += "..." unless title.length <= n
st
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def title_for_list(object)\n return \"List of \" + MyAdmin.prepare_title(object)\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title_name; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def name() title; end",
"def name() title; end",
"def list(*) end",
"def list_header(title)\n 2.times do\n puts (\"\")\n end\n puts (\"Details of your todo list #{title}\")\n puts (\"\")\n end",
"def onBriefingGroup _args\n \"onBriefingGroup _args;\" \n end",
"def title_comp=(_arg0); end",
"def name; title end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def title_comp; end",
"def title?; end",
"def display_all_titles\n # Interface method\n end",
"def frbr_list_title\n event_title\n end",
"def onBriefingNotes _args\n \"onBriefingNotes _args;\" \n end",
"def twitter_list_name\n end",
"def print_list; end",
"def print_list(list_name)\n p list_name\nend",
"def list_title_for(text)\n I18n.t(\"backend.general.list\", :model => text.is_a?(String) ? text : text.send(:human_name))\n end",
"def handle_title(name, attrs) \n \n end",
"def list\n end",
"def list\n end",
"def list\n end",
"def list\n\n end",
"def titles(library)\nend",
"def onBriefingPlan _args\n \"onBriefingPlan _args;\" \n end",
"def desc=(_); end",
"def frbr_list_title\n frbr_ui_desc\n end",
"def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end",
"def show_list\n process_show_list\n end",
"def help\n [['some command', 'description of some command'],\n ['some other command', 'description of some other command']]\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def display_title(element)\n # Interface method\n end",
"def list_items_preview\n end",
"def list_item_title resource, title=nil, url=nil\n if title.nil?\n title = get_object_title(resource)\n end\n name = resource.class.name.split(\"::\")[0]\n\n html = \"<div class=\\\"list_item_title\\\">\"\n case name\n when \"DataFile\",\"Model\",\"Sop\"\n image = image_tag(((name == \"Model\") ? icon_filename_for_key(\"model_avatar\"): (file_type_icon_url(resource))), :style => \"width: 24px; height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"<p style=\\\"float:left;width:95%;\\\">#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}</p>\"\n html << list_item_visibility(resource.asset.policy)\n html << \"<br style=\\\"clear:both\\\"/>\"\n when \"Assay\"\n image = image_tag((resource.is_modelling? ? icon_filename_for_key(\"assay_modelling_avatar\") : icon_filename_for_key(\"assay_experimental_avatar\")), :style => \"height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n when \"Person\"\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)} #{admin_icon(resource) + \" \" + pal_icon(resource)}\"\n else\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n end\n html << \"</div>\"\n return html\n end",
"def desc; end",
"def label\n raise 'answer the list label'\n end",
"def help\n [['help', \"this message\"]]\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def title\n name\n end",
"def title\n name\n end",
"def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend",
"def short_title\n title\n end",
"def printList( name, list )\n title( \"#{name} available on #{$params[ :host ]}:#{$params[ :port ]}\", \"=\" )\n list.each {|item| print item.class == DictArrayItem ? \"#{item.name} - #{item.description}\\n\" : item }\n print \"\\n\"\n end",
"def html_list_name list_type, open_tag\n ''\n end",
"def summary_list(name, subcmds)\n section \"List of #{name} commands (with minimum abbreviation in parenthesis):\"\n subcmds.list.each do |subcmd_name|\n # Some commands have lots of output.\n # they are excluded here because 'in_list' is false.\n msg summary_help(subcmds.subcmds[subcmd_name])\n end\n end",
"def print_list(title,list)\n# steps:\n # print title of list (will ask user for this input)\n puts \"**********************\"\n puts \" #{title.upcase}:\"\n puts \"**********************\"\n # print headers of item and quantity\n puts \" # ITEM\"\n puts \"----------------------\"\n # print each item and it's quantity, bulleted if possible\n list.each {|item,quantity| puts \" #{quantity} #{item}\"}\n puts \"**********************\"\n # print today's date\n date = Time.new\n puts \" Made on: #{date.month}/#{date.day}/#{date.year}\"\nend",
"def title\n end",
"def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend",
"def display_method_list\n end",
"def start_special_list_item\n end",
"def heading\n\t\t\"Items\"\n\tend",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def list _args\n \"list _args;\" \n end",
"def list_item_simple_list items, attribute\n html = \"<p class=\\\"list_item_attribute\\\"><b>#{(items.size > 1 ? attribute.pluralize : attribute)}:</b> \"\n if items.empty?\n html << \"<span class='none_text'>Not specified</span>\"\n else\n items.each do |i|\n if block_given?\n value = yield(i)\n else\n value = (link_to get_object_title(i), show_resource_path(i))\n end\n html << value + (i == items.last ? \"\" : \", \")\n end\n end\n return html + \"</p>\"\n end",
"def title(*args, &block)\n options = Hash === args.last ? args.last : {}\n before_filter(options) {|c| c.title(*args, &block) }\n end",
"def provide_navigation_to_all_long_descriptions\n # Interface method\n end",
"def title\n [id, name].join(' ')\n end",
"def show_list\n\t\tclear\n\t\tputs \"= LISTE DES INSTANCES #{name} =\".bleu\n\t\tputs \"\\n\\n\"\n\t\tlen_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80\n\t\tdelim = (\"-\"*len_delim).bleu\n\t\tif defined?(LIST_ENTETE)\n\t\t\tputs delim\n\t\t\tputs LIST_ENTETE \n\t\tend\n\t\tputs delim\n\t\tall.each do |inst|\n\t\t\tputs \" #{inst.to_console}\"\n\t\tend\n\t\tputs delim\n\t\tputs \"\\n\\n\"\n\tend",
"def caption; end",
"def getDescription _args\n \"getDescription _args;\" \n end",
"def main_menu\n puts <<~Doc\n Welocome to the New York Times Bestsellers List!\n Please choose one of the following options to get started:\n Doc\n NytBestsellersList::Lists.print_list_names\n end",
"def help\n [\n [\"what are (people|is everyone) saying about <subject>\", \"search twitter for tweets on <subject>\"],\n [\"what's the word on <subject>\", \"search twitter for tweets on <subject>\"],\n ]\n end"
] |
[
"0.68663794",
"0.6500497",
"0.6500497",
"0.6500497",
"0.64935803",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.6426945",
"0.64066535",
"0.64066535",
"0.63601506",
"0.6316636",
"0.6308353",
"0.62799156",
"0.6268065",
"0.61992383",
"0.61992383",
"0.61992383",
"0.6196987",
"0.6162593",
"0.61322623",
"0.61112297",
"0.60846233",
"0.60828257",
"0.6077421",
"0.6072963",
"0.6060271",
"0.6028248",
"0.60175455",
"0.60175455",
"0.60175455",
"0.60093963",
"0.599165",
"0.5978303",
"0.5969751",
"0.5959554",
"0.59595",
"0.5958887",
"0.5956648",
"0.5941584",
"0.5941584",
"0.5941584",
"0.5941584",
"0.5941584",
"0.5923087",
"0.5909321",
"0.58742446",
"0.5866992",
"0.5858204",
"0.58152646",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5813035",
"0.5807351",
"0.5807351",
"0.58060867",
"0.580213",
"0.5778566",
"0.5776431",
"0.5767213",
"0.57638997",
"0.5740259",
"0.5739719",
"0.5735011",
"0.5734918",
"0.573419",
"0.5734059",
"0.5734059",
"0.5734059",
"0.5729435",
"0.5724135",
"0.57217854",
"0.5710311",
"0.5694769",
"0.56940097",
"0.56774503",
"0.56763005",
"0.5668682",
"0.56612384"
] |
0.0
|
-1
|
TODO: Check if user allowed to read this posting This callback is used by tagables and therefor it is defined as this simple placeholder yet
|
def read_allowed?(user)
return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })
return false unless user
group_restrictions.each do |r|
unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil?
logger.info("\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}")
return true
end
end
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def raw_post; end",
"def process_post(post)\n # No-op.\n end",
"def post_reader; end",
"def process_post\n true\n end",
"def fetch_create_post\n end",
"def view_post\n content \n end",
"def force_post\n @type = \"post\"\n @post = \"\"\n end",
"def post; end",
"def post #:doc:\n end",
"def tagged?; end",
"def post_data; end",
"def post\n raise NotImplementedError\n end",
"def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend",
"def read_post(title)\n @read = \"This is from the post, #{title}\"\n end",
"def initialized_post_name; end",
"def send_post(post)\n title = CGI.unescapeHTML(post['title'])\n author = post['author']\n url = post['url']\n time = post['created']\n link = 'https://reddit.com' + post['permalink']\n preview = post['thumbnail']\n # Create an Embed\n Bot.channel(Config['channel']).send_embed do |emb|\n emb.color = '3498db'\n emb.author = { name: title, url: link}\n emb.image = { url: preview }\n emb.url = link\n emb.add_field name: 'Link:', value: url, inline: false\n emb.footer = { text: \"Posted by /u/#{author} @ #{Time.at(time).strftime('%a, %d %b %H:%M')}\", icon_url: Bot.profile.avatar_url }\n end\nend",
"def post_params\n params.require(:post).permit(:content, :grass_tags, :only_followers, :user_id)\n end",
"def post\r\n end",
"def post_data=(_arg0); end",
"def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end",
"def post_as(user, text = nil, &block)\n post = DslWrapper::Post.new(user)\n post.text(text) if text\n post.instance_eval(&block) if block_given?\n post.post_on_facebook\nend",
"def posted?\n post.present?\n end",
"def post_ad\n # the post_ad method is defined in lib/post_o_matic.rb. the method creates a new listing on kingsnake.com\n # and returns true or false, depending on whether or not it was posted.\n is_posted = super\n if is_posted\n update_posted_ad!\n end\n is_posted\n end",
"def ready_to_post?\n self.state == 'ready_to_post'\n end",
"def non_subscriber_post(email)\n end",
"def after_add_callback(unused_submission)\n end",
"def post?\n false\n end",
"def post_params\n params.require(:post).permit(:content, :anonymous_flag, :user_id, :edited_at)\n end",
"def set_poster post, sentFlg\n sentFlg ? post.recipient : post.user\n end",
"def tag_params\n params.permit(:body, :post_id)\n .merge(post_id: params[:post_id])\n end",
"def all_post\n end",
"def post\n end",
"def get_default_request\n {\n 'post[source]' => '',\n 'post[body]' => '',\n 'post[body]WidgEditor' => 'true',\n 'post[id]' => '',\n 'post[parent_id]' => '',\n 'post[original_id]' => '',\n 'post[edited_after_repost]' => '',\n 'redirect' => '',\n 'commit' => 'Save'\n }\n end",
"def posts; end",
"def post(*args, &block); end",
"def ask_post\n page(MorePage).select_more_actions(\"Ask HN\")\n page(MorePage).page_handler(\"Ask HN\")\n page(FeedDetailsPage).touch_row\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n page(SubmissionPage).await\n page(MorePage).backpage\n page(MorePage).page_handler(\"Ask HN\")\n page(MorePage).backpage\n end",
"def skips_post #:nodoc:\n @skips_post\n end",
"def post_params\n params.require(:post).permit(:body, :visibility)\n end",
"def ready_to_post\n self.update_attribute('state', 'ready_to_post')\n end",
"def set_PostContent(value)\n set_input(\"PostContent\", value)\n end",
"def set_PostContent(value)\n set_input(\"PostContent\", value)\n end",
"def event_type\n :ask_posted\n end",
"def post_reader\n @post_reader ||= PostReader.new(site)\n end",
"def post_params\n params[:post].permit(:text) if params[:post]\n end",
"def after_numbered(post)\n return unless post.is_a?(Post)\n return unless post.topic\n return unless post.topic.status == 'publish'\n return unless post.floor and post.floor > 0\n send_mention(post)\n end",
"def post_content(post, options = {})\n circle = list_circles['items'].detect { |item| item['displayName'] == 'Private' }\n insert_activity(nil, {\n 'object' => {'content' => post.message },\n 'access' => {'items' => [{\n 'type' => 'circle',\n 'id' => circle['id']\n }]}\n })\n end",
"def inactive_post(email)\n end",
"def post\n textmenu = @browser.find_element class: \"icon_post_text\"\n textmenu.click\n titlebox = @browser.find_element class: \"editor-plaintext\"\n titlebox.send_keys \"This is a test\"\n textbox = @browser.find_element class: \"editor-richtext\"\n textbox.send_keys \"This is a test\"\n post = @browser.find_element class: \"create_post_button\"\n post.click\n end",
"def getPostedPerson\r\n\t\t\t\t\treturn @postedPerson\r\n\t\t\t\tend",
"def getPostedPerson\r\n\t\t\t\t\treturn @postedPerson\r\n\t\t\t\tend",
"def post_block\n end",
"def post_block\n end",
"def post_params\n params.require(:post).permit(:title, :picture, :approved, :vibe_type, :body, :url, :uid)\n\n end",
"def post_params\n params.require(:post).permit(:ID, :UserID, :Type, :Caption, :Content, :Counter)\n end",
"def post_content(post, options = {})\n provider_class.post_content(post)\n end",
"def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end",
"def buildUserPostContent\n threadForUserPosts do |account,post|\n begin\n # Get HTML content\n tag = getTag(post.attributes['tag']) \n content = createUserContent post.attributes['href'],\n tag,\n DeliciousConnector::displayContent(post.attributes['href'])\n account.addContent(content)\n #writeUserContentToFile user,post.attributes['href'],post.get_attribute('tag'),content \n rescue => e\n puts \"[Warning]: Failed to retrieve content at #{post.attributes['href']} for '#{account.user}' : [#{e}]\"\n end\n end \n end",
"def skips_post \n @skips_post\n end",
"def create\nif(check_real_spam_id(params[:_user_auth_key]))\n@topic = Topic.find(params[:topic_id])\n@post = Post.new(:body => params[:body],\n:topic_id => @topic.id,\n:user_id => logged_in_user.id)\nrespond_to do |format|\nif @post.save\nflash[:notice] = 'Post was successfully created.'\nformat.html { redirect_to posts_path(:forum_id => @topic.forum_id,\n:topic_id => @topic) }\nformat.xml { head :created, :location => post_path(@post) }\nelse\nformat.html { render :action => \"new\" }\nformat.xml { render :xml => @post.errors.to_xml }\nend\nend\nelse\n render(:text => \"Could not submit post, Please try again later!\")\nend\nend",
"def create\n #initialize a new post object with the parameters submitted, validated by post_params\n @post = Post.new(post_params)\n \n isComment = false\n #check whether this is actually a comment, meaning it should have kind=2 and will need an originating post id\n if params[:kind].present?\n @post.kind = params[:kind].to_i\n @post.originatingPost_id = params[:originatingPost_id].to_i\n isComment = true\n \n #otherwise, it is a post, which optionally has tags\n else\n @post.kind = 0\n @tagsToAdd = params[:tagsToAdd].split(\" \")\n @tagsToAdd.each do |t|\n @post.tags << createTag(t)\n end\n end\n \n #either way, the currently logged in user should be logged as the creator of this post/comment\n @post.user = User.find(session[:user_id])\n \n if @post.save!\n if isComment\n redirect_to action: \"show\", :id => params[:originatingPost_id] #stay on the post's show page\n else\n redirect_to action: \"show\", :id => @post.id #go to this new post's show page\n end\n else\n redirect_to action: 'new' #upon failure, try again\n end\n end",
"def post_params\n params.require(:post).permit(:title, :body, :tag_string)\n end",
"def tag; end",
"def tag; end",
"def new\n @post = Post.new\n #if new is being called because the user clicked the add tag button\n if params[:tag].present?\n @post.text = params[:currentPostText]\n addTag()\n #if new is being called because the user clicked an x to remove one of the tags\n elsif params[:tagToRemove].present?\n @post.text = params[:currentPostText]\n removeTag()\n #if new is being called because the user has just navigated to this page\n else\n @tagsToAdd = []\n end\n end",
"def POST; end",
"def _eval_post\n _eval_action('post')\n end",
"def post_params\n params.require(:post).permit(:user_id, :title, :content, :time, :status_id, :tag_id, :picture)\n end",
"def create\n @post = Post.new(post_params)\n @post.sub_id = @post.default_sub_id\n respond_to do |format|\n if @post.save\n # @post.tag(post_params[:tags], current_user) if post_params[:tags]\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: nil }\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_success(post)\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n page(FeedDetailsPage).await\n page(FeedDetailsPage).touch_share\n case post\n when \"an URL\" then\n page(FeedDetailsPage).touch_choice(\"Submit URL\")\n page(SubmissionPage).create_post(\"URL title\")\n page(FeedDetailsPage).touch_choice(\"Contents\")\n page(SubmissionPage).create_post(\"URL post\")\n page(SubmissionPage).touch_discard\n when \"a Text\" then\n page(FeedDetailsPage).touch_choice(\"Submit Text\")\n page(SubmissionPage).create_post(\"text title\")\n page(FeedDetailsPage).touch_choice(\"Contents\")\n page(SubmissionPage).create_post(\"text post\")\n page(SubmissionPage).touch_discard\n end\nend",
"def post_params\n params.require(:post).permit(:title, :content, :published, :tag_list, :user_id)\n end",
"def post_params\n params.require(:post).permit(:url, :content, :user_id, :tag_list, \n :image, :video, :audio, :type, :post_id)\n end",
"def create\n \n unless current_user.can_post\n redirect_to welcome_page_path\n end\n \n @post = Post.new\n @post.user = current_user\n @post.privly_application = params[:post][:privly_application]\n\n # Posts default to Private\n if params[:post][:public]\n @post.public = params[:post][:public]\n else\n @post.public = false\n end\n\n set_burn_date\n \n # The random token will be required for users other than the owner\n # to access the content. The model will generate a token before saving\n # if it is not assigned here.\n @post.random_token = params[:post][:random_token]\n \n @post.update_attributes(params[:post])\n \n respond_to do |format|\n if @post.save\n response.headers[\"X-Privly-Url\"] = @post.privly_URL\n format.any { render :json => get_json, \n :status => :created, :location => @post }\n else\n format.any { render :json => @post.errors, \n :status => :unprocessable_entity }\n end\n end\n end",
"def published?; end",
"def published?; end",
"def post_params\n params.require(:post).permit(:user_id, :title, :description, :is_private, :options, :all_tags)\n end",
"def export_post(post) end",
"def published_post\n if self.published && self.published_at.nil?\n self.published_at = Time.now\n end\n end",
"def tagging_raw_handle\n name\n end",
"def tagging_raw_handle\n name\n end",
"def create\n\n\t\t@post = Post.new(post_params)\n\t\tif @post.tag == \"\"\n\t\t\tredirect_to :back\n\t\telsif @post.body == \"\"\n\t\t\tredirect_to :back\n\t\telse\n\t\t\t@post.save\n\t\t\tredirect_to \"#\"\n\t\t\tflash[:info] = \"Post submited!\"\n\t\tend\n\tend",
"def preview\n assign_attributes\n @post\n end",
"def fb_post\n self.fb_action_id ? FbGraph::OpenGraph::Action.new(self.fb_action_id) : nil\n end",
"def post_constructor\n redirect_url = self.link_url\n if redirect_url.blank?\n redirect_url = \"#{BASEURL}/posts/#{self.post.id}\"\n end\n\n redirect = Redirect.get_or_create(\n :target_uri => \"#{redirect_url}\"\n )\n\n uri = URI.parse \"https://graph.facebook.com/#{self.api_account.api_id}/feed\"\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n access_token = self.api_account.oauth_secret\n link_to_post = redirect.get_short_url\n name = self.name\n message = self.message\n description = self.description\n caption = self.caption\n\n param_string = \"access_token=#{access_token}&link=#{link_to_post}&name=#{name}&message=#{message}&description=#{description}&caption=#{caption}\"\n if self.post.has_photo?\n param_string << \"&picture=#{BASEURL}#{post.photo.url(:medium)}\"\n end\n return http.post(uri.path, URI.escape(param_string))\n end",
"def track\n post\n end",
"def create\n @post = Post.new(post_params)\n @post.body = @post.body.html_safe\n @post.short_body = @post.body.split('</p>')[0] + '</p>'\n set_tags\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 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 auto_post?\n return jiak.auto_post\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.post\"\n end",
"def on_post(resource_uri, opts) # resource_uri = Nodes\n debug \"on_post: #{resource_uri}\"\n resource = update_resource(resource_uri, false, opts)\n show_resource(resource, opts)\n end",
"def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end",
"def post_params\n params.permit(:body, :is_public)\n end",
"def post_params\n params.require(:post).permit(:title, :subtitle, :tag_list, :body, :published)\n end",
"def post_params\n params.require(:post).permit(:post_type, :user, :text, :ts)\n end",
"def create\n\n current_user_or_redirect ? nil : return\n\n @post = Post.new(params[:post])\n @post.user_id = @current_user.id\n\n if @post.link?\n @post.status = 'live'\n @post.link = \"http://#{@post.link}\" unless @post.link[/^https?/]\n end\n\n respond_to do |format|\n if @post.save\n @post.delay.update_slug\n @post.delay.add_interactions\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\n end",
"def post_params\n params.require(:post).permit(:body, :username)\n end",
"def skips_post\n @@skips_post = true\n end",
"def post_params\n params.require(:post).permit(:description, :image, :image_remote_url, :title, :country, :tag_list, :link, :domain, :top, :hide, :category, :event)\n end",
"def allowed_tags=(_arg0); end",
"def allowed_tags=(_arg0); end",
"def new_post_notification(post)\n #author\n reciever = User.find_by_id post.user_id\n setup_email(reciever)\n @subject +=\"Новый пост в вашем сообществе\"\n body[:url] = RAILS_URL + \"posts/show/#{post.id}\"\n body[:post] = post\n end",
"def posts # proxy the posts struct\n @post_cb = lambda{|post,fobj| yield post,fobj }\n self\n end",
"def post_params\n params.require(:post).permit(:title, :summary, :body, :tags)\n end"
] |
[
"0.6901791",
"0.65994835",
"0.63145477",
"0.61551404",
"0.6060221",
"0.59365666",
"0.5908595",
"0.59006",
"0.58948976",
"0.5867928",
"0.5842847",
"0.57946175",
"0.5772395",
"0.5694198",
"0.5686122",
"0.5663522",
"0.5640944",
"0.5637536",
"0.5626762",
"0.55764174",
"0.5574192",
"0.5562347",
"0.55468607",
"0.5522192",
"0.55022514",
"0.5493753",
"0.5492164",
"0.54921544",
"0.5481553",
"0.54687244",
"0.54611367",
"0.54508114",
"0.5446578",
"0.5446209",
"0.54456466",
"0.5425612",
"0.5417212",
"0.540677",
"0.54045796",
"0.5402232",
"0.5402232",
"0.539993",
"0.53907084",
"0.53904986",
"0.53847224",
"0.5364435",
"0.5360335",
"0.5352452",
"0.53480136",
"0.53480136",
"0.53475255",
"0.53475255",
"0.5343473",
"0.532073",
"0.5319345",
"0.53039986",
"0.530302",
"0.5295804",
"0.52871585",
"0.52752477",
"0.5275071",
"0.52685094",
"0.52685094",
"0.52683985",
"0.5257623",
"0.5255777",
"0.52472067",
"0.52469146",
"0.52460384",
"0.5227269",
"0.5221281",
"0.5220062",
"0.5216678",
"0.5216678",
"0.52166647",
"0.5216661",
"0.5209972",
"0.5208331",
"0.5208331",
"0.52079123",
"0.520485",
"0.52023035",
"0.5202019",
"0.5198026",
"0.5193442",
"0.51868105",
"0.51845443",
"0.5182678",
"0.51824856",
"0.5177763",
"0.5174051",
"0.517309",
"0.5171455",
"0.5162453",
"0.5162286",
"0.51612955",
"0.51590025",
"0.51590025",
"0.51566887",
"0.5153243",
"0.5149494"
] |
0.0
|
-1
|
Notifies all of the translators on the translators' mailing list that there is a new commit that has finished loading. CC's the creator of the commit.
|
def request_screenshot(commit, user)
@commit = commit
@project = commit.project
@user = user
mail to: commit_requesters(@commit),
cc: @user.email,
subject: t('mailer.screenshot.request_screenshot.subject', sha: @commit.revision_prefix)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notify_translation_finished(commit)\n @commit = commit\n if @commit.user.try!(:email)\n mail to: @commit.user.email, subject: t('mailer.commit.notify_translation_finished.subject')\n end\n end",
"def notify_translators(commit)\n @commit = commit\n\n mail to: Shuttle::Configuration.mailer.translators_list,\n subject: t('mailer.commit.notify_translators.subject'),\n cc: @commit.user.try!(:email)\n end",
"def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\"name\"]\n commit.message = c[\"head_commit\"][\"message\"]\n commit.url = c[\"head_commit\"][\"url\"]\n commit.sha = c[\"head_commit\"][\"id\"]\n commit.date = c[\"head_commit\"][\"timestamp\"]\n commit.task_id = taskid\n commit.save\n end\n end",
"def send_post_commit_mail(revision)\n body = post_commit_html(revision)\n mail = Emailer.create_svn_mail(config.mails,revision.subject,revision.number,body,revision.patch)\n Emailer.deliver(mail)\nend",
"def forced_commit(mails,body)\n subject 'Forced commit realized'\n from 'svnadmin@ithol'\n recipients mails\n content_type 'text/html'\n body body\n end",
"def course_notification\n @course = Course.first\n @teacher = @course.teachers.first\n @students = @course.students\n @title = \"一个好消息\"\n @content = \"今天不上课\\n大家好好休息\"\n NotificationMailer.course_notification @teacher, @course, @students, @title, @content\n end",
"def notify_changes(repo,revision)\n \n @logger.debug(\"ChangeNotifier Entering with repo=\"<< repo)\n @logger.debug(\"ChangeNotifier Entering with revision=\"<< revision)\n begin\n author = author_check(revision,repo)\n @logger.debug(\"Author is #{author}\")\n\n paths = changed_paths_check(revision, repo)\n @logger.debug(\"svnlook changed returned \" << paths.join(\" \"))\n \n check_changes(paths, author) do |watched_paths,paths_by_users|\n\n date_committed = `svnlook date -r #{revision} #{repo}`\n log_message=`svnlook log -r #{revision} #{repo}`\n hash={:author => author, :date => date_committed, :log=>log_message, :rev=>revision}\n # send email only to interested parties\n threads=[]\n send_mail watched_paths, hash, paths_by_users do |user_email, subject,body|\n t1 = Thread.new do\n @logger.debug(\"ChangeNotifier about to send mail for \" << body)\n Util::MailSender.instance.send_mail(user_email, subject, body)\n end\n threads << t1\n end\n threads.each do |thread|\n thread.join\n @logger.debug(\"ChangeNotifier joined \" << thread.to_s)\n end\n end\n rescue Exception => e\n # log the error at least\n @logger.error(e)\n raise\n end\n end",
"def news_comment_added_with_change(comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => news.recipients,\n :cc => news.watcher_recipients,\n :subject => \"Re: [#{news.project.to_s}] #{l(:label_news)}: #{news.title}\"\n end",
"def course_deleted(removed_course, subscriptions)\n @course = removed_course\n return if subscriptions.empty?\n recipients = subscriptions.map do |sub|\n sub.user.email\n end\n mail(to: recipients,\n subject: 'CoachUP! - One of your courses has been deleted')\n end",
"def wiki_content_updated(user, wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n @wiki_content = wiki_content\n @user = user\n @wiki_content_url =\n url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title)\n @wiki_diff_url =\n url_for(:controller => 'wiki', :action => 'diff',\n :project_id => wiki_content.project, :id => wiki_content.page.title,\n :version => wiki_content.version)\n mail(\n :to => user,\n :subject =>\n \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}\"\n )\n end",
"def wiki_content_added(user, wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n @wiki_content = wiki_content\n @user = user\n @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title)\n mail(\n :to => user,\n :subject =>\n \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}\"\n )\n end",
"def news_added(user, news)\n redmine_headers 'Project' => news.project.identifier\n @author = news.author\n message_id news\n references news\n @news = news\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"[#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def changed_details\n mail_deliver(:notify_staff_details, :subject => \"Your details have changed for \" + self.school.school_name)\n end",
"def notify_submitter_of_import_errors(commit)\n @commit = commit\n submitter_emails = [@commit.author_email, @commit.user.try!(:email)].compact.uniq\n if submitter_emails.present? && @commit.import_errors.present?\n mail to: submitter_emails, subject: t('mailer.commit.notify_submitter_of_import_errors.subject')\n end\n end",
"def failed_updates_present(event)\n error \"TariffSynchronizer found failed updates that need to be fixed before running: #{event.payload[:file_names]}\"\n\n Mailer.failures_reminder(event.payload[:file_names]).deliver\n end",
"def goal_complete_update\n UpdateMailer.goal_complete_update\n end",
"def execute!\n logger.info(\"Finalizing commit #{commit_log.commit_id}\")\n\n status = repo_config.tms.status(commit_log.commit_id)\n\n repo_config.locales.each do |locale|\n locale_code = locale.code\n\n rosette_config.datastore.add_or_update_commit_log_locale(\n commit_log.commit_id, locale_code, status.locale_count(locale_code)\n )\n end\n\n if status.fully_translated?\n repo_config.tms.finalize(commit_log.commit_id)\n commit_log.finalize\n save_commit_log\n end\n\n logger.info(\"Finished finalizing commit #{commit_log.commit_id}\")\n end",
"def after_commit(idea_progress)\n\t\t# only process if a create just occurred\n\t\t# - see after_create method above\n\t\tif idea_progress.send_notification\n\t\t\t# determine if idea is realized\n\t\t\tif idea_progress.is_completed && idea_progress.url\n\t\t\t\t# idea realized\n\n\t\t\t\t# notify owner if wants notification\n\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_realized_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_realized_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\tmessage.url = idea_progress.url\n\t\t\t\t\tNotificationMailer.idea_realized_owner(message).deliver\n\t\t\t\tend\n\n\t\t\t\t# notify subscribers\n\t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t message = Message.new\n\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_realized_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_realized_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t message.url = idea_progress.url\n\t\t\t\t\t\t NotificationMailer.idea_realized_subscriber(message).deliver\n\t\t\t\t\t end\n \t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# see if this idea is already claimed by this org\n\t\t\t\tideas = IdeaProgress.where(\"idea_id = ? and organization_id = ? and id != ?\",\n\t\t\t\t\tidea_progress.idea_id, idea_progress.organization_id, idea_progress.id)\n\n\t\t\t\tif ideas && !ideas.empty?\n\t\t\t\t\t# org already claimed, just an update\n\t\t\t\t\t# notify owner if wants notification\n\t\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_progress_update_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_progress_update_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\t\tmessage.url_id = idea_progress.idea_id\n\t\t\t\t\t\tNotificationMailer.idea_progress_update_owner(message).deliver\n\t\t\t\t\tend\n\n\t\t\t\t\t# notify subscribers\n \t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t\t message = Message.new\n\t\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_progress_update_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_progress_update_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t\t message.url_id = idea_progress.idea_id\n\t\t\t\t\t\t\t NotificationMailer.idea_progress_update_subscriber(message).deliver\n\t\t\t\t\t\t end\n \t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# org is claiming idea\n\t\t\t\t\t# notify owner if wants notification\n\t\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_claimed_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_claimed_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\t\tmessage.url_id = idea_progress.idea_id\n\t\t\t\t\t\tNotificationMailer.idea_claimed_owner(message).deliver\n\t\t\t\t\tend\n\n\t\t\t\t\t# notify subscribers\n \t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t\t message = Message.new\n\t\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_claimed_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_claimed_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t\t message.url_id = idea_progress.idea_id\n\t\t\t\t\t\t\t NotificationMailer.idea_claimed_subscriber(message).deliver\n\t\t\t\t\t\t end\n\t\t\t\t\t end\n \t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend",
"def notify_authors_of_new_item(solr_doc)\n doc = SolrDocument.new(solr_doc)\n ldap = Cul::LDAP.new\n\n unis = solr_doc.fetch('author_uni_ssim', [])\n preferred_emails = EmailPreference.preferred_emails(unis)\n\n preferred_emails.each do |uni, email|\n # Skip if notification was already sent.\n next if Notification.sent_new_item_notification?(solr_doc['cul_doi_ssi'], uni)\n\n begin\n name = (author = ldap.find_by_uni(uni)) ? author.name : nil\n success = true\n UserMailer.new_item_available(doc, uni, email, name).deliver_now\n rescue StandardError => e\n logger.error \"Error Sending Email: #{e.message}\"\n logger.error e.backtrace.join(\"\\n \")\n success = false\n end\n Notification.record_new_item_notification(doc[:cul_doi_ssi], email, uni, success)\n end\n end",
"def completed\n SignaturesMailer.completed\n end",
"def after_commit(idea)\n\t\t# only process if a create just occurred\n\t\t# - see after_create method above\n\t\tif idea.is_create\n\t\t\tcategory_ids = idea.idea_categories.map{|x| x.category_id}\n\t\t\tif category_ids && !category_ids.empty?\n\t\t\t\tmessage = Message.new\n\t\t\t\tmessage.bcc = Notification.new_idea_users(category_ids)\n\t\t\t\tif message.bcc && !message.bcc.empty?\n\t\t\t\t\t# if the owner is a subscriber, remove from list\n\t\t\t\t\tindex = message.bcc.index(idea.user.email)\n\t\t\t\t\tmessage.bcc.delete_at(index) if index\n\t\t\t\t\t# only continue if owner was not only subscriber\n\t\t\t\t\tif message.bcc.length > 0\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.subscriber.new_idea.subject\")\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.subscriber.new_idea.message\")\n\t\t\t\t\t\tmessage.org_message = idea.explaination\n\t\t\t\t\t\tmessage.url_id = idea.id\n\t\t\t\t\t\tNotificationSubscriberMailer.new_idea(message).deliver\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def user_added_email(course, user)\n @course = course\n @recipient = user.user\n\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end",
"def notification_of_new_update_to_listing(listing, recipient, host=nil)\n set_locale recipient.locale\n subject_string = t(:listing_you_follow_has_been_updated)\n url = host ? \"http://#{host}#{listing_path(listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(recipient.id)}\" : \"test_url\"\n recipients recipient.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :listing => listing, :url => url, :settings_url => settings_url, :recipient => recipient, :listing_title => get_title_with_category(listing)\n end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def deliver_admin_notice\n unless self.registered_download.cc.blank?\n RegisteredDownloadsMailer.delay.admin_notice(self)\n end\n end",
"def transaction_complete\n NotificationsMailer.transaction_complete\n end",
"def notify_modification\n if @ok\n msg = params[:details_placeholder].blank? ? '' : params[:details]\n @lesson.notify_changes msg\n end\n end",
"def send_email_changed_notification; end",
"def document_added(user, document, author)\n redmine_headers 'Project' => document.project.identifier\n @author = author\n @document = document\n @user = user\n @document_url = url_for(:controller => 'documents', :action => 'show', :id => document)\n mail :to => user,\n :subject => \"[#{document.project.name}] #{l(:label_document_new)}: #{document.title}\"\n end",
"def part_num_update(part_numbers, designers, active_designs, total_part_nums, num_updated)\n subject = 'Part Number Descriptions Have Been Auto Updated' \n\n recipients = []\n recipients += designers.collect { |u| u.email}\n recipients += User.where(:last_name => [\"Kasting\", \"Light\", \"Michaels\"]).collect { |u| u.email}\n recipients << \"dtg@teradyne.com\"\n #recipients << \"jonathan.katon@teradyne.com\"\n \n @part_numbers = part_numbers\n @active_designs = active_designs\n @total_part_nums = total_part_nums\n @num_updated_part_nums = num_updated\n \n mail(:to => recipients.uniq,\n :subject => subject \n )\n end",
"def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end",
"def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end",
"def news_comment_added(user, comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def run_on_modifications(paths)\n @builder.notify\n end",
"def notify_french(dest)\n mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))\n end",
"def user_added_email(user)\n ActsAsTenant.without_tenant do\n @course = user.course\n end\n @recipient = user.user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end",
"def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end",
"def send_email_after_change_start_date\n\n #Do nothing if start_date not change\n return if(!self.start_date_changed?)\n\n contestants = self.users\n\n #Send email to creator\n UserMailer.start_date_change_creator(self.creator, self).deliver\n\n #Send email to contestants\n contestants.each do |c|\n UserMailer.start_date_change_contestant(c, self).deliver\n end\n\n end",
"def new_to_do_update\n UpdateMailer.new_to_do_update\n end",
"def update_course_revisions\n log_message 'Importing revisions and articles for soon-to-end courses'\n Course.ready_for_short_update.each { |course| UpdateCourseRevisions.new(course) }\n end",
"def commit_list!\n @last_log_recipient_list.save if @last_log_recipient_list.present? && @last_log_recipient_list.changed?\n end",
"def send_force_commit_mail(body)\n mail = Emailer.create_foced_commit(config.force_commit_mails,body)\n Emailer.deliver(mail)\nend",
"def vcs_commit(evt)\n sel = @tblChanges.selection_model.selected_items\n msg = @cmbCommitMsg.value\n if sel.length == 0\n fx_alert_error \"Cannot commit on empty changes selection. Please select at least a file from the table above.\", \"No Files Selected\", main_stage\n elsif (msg.nil? or msg.empty?)\n fx_alert_error \"Commit message must be present.\", \"Empty Commit Message\", main_stage\n else\n commit_changes(sel, msg)\n if not @msgHistory.include?(msg)\n @cmbCommitMsg.items.add(msg)\n @msgHistory << msg\n end\n refresh_tab_state\n end\n end",
"def notify_concierge(record)\n if record.user.concierge && record.user.concierge_id != record.author_id\n create_notification(record, record.user.concierge)\n end\n end",
"def request_has_been_modified_by_user_to_teacher(participation_request, message)\n @message = message\n retrieve_participation_request_variables(participation_request)\n mail to: @admin.email,\n subject: (@participation_request.old_course_id.present? ? 'Changement de cours' : 'Changement de date') + \" - #{@user.name}\",\n reply_to: generate_reply_to('admin')\n end",
"def lookup_commit_details(msg)\n rev = msg[:message]\n commit = fetch_svn_commit(rev).first\n messagetext = \"#{commit[:author]} committed revision #{commit[:revision]} \" +\n \"#{time_ago_in_words(commit[:date])} ago:\\n\"\n\n messagetext += \"\\n#{commit[:message]}\\n\"\n messagetext += \"----\\n\"\n commit[:paths].each do |path|\n messagetext += path[:action] + \" \" + path[:path] + \"\\n\"\n end\n\n msg.paste(messagetext)\n\n messagetext = \"More detail can be found at \" + bot.config['svn_webui_url']\n msg.speak(messagetext)\n\n @log.info messagetext\n end",
"def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end",
"def apply(event)\n info \"Finished applying updates\"\n\n Mailer.applied(\n event.payload[:update_names],\n event.payload.fetch(:unconformant_records, [])\n ).deliver\n end",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def inform_user_of_news_update_mail(signature, update)\n @signature = signature\n @update = update\n @petition = @signature.petition\n @unique_key = url_for(\n controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key)\n\n subject = t('mail.petition.progress_subject', petition: @petition.name)\n\n mail(to: signature.person_email, subject: subject)\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end",
"def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def completed(build, listener)\n end",
"def execute\n puts Mailbot::Repository.new(file).entries.map { |entry| colorized_subject entry }.map(&:strip).join(\"\\n\")\n end",
"def job_complete(job)\n @job = job\n mail subject: \"Job Complete\"\n end",
"def complete_lesson\n UserMailer.complete_lesson\n end",
"def created()\n pending = @@server.pending\n messages = []\n\n # common format for message lines\n append = proc do |title, list|\n next unless list\n if list.length > 0 and list.length < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if list.include? item.attach\n end\n messages << \"#{title} #{titles.join(', ')}\"\n elsif list.length > 1\n messages << \"#{title} #{list.length} reports\"\n end\n end\n\n append 'Approve', pending.approved\n append 'Unapprove', pending.unapproved\n append 'Flag', pending.flagged\n append 'Unflag', pending.unflagged\n\n # list (or number) of comments made with this commit\n comments = pending.comments.keys().length\n if comments > 0 and comments < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if pending.comments[item.attach]\n end\n messages << \"Comment on #{titles.join(', ')}\"\n elsif comments > 1\n messages << \"Comment on #{comments} reports\"\n end\n\n # identify (or number) action item(s) updated with this commit\n if pending.status\n if pending.status.length == 1\n item = pending.status.first\n text = item.text\n if item.pmc or item.date\n text += ' ['\n text += \" #{item.pmc}\" if item.pmc\n text += \" #{item.date}\" if item.date\n text += ' ]'\n end\n\n messages << \"Update AI: #{text}\"\n elsif pending.status.length > 1\n messages << \"Update #{pending.status.length} action items\"\n end\n end\n\n @message = messages.join(\"\\n\")\n end",
"def watch_commits\n watch( \"COMMIT_EDITMSG\") do |md| \n run_all\n end\nend",
"def after_commit(model)\n # get the customer\n customer = model.customer\n\n # do a UI update push for this customer\n PUBNUB.publish({\n # NJS - use more secure channel name\n :channel => \"customer_ui_update_available_#{customer.id}\",\n # the actual message is ignored\n :message => \"UI update available\",\n :callback => lambda { |message| puts(message) }\n })\n end",
"def new_comment_update\n UpdateMailer.new_comment_update\n end",
"def add_commit(commit)\n\t\tpattern = ChangelogFilter.pattern\n\t\tfiltered_text = Git.get_filtered_message(commit, pattern)\n\t\tif filtered_text\n\t\t\tfiltered_lines = filtered_text.split(\"\\n\").uniq\n\t\t\tif @changelog\n\t\t\t\t@changelog = @changelog.concat(filtered_lines).uniq\n\t\t\telse\n\t\t\t\t@changelog = filtered_lines\n\t\t\tend\n\t\tend\n\tend",
"def wiki_content_updated(wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n recipients wiki_content.recipients\n cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)\n subject \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}\"\n body :wiki_content => wiki_content,\n :wiki_content_url => url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title),\n :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff',\n :project_id => wiki_content.project, :id => wiki_content.page.title,\n :version => wiki_content.version),\n :diff => wiki_content.page.diff(wiki_content.version.to_i)\n render_multipart('wiki_content_updated', body)\n end",
"def _on_completion\n\t\t\tself.update_attribute(:completed_at, DateTime.now)\n\t\t\tassignments.update_all(completed_at: DateTime.now)\n\t\t\tresolver.on_completion(self)\n\t\tend",
"def successfully_completed\n self.update(status: SUCCESSFUL)\n changed\n notify_observers(self)\n end",
"def changes_notification\n NotifierMailer.changes_notification(User.limit(2), {\n title: 'Email test title',\n content: 'Email test content',\n body: 'Email test body'\n })\n end",
"def on_message_complete\n @finished = true\n end",
"def notify_change\n SpecificNodeMailer.notify_change\n end",
"def notify_subscribers\n AdminMailer.notify_of_comment(self)\n end",
"def cmt\n @cmt_procs.call('Committing')\n self\n end",
"def notify_subscribers_about_new_response(reply)\n subscribers.each do |user|\n user.with_user_locale do\n UserMailer.reply_notification(user.id, reply.id).deliver!\n end unless user == reply.user\n end\n end",
"def draft_message; draft.complete_message if draft; end",
"def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end",
"def course_duplicated_email(original_course, new_course, user)\n # Based on DuplicationService, user might default to User.system which has no email.\n return unless user.email\n\n @original_course = original_course\n @new_course = new_course\n @recipient = user\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', new_course: @new_course.title))\n end\n end",
"def item_added(item)\n @item = item\n\n mail subject: \"New item available!\",\n to: \"nobody@yardsale.com\",\n bcc: User.all.pluck(:email)\n end",
"def commit_message\n @commit.sub '%.%.%', @after_version\n end",
"def send_mail_to_instructor\n AssignmentSubmissionMailer.attachment_changed_notification(self.attachable).deliver\n end",
"def new_commit(commit)\n puts cyan(\"Found new commit: #{commit}\")\n end",
"def newsletter\n<<<<<<< HEAD\n HhMailer.newsletter\n=======\n HhMailer.newsletter(Home.all)\n>>>>>>> 33a2a16302cd13e30f994602051fd115a1b09b64\n end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def send_email_changed_notification?; end",
"def notify_manager(task_submission)\n @submitter = task_submission.submitter\n @manager = @submitter.manager\n I18n.with_locale(@manager.locale) do\n mail(to: @manager.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end",
"def export_finished_success_email(user, filename, opml)\n @user = user\n @url = read_url locale: user.locale\n attachments[filename] = opml\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def transaction_done\n puts \".........\" + self.class.name + \" has been notified\"\n end",
"def confirm_update(mailing_email)\n @email = mailing_email\n mail to: mailing_email.email, subject: \"Coming Soon: \" + @email.campaign\n end",
"def send_mail(symlinks, hash)\n \n subject=\"Subversion notification. Symbolic links checked in!\"\n \n body=\"The following symlinks have been checked in:\\n\\n\" << symlinks.join(\"\\n\") \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n body << \"\\n\\nPlease remove the above link(s) from Subversion.\"\n yield(subject, body)\n end",
"def course_duplicate_failed_email(original_course, user)\n # Based on DuplicationService, user might default to User.system which has no email.\n return unless user.email\n\n @original_course = original_course\n @recipient = user\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', original_course: @original_course.title))\n end\n end",
"def append_delivery_notes\n self.message += \"\\n----\\nFrom: #{self.user.email} #{Time.now}\\n\" + I18n.translate(:delivered_to)+\" \"\n if( all_users = (@recipients.count == User.count))\n self.message += I18n.translate(:all_users, count: @recipients.count)\n else\n self.message += @recipients.all.map { |recipient|\n recipient.name + \" (#{recipient.email})\"\n }.join(\", \")\n end\n end",
"def announce_consensus_change(old_name, new_name)\n log_consensus_change(old_name, new_name)\n\n # Change can trigger emails.\n owner = user\n sender = User.current\n recipients = []\n\n # Tell owner of observation if they want.\n recipients.push(owner) if owner&.email_observations_consensus\n\n # Send to people who have registered interest.\n # Also remove everyone who has explicitly said they are NOT interested.\n interests.each do |interest|\n if interest.state\n recipients.push(interest.user)\n else\n recipients.delete(interest.user)\n end\n end\n\n # Remove users who have opted out of all emails.\n recipients.reject!(&:no_emails)\n\n # Send notification to all except the person who triggered the change.\n (recipients.uniq - [sender]).each do |recipient|\n QueuedEmail::ConsensusChange.create_email(sender, recipient, self,\n old_name, new_name)\n end\n end",
"def pr_contains_localization_changes\n files = danger_file.git.added_files + danger_file.git.modified_files\n\n !files.grep(/.strings/).empty?\n end",
"def subscription_updated(customer_param, atts = {})\n around_mail_action(:subscription_updated, customer_param, atts) do\n return true unless EffectiveOrders.mailer[:send_subscription_updated]\n\n @customer = (customer_param.kind_of?(Effective::Customer) ? customer_param : Effective::Customer.find(customer_param))\n @subscriptions = @customer.subscriptions\n @user = @customer.user\n\n @subject = subject_for(@customer, :subscription_updated, 'Subscription Changed')\n\n mail(to: @customer.user.email, subject: @subject)\n end\n end",
"def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end",
"def create_success_message(new_invitations, existing_invitations, new_course_users, existing_course_users)\n if invite_by_file?\n t('.file.success',\n new_invitations: t('.file.summary.new_invitations', count: new_invitations),\n already_invited: t('.file.summary.already_invited', count: existing_invitations),\n new_course_users: t('.file.summary.new_course_users', count: new_course_users),\n already_enrolled: t('.file.summary.already_enrolled', count: existing_course_users))\n else\n t('.manual_entry.success')\n end\n end",
"def study_upload_complete(user, num_successful, problem_lines, warning_lines)\n\t\tbegin\n\t\t\tfrom \t\t\tDEFAULT_FROM\n\t\t\treply_to \t\tDEFAULT_REPLY_TO\n\t\t\tsubject \t\t\"Your SRDR Study Upload\"\n\t\t\trecipients \t\tuser.email\n\t\t\tsent_on \t\tTime.now\n\t\t\t@num_successful = num_successful\n\t\t\t@problem_lines = problem_lines\n\t\t\t@warning_lines = warning_lines\n\t\trescue Exception=>e \n\t\t\tputs \"ERROR SENDING UPLOAD NOTIFICATION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n\t\tend\n\tend",
"def status_changed(participation)\n @cbo = participation.cbo\n @user = participation.user\n @participation = participation\n @url = \"http://#{request.host_with_port}\" + participation_path(participation)\n \n mail(:to => @user.email, :subject => \"Your application to #{@cbo.cboprofile.name} has been updated!\")\n end",
"def log_complete\n @notifier.log \"#{identifier}: Done\", level: :collect\n end",
"def artist_approval(artist, recipients)\n @artist = artist\n mail(to: recipients,\n subject: \"Artist relations approval\")\n end",
"def notify_company_admin(admin, task_submission)\n @submitter = task_submission.submitter\n\n I18n.with_locale(admin.locale) do\n mail(to: admin.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end",
"def notify_prepare_commit\n raise NotImplementedError\n end"
] |
[
"0.72352576",
"0.6816291",
"0.56302714",
"0.54987997",
"0.54884744",
"0.53118765",
"0.5310627",
"0.529286",
"0.5290504",
"0.52576375",
"0.5225784",
"0.521971",
"0.52022433",
"0.5191036",
"0.5176706",
"0.51608896",
"0.5146049",
"0.51422894",
"0.51341",
"0.5087248",
"0.5086057",
"0.50698465",
"0.50629866",
"0.5059929",
"0.50541854",
"0.504281",
"0.50265974",
"0.50148094",
"0.5009976",
"0.5006145",
"0.4994737",
"0.49812287",
"0.49665573",
"0.49438697",
"0.49409398",
"0.49376002",
"0.49347097",
"0.49234802",
"0.4906606",
"0.49052548",
"0.4899064",
"0.48944905",
"0.48651016",
"0.48641127",
"0.48613262",
"0.4858108",
"0.48566133",
"0.48486975",
"0.48428825",
"0.4840849",
"0.48342744",
"0.48326406",
"0.48249882",
"0.48239648",
"0.4820407",
"0.48075724",
"0.48000127",
"0.4793675",
"0.47936448",
"0.4786053",
"0.4783739",
"0.47721818",
"0.4766414",
"0.4759124",
"0.47579062",
"0.47526667",
"0.4749983",
"0.47489",
"0.47488403",
"0.4745008",
"0.47400108",
"0.47391132",
"0.4732565",
"0.4726156",
"0.47256327",
"0.47237438",
"0.4705903",
"0.47054878",
"0.47026652",
"0.47015652",
"0.4693104",
"0.4693104",
"0.4692521",
"0.46697906",
"0.46681595",
"0.4663511",
"0.46539232",
"0.46451077",
"0.46449253",
"0.46389467",
"0.46387988",
"0.46373028",
"0.46363056",
"0.4634628",
"0.46320778",
"0.46314412",
"0.46251807",
"0.46251065",
"0.46247992",
"0.46182442",
"0.46146357"
] |
0.0
|
-1
|
Notifies all of the translators on the translators' mailing list that there is a new commit that has finished loading. CC's the creator of the commit.
|
def commit_requesters(commit)
[commit.user.try(:email), commit.author_email].compact.uniq
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notify_translation_finished(commit)\n @commit = commit\n if @commit.user.try!(:email)\n mail to: @commit.user.email, subject: t('mailer.commit.notify_translation_finished.subject')\n end\n end",
"def notify_translators(commit)\n @commit = commit\n\n mail to: Shuttle::Configuration.mailer.translators_list,\n subject: t('mailer.commit.notify_translators.subject'),\n cc: @commit.user.try!(:email)\n end",
"def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\"name\"]\n commit.message = c[\"head_commit\"][\"message\"]\n commit.url = c[\"head_commit\"][\"url\"]\n commit.sha = c[\"head_commit\"][\"id\"]\n commit.date = c[\"head_commit\"][\"timestamp\"]\n commit.task_id = taskid\n commit.save\n end\n end",
"def send_post_commit_mail(revision)\n body = post_commit_html(revision)\n mail = Emailer.create_svn_mail(config.mails,revision.subject,revision.number,body,revision.patch)\n Emailer.deliver(mail)\nend",
"def forced_commit(mails,body)\n subject 'Forced commit realized'\n from 'svnadmin@ithol'\n recipients mails\n content_type 'text/html'\n body body\n end",
"def course_notification\n @course = Course.first\n @teacher = @course.teachers.first\n @students = @course.students\n @title = \"一个好消息\"\n @content = \"今天不上课\\n大家好好休息\"\n NotificationMailer.course_notification @teacher, @course, @students, @title, @content\n end",
"def notify_changes(repo,revision)\n \n @logger.debug(\"ChangeNotifier Entering with repo=\"<< repo)\n @logger.debug(\"ChangeNotifier Entering with revision=\"<< revision)\n begin\n author = author_check(revision,repo)\n @logger.debug(\"Author is #{author}\")\n\n paths = changed_paths_check(revision, repo)\n @logger.debug(\"svnlook changed returned \" << paths.join(\" \"))\n \n check_changes(paths, author) do |watched_paths,paths_by_users|\n\n date_committed = `svnlook date -r #{revision} #{repo}`\n log_message=`svnlook log -r #{revision} #{repo}`\n hash={:author => author, :date => date_committed, :log=>log_message, :rev=>revision}\n # send email only to interested parties\n threads=[]\n send_mail watched_paths, hash, paths_by_users do |user_email, subject,body|\n t1 = Thread.new do\n @logger.debug(\"ChangeNotifier about to send mail for \" << body)\n Util::MailSender.instance.send_mail(user_email, subject, body)\n end\n threads << t1\n end\n threads.each do |thread|\n thread.join\n @logger.debug(\"ChangeNotifier joined \" << thread.to_s)\n end\n end\n rescue Exception => e\n # log the error at least\n @logger.error(e)\n raise\n end\n end",
"def news_comment_added_with_change(comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => news.recipients,\n :cc => news.watcher_recipients,\n :subject => \"Re: [#{news.project.to_s}] #{l(:label_news)}: #{news.title}\"\n end",
"def course_deleted(removed_course, subscriptions)\n @course = removed_course\n return if subscriptions.empty?\n recipients = subscriptions.map do |sub|\n sub.user.email\n end\n mail(to: recipients,\n subject: 'CoachUP! - One of your courses has been deleted')\n end",
"def wiki_content_updated(user, wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n @wiki_content = wiki_content\n @user = user\n @wiki_content_url =\n url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title)\n @wiki_diff_url =\n url_for(:controller => 'wiki', :action => 'diff',\n :project_id => wiki_content.project, :id => wiki_content.page.title,\n :version => wiki_content.version)\n mail(\n :to => user,\n :subject =>\n \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}\"\n )\n end",
"def wiki_content_added(user, wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n @wiki_content = wiki_content\n @user = user\n @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title)\n mail(\n :to => user,\n :subject =>\n \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}\"\n )\n end",
"def news_added(user, news)\n redmine_headers 'Project' => news.project.identifier\n @author = news.author\n message_id news\n references news\n @news = news\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"[#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def changed_details\n mail_deliver(:notify_staff_details, :subject => \"Your details have changed for \" + self.school.school_name)\n end",
"def notify_submitter_of_import_errors(commit)\n @commit = commit\n submitter_emails = [@commit.author_email, @commit.user.try!(:email)].compact.uniq\n if submitter_emails.present? && @commit.import_errors.present?\n mail to: submitter_emails, subject: t('mailer.commit.notify_submitter_of_import_errors.subject')\n end\n end",
"def failed_updates_present(event)\n error \"TariffSynchronizer found failed updates that need to be fixed before running: #{event.payload[:file_names]}\"\n\n Mailer.failures_reminder(event.payload[:file_names]).deliver\n end",
"def goal_complete_update\n UpdateMailer.goal_complete_update\n end",
"def execute!\n logger.info(\"Finalizing commit #{commit_log.commit_id}\")\n\n status = repo_config.tms.status(commit_log.commit_id)\n\n repo_config.locales.each do |locale|\n locale_code = locale.code\n\n rosette_config.datastore.add_or_update_commit_log_locale(\n commit_log.commit_id, locale_code, status.locale_count(locale_code)\n )\n end\n\n if status.fully_translated?\n repo_config.tms.finalize(commit_log.commit_id)\n commit_log.finalize\n save_commit_log\n end\n\n logger.info(\"Finished finalizing commit #{commit_log.commit_id}\")\n end",
"def after_commit(idea_progress)\n\t\t# only process if a create just occurred\n\t\t# - see after_create method above\n\t\tif idea_progress.send_notification\n\t\t\t# determine if idea is realized\n\t\t\tif idea_progress.is_completed && idea_progress.url\n\t\t\t\t# idea realized\n\n\t\t\t\t# notify owner if wants notification\n\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_realized_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_realized_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\tmessage.url = idea_progress.url\n\t\t\t\t\tNotificationMailer.idea_realized_owner(message).deliver\n\t\t\t\tend\n\n\t\t\t\t# notify subscribers\n\t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t message = Message.new\n\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_realized_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_realized_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t message.url = idea_progress.url\n\t\t\t\t\t\t NotificationMailer.idea_realized_subscriber(message).deliver\n\t\t\t\t\t end\n \t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# see if this idea is already claimed by this org\n\t\t\t\tideas = IdeaProgress.where(\"idea_id = ? and organization_id = ? and id != ?\",\n\t\t\t\t\tidea_progress.idea_id, idea_progress.organization_id, idea_progress.id)\n\n\t\t\t\tif ideas && !ideas.empty?\n\t\t\t\t\t# org already claimed, just an update\n\t\t\t\t\t# notify owner if wants notification\n\t\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_progress_update_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_progress_update_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\t\tmessage.url_id = idea_progress.idea_id\n\t\t\t\t\t\tNotificationMailer.idea_progress_update_owner(message).deliver\n\t\t\t\t\tend\n\n\t\t\t\t\t# notify subscribers\n \t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t\t message = Message.new\n\t\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_progress_update_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_progress_update_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t\t message.url_id = idea_progress.idea_id\n\t\t\t\t\t\t\t NotificationMailer.idea_progress_update_subscriber(message).deliver\n\t\t\t\t\t\t end\n \t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# org is claiming idea\n\t\t\t\t\t# notify owner if wants notification\n\t\t\t\t\tif idea_progress.idea.user.wants_notifications\n\t\t\t\t\t\tmessage = Message.new\n message.locale = idea_progress.idea.user.notification_language \n\t\t\t\t\t\tmessage.email = idea_progress.idea.user.email\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.notification.idea_claimed_owner.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.notification.idea_claimed_owner.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\tmessage.org_message = idea_progress.explaination\n\t\t\t\t\t\tmessage.url_id = idea_progress.idea_id\n\t\t\t\t\t\tNotificationMailer.idea_claimed_owner(message).deliver\n\t\t\t\t\tend\n\n\t\t\t\t\t# notify subscribers\n \t\t\t\tI18n.available_locales.each do |locale|\n\t\t\t\t\t message = Message.new\n\t\t\t\t\t message.bcc = Notification.follow_idea_users(idea_progress.idea_id, locale)\n\t\t\t\t\t if !message.bcc.blank?\n\t\t\t\t\t\t # if the owner is a subscriber, remove from list\n\t\t\t\t\t\t index = message.bcc.index(idea_progress.idea.user.email)\n\t\t\t\t\t\t message.bcc.delete_at(index) if index\n\t\t\t\t\t\t # only continue if owner was not only subscriber\n\t\t\t\t\t\t if message.bcc.length > 0\n message.locale = locale\n\t\t\t\t\t\t\t message.subject = I18n.t(\"mailer.notification.idea_claimed_subscriber.subject\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.message = I18n.t(\"mailer.notification.idea_claimed_subscriber.message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :organization => idea_progress.organization.name, :locale => locale)\n\t\t\t\t\t\t\t message.org_message = idea_progress.explaination\n\t\t\t\t\t\t\t message.url_id = idea_progress.idea_id\n\t\t\t\t\t\t\t NotificationMailer.idea_claimed_subscriber(message).deliver\n\t\t\t\t\t\t end\n\t\t\t\t\t end\n \t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend",
"def notify_authors_of_new_item(solr_doc)\n doc = SolrDocument.new(solr_doc)\n ldap = Cul::LDAP.new\n\n unis = solr_doc.fetch('author_uni_ssim', [])\n preferred_emails = EmailPreference.preferred_emails(unis)\n\n preferred_emails.each do |uni, email|\n # Skip if notification was already sent.\n next if Notification.sent_new_item_notification?(solr_doc['cul_doi_ssi'], uni)\n\n begin\n name = (author = ldap.find_by_uni(uni)) ? author.name : nil\n success = true\n UserMailer.new_item_available(doc, uni, email, name).deliver_now\n rescue StandardError => e\n logger.error \"Error Sending Email: #{e.message}\"\n logger.error e.backtrace.join(\"\\n \")\n success = false\n end\n Notification.record_new_item_notification(doc[:cul_doi_ssi], email, uni, success)\n end\n end",
"def completed\n SignaturesMailer.completed\n end",
"def after_commit(idea)\n\t\t# only process if a create just occurred\n\t\t# - see after_create method above\n\t\tif idea.is_create\n\t\t\tcategory_ids = idea.idea_categories.map{|x| x.category_id}\n\t\t\tif category_ids && !category_ids.empty?\n\t\t\t\tmessage = Message.new\n\t\t\t\tmessage.bcc = Notification.new_idea_users(category_ids)\n\t\t\t\tif message.bcc && !message.bcc.empty?\n\t\t\t\t\t# if the owner is a subscriber, remove from list\n\t\t\t\t\tindex = message.bcc.index(idea.user.email)\n\t\t\t\t\tmessage.bcc.delete_at(index) if index\n\t\t\t\t\t# only continue if owner was not only subscriber\n\t\t\t\t\tif message.bcc.length > 0\n\t\t\t\t\t\tmessage.subject = I18n.t(\"mailer.subscriber.new_idea.subject\")\n\t\t\t\t\t\tmessage.message = I18n.t(\"mailer.subscriber.new_idea.message\")\n\t\t\t\t\t\tmessage.org_message = idea.explaination\n\t\t\t\t\t\tmessage.url_id = idea.id\n\t\t\t\t\t\tNotificationSubscriberMailer.new_idea(message).deliver\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def user_added_email(course, user)\n @course = course\n @recipient = user.user\n\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end",
"def notification_of_new_update_to_listing(listing, recipient, host=nil)\n set_locale recipient.locale\n subject_string = t(:listing_you_follow_has_been_updated)\n url = host ? \"http://#{host}#{listing_path(listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(recipient.id)}\" : \"test_url\"\n recipients recipient.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :listing => listing, :url => url, :settings_url => settings_url, :recipient => recipient, :listing_title => get_title_with_category(listing)\n end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def deliver_admin_notice\n unless self.registered_download.cc.blank?\n RegisteredDownloadsMailer.delay.admin_notice(self)\n end\n end",
"def transaction_complete\n NotificationsMailer.transaction_complete\n end",
"def notify_modification\n if @ok\n msg = params[:details_placeholder].blank? ? '' : params[:details]\n @lesson.notify_changes msg\n end\n end",
"def send_email_changed_notification; end",
"def document_added(user, document, author)\n redmine_headers 'Project' => document.project.identifier\n @author = author\n @document = document\n @user = user\n @document_url = url_for(:controller => 'documents', :action => 'show', :id => document)\n mail :to => user,\n :subject => \"[#{document.project.name}] #{l(:label_document_new)}: #{document.title}\"\n end",
"def part_num_update(part_numbers, designers, active_designs, total_part_nums, num_updated)\n subject = 'Part Number Descriptions Have Been Auto Updated' \n\n recipients = []\n recipients += designers.collect { |u| u.email}\n recipients += User.where(:last_name => [\"Kasting\", \"Light\", \"Michaels\"]).collect { |u| u.email}\n recipients << \"dtg@teradyne.com\"\n #recipients << \"jonathan.katon@teradyne.com\"\n \n @part_numbers = part_numbers\n @active_designs = active_designs\n @total_part_nums = total_part_nums\n @num_updated_part_nums = num_updated\n \n mail(:to => recipients.uniq,\n :subject => subject \n )\n end",
"def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end",
"def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end",
"def news_comment_added(user, comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def run_on_modifications(paths)\n @builder.notify\n end",
"def notify_french(dest)\n mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))\n end",
"def user_added_email(user)\n ActsAsTenant.without_tenant do\n @course = user.course\n end\n @recipient = user.user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end",
"def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end",
"def send_email_after_change_start_date\n\n #Do nothing if start_date not change\n return if(!self.start_date_changed?)\n\n contestants = self.users\n\n #Send email to creator\n UserMailer.start_date_change_creator(self.creator, self).deliver\n\n #Send email to contestants\n contestants.each do |c|\n UserMailer.start_date_change_contestant(c, self).deliver\n end\n\n end",
"def update_course_revisions\n log_message 'Importing revisions and articles for soon-to-end courses'\n Course.ready_for_short_update.each { |course| UpdateCourseRevisions.new(course) }\n end",
"def new_to_do_update\n UpdateMailer.new_to_do_update\n end",
"def commit_list!\n @last_log_recipient_list.save if @last_log_recipient_list.present? && @last_log_recipient_list.changed?\n end",
"def send_force_commit_mail(body)\n mail = Emailer.create_foced_commit(config.force_commit_mails,body)\n Emailer.deliver(mail)\nend",
"def notify_concierge(record)\n if record.user.concierge && record.user.concierge_id != record.author_id\n create_notification(record, record.user.concierge)\n end\n end",
"def vcs_commit(evt)\n sel = @tblChanges.selection_model.selected_items\n msg = @cmbCommitMsg.value\n if sel.length == 0\n fx_alert_error \"Cannot commit on empty changes selection. Please select at least a file from the table above.\", \"No Files Selected\", main_stage\n elsif (msg.nil? or msg.empty?)\n fx_alert_error \"Commit message must be present.\", \"Empty Commit Message\", main_stage\n else\n commit_changes(sel, msg)\n if not @msgHistory.include?(msg)\n @cmbCommitMsg.items.add(msg)\n @msgHistory << msg\n end\n refresh_tab_state\n end\n end",
"def request_has_been_modified_by_user_to_teacher(participation_request, message)\n @message = message\n retrieve_participation_request_variables(participation_request)\n mail to: @admin.email,\n subject: (@participation_request.old_course_id.present? ? 'Changement de cours' : 'Changement de date') + \" - #{@user.name}\",\n reply_to: generate_reply_to('admin')\n end",
"def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end",
"def lookup_commit_details(msg)\n rev = msg[:message]\n commit = fetch_svn_commit(rev).first\n messagetext = \"#{commit[:author]} committed revision #{commit[:revision]} \" +\n \"#{time_ago_in_words(commit[:date])} ago:\\n\"\n\n messagetext += \"\\n#{commit[:message]}\\n\"\n messagetext += \"----\\n\"\n commit[:paths].each do |path|\n messagetext += path[:action] + \" \" + path[:path] + \"\\n\"\n end\n\n msg.paste(messagetext)\n\n messagetext = \"More detail can be found at \" + bot.config['svn_webui_url']\n msg.speak(messagetext)\n\n @log.info messagetext\n end",
"def apply(event)\n info \"Finished applying updates\"\n\n Mailer.applied(\n event.payload[:update_names],\n event.payload.fetch(:unconformant_records, [])\n ).deliver\n end",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def inform_user_of_news_update_mail(signature, update)\n @signature = signature\n @update = update\n @petition = @signature.petition\n @unique_key = url_for(\n controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key)\n\n subject = t('mail.petition.progress_subject', petition: @petition.name)\n\n mail(to: signature.person_email, subject: subject)\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end",
"def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def completed(build, listener)\n end",
"def execute\n puts Mailbot::Repository.new(file).entries.map { |entry| colorized_subject entry }.map(&:strip).join(\"\\n\")\n end",
"def job_complete(job)\n @job = job\n mail subject: \"Job Complete\"\n end",
"def complete_lesson\n UserMailer.complete_lesson\n end",
"def created()\n pending = @@server.pending\n messages = []\n\n # common format for message lines\n append = proc do |title, list|\n next unless list\n if list.length > 0 and list.length < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if list.include? item.attach\n end\n messages << \"#{title} #{titles.join(', ')}\"\n elsif list.length > 1\n messages << \"#{title} #{list.length} reports\"\n end\n end\n\n append 'Approve', pending.approved\n append 'Unapprove', pending.unapproved\n append 'Flag', pending.flagged\n append 'Unflag', pending.unflagged\n\n # list (or number) of comments made with this commit\n comments = pending.comments.keys().length\n if comments > 0 and comments < 6\n titles = []\n Agenda.index.each do |item|\n titles << item.title if pending.comments[item.attach]\n end\n messages << \"Comment on #{titles.join(', ')}\"\n elsif comments > 1\n messages << \"Comment on #{comments} reports\"\n end\n\n # identify (or number) action item(s) updated with this commit\n if pending.status\n if pending.status.length == 1\n item = pending.status.first\n text = item.text\n if item.pmc or item.date\n text += ' ['\n text += \" #{item.pmc}\" if item.pmc\n text += \" #{item.date}\" if item.date\n text += ' ]'\n end\n\n messages << \"Update AI: #{text}\"\n elsif pending.status.length > 1\n messages << \"Update #{pending.status.length} action items\"\n end\n end\n\n @message = messages.join(\"\\n\")\n end",
"def watch_commits\n watch( \"COMMIT_EDITMSG\") do |md| \n run_all\n end\nend",
"def after_commit(model)\n # get the customer\n customer = model.customer\n\n # do a UI update push for this customer\n PUBNUB.publish({\n # NJS - use more secure channel name\n :channel => \"customer_ui_update_available_#{customer.id}\",\n # the actual message is ignored\n :message => \"UI update available\",\n :callback => lambda { |message| puts(message) }\n })\n end",
"def new_comment_update\n UpdateMailer.new_comment_update\n end",
"def add_commit(commit)\n\t\tpattern = ChangelogFilter.pattern\n\t\tfiltered_text = Git.get_filtered_message(commit, pattern)\n\t\tif filtered_text\n\t\t\tfiltered_lines = filtered_text.split(\"\\n\").uniq\n\t\t\tif @changelog\n\t\t\t\t@changelog = @changelog.concat(filtered_lines).uniq\n\t\t\telse\n\t\t\t\t@changelog = filtered_lines\n\t\t\tend\n\t\tend\n\tend",
"def wiki_content_updated(wiki_content)\n redmine_headers 'Project' => wiki_content.project.identifier,\n 'Wiki-Page-Id' => wiki_content.page.id\n @author = wiki_content.author\n message_id wiki_content\n recipients wiki_content.recipients\n cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)\n subject \"[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}\"\n body :wiki_content => wiki_content,\n :wiki_content_url => url_for(:controller => 'wiki', :action => 'show',\n :project_id => wiki_content.project,\n :id => wiki_content.page.title),\n :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff',\n :project_id => wiki_content.project, :id => wiki_content.page.title,\n :version => wiki_content.version),\n :diff => wiki_content.page.diff(wiki_content.version.to_i)\n render_multipart('wiki_content_updated', body)\n end",
"def _on_completion\n\t\t\tself.update_attribute(:completed_at, DateTime.now)\n\t\t\tassignments.update_all(completed_at: DateTime.now)\n\t\t\tresolver.on_completion(self)\n\t\tend",
"def successfully_completed\n self.update(status: SUCCESSFUL)\n changed\n notify_observers(self)\n end",
"def changes_notification\n NotifierMailer.changes_notification(User.limit(2), {\n title: 'Email test title',\n content: 'Email test content',\n body: 'Email test body'\n })\n end",
"def notify_change\n SpecificNodeMailer.notify_change\n end",
"def on_message_complete\n @finished = true\n end",
"def notify_subscribers\n AdminMailer.notify_of_comment(self)\n end",
"def notify_subscribers_about_new_response(reply)\n subscribers.each do |user|\n user.with_user_locale do\n UserMailer.reply_notification(user.id, reply.id).deliver!\n end unless user == reply.user\n end\n end",
"def cmt\n @cmt_procs.call('Committing')\n self\n end",
"def draft_message; draft.complete_message if draft; end",
"def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end",
"def course_duplicated_email(original_course, new_course, user)\n # Based on DuplicationService, user might default to User.system which has no email.\n return unless user.email\n\n @original_course = original_course\n @new_course = new_course\n @recipient = user\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', new_course: @new_course.title))\n end\n end",
"def item_added(item)\n @item = item\n\n mail subject: \"New item available!\",\n to: \"nobody@yardsale.com\",\n bcc: User.all.pluck(:email)\n end",
"def send_mail_to_instructor\n AssignmentSubmissionMailer.attachment_changed_notification(self.attachable).deliver\n end",
"def commit_message\n @commit.sub '%.%.%', @after_version\n end",
"def newsletter\n<<<<<<< HEAD\n HhMailer.newsletter\n=======\n HhMailer.newsletter(Home.all)\n>>>>>>> 33a2a16302cd13e30f994602051fd115a1b09b64\n end",
"def new_commit(commit)\n puts cyan(\"Found new commit: #{commit}\")\n end",
"def send_email_changed_notification?; end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def export_finished_success_email(user, filename, opml)\n @user = user\n @url = read_url locale: user.locale\n attachments[filename] = opml\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def notify_manager(task_submission)\n @submitter = task_submission.submitter\n @manager = @submitter.manager\n I18n.with_locale(@manager.locale) do\n mail(to: @manager.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end",
"def transaction_done\n puts \".........\" + self.class.name + \" has been notified\"\n end",
"def confirm_update(mailing_email)\n @email = mailing_email\n mail to: mailing_email.email, subject: \"Coming Soon: \" + @email.campaign\n end",
"def course_duplicate_failed_email(original_course, user)\n # Based on DuplicationService, user might default to User.system which has no email.\n return unless user.email\n\n @original_course = original_course\n @recipient = user\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', original_course: @original_course.title))\n end\n end",
"def send_mail(symlinks, hash)\n \n subject=\"Subversion notification. Symbolic links checked in!\"\n \n body=\"The following symlinks have been checked in:\\n\\n\" << symlinks.join(\"\\n\") \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n body << \"\\n\\nPlease remove the above link(s) from Subversion.\"\n yield(subject, body)\n end",
"def append_delivery_notes\n self.message += \"\\n----\\nFrom: #{self.user.email} #{Time.now}\\n\" + I18n.translate(:delivered_to)+\" \"\n if( all_users = (@recipients.count == User.count))\n self.message += I18n.translate(:all_users, count: @recipients.count)\n else\n self.message += @recipients.all.map { |recipient|\n recipient.name + \" (#{recipient.email})\"\n }.join(\", \")\n end\n end",
"def announce_consensus_change(old_name, new_name)\n log_consensus_change(old_name, new_name)\n\n # Change can trigger emails.\n owner = user\n sender = User.current\n recipients = []\n\n # Tell owner of observation if they want.\n recipients.push(owner) if owner&.email_observations_consensus\n\n # Send to people who have registered interest.\n # Also remove everyone who has explicitly said they are NOT interested.\n interests.each do |interest|\n if interest.state\n recipients.push(interest.user)\n else\n recipients.delete(interest.user)\n end\n end\n\n # Remove users who have opted out of all emails.\n recipients.reject!(&:no_emails)\n\n # Send notification to all except the person who triggered the change.\n (recipients.uniq - [sender]).each do |recipient|\n QueuedEmail::ConsensusChange.create_email(sender, recipient, self,\n old_name, new_name)\n end\n end",
"def subscription_updated(customer_param, atts = {})\n around_mail_action(:subscription_updated, customer_param, atts) do\n return true unless EffectiveOrders.mailer[:send_subscription_updated]\n\n @customer = (customer_param.kind_of?(Effective::Customer) ? customer_param : Effective::Customer.find(customer_param))\n @subscriptions = @customer.subscriptions\n @user = @customer.user\n\n @subject = subject_for(@customer, :subscription_updated, 'Subscription Changed')\n\n mail(to: @customer.user.email, subject: @subject)\n end\n end",
"def pr_contains_localization_changes\n files = danger_file.git.added_files + danger_file.git.modified_files\n\n !files.grep(/.strings/).empty?\n end",
"def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end",
"def create_success_message(new_invitations, existing_invitations, new_course_users, existing_course_users)\n if invite_by_file?\n t('.file.success',\n new_invitations: t('.file.summary.new_invitations', count: new_invitations),\n already_invited: t('.file.summary.already_invited', count: existing_invitations),\n new_course_users: t('.file.summary.new_course_users', count: new_course_users),\n already_enrolled: t('.file.summary.already_enrolled', count: existing_course_users))\n else\n t('.manual_entry.success')\n end\n end",
"def study_upload_complete(user, num_successful, problem_lines, warning_lines)\n\t\tbegin\n\t\t\tfrom \t\t\tDEFAULT_FROM\n\t\t\treply_to \t\tDEFAULT_REPLY_TO\n\t\t\tsubject \t\t\"Your SRDR Study Upload\"\n\t\t\trecipients \t\tuser.email\n\t\t\tsent_on \t\tTime.now\n\t\t\t@num_successful = num_successful\n\t\t\t@problem_lines = problem_lines\n\t\t\t@warning_lines = warning_lines\n\t\trescue Exception=>e \n\t\t\tputs \"ERROR SENDING UPLOAD NOTIFICATION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n\t\tend\n\tend",
"def status_changed(participation)\n @cbo = participation.cbo\n @user = participation.user\n @participation = participation\n @url = \"http://#{request.host_with_port}\" + participation_path(participation)\n \n mail(:to => @user.email, :subject => \"Your application to #{@cbo.cboprofile.name} has been updated!\")\n end",
"def log_complete\n @notifier.log \"#{identifier}: Done\", level: :collect\n end",
"def artist_approval(artist, recipients)\n @artist = artist\n mail(to: recipients,\n subject: \"Artist relations approval\")\n end",
"def notify_company_admin(admin, task_submission)\n @submitter = task_submission.submitter\n\n I18n.with_locale(admin.locale) do\n mail(to: admin.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end",
"def notify_prepare_commit\n raise NotImplementedError\n end"
] |
[
"0.723171",
"0.6812909",
"0.5627617",
"0.5495406",
"0.5486109",
"0.5310931",
"0.53092414",
"0.52934015",
"0.5289982",
"0.52562934",
"0.5224683",
"0.52192616",
"0.5202396",
"0.51896894",
"0.51769894",
"0.5159606",
"0.51432633",
"0.51409966",
"0.5133543",
"0.5085821",
"0.5084093",
"0.5069533",
"0.50618273",
"0.50595677",
"0.5056085",
"0.50411916",
"0.5027105",
"0.50142765",
"0.50094604",
"0.5005864",
"0.4994735",
"0.49803507",
"0.49665552",
"0.49445936",
"0.4940914",
"0.49375248",
"0.49355665",
"0.4924203",
"0.49054298",
"0.49051493",
"0.48970503",
"0.48916474",
"0.48632866",
"0.48631456",
"0.48612937",
"0.48561954",
"0.48546788",
"0.48488736",
"0.4842304",
"0.4840189",
"0.48335993",
"0.48308176",
"0.4824097",
"0.48239088",
"0.4819977",
"0.48068893",
"0.47990295",
"0.47930917",
"0.4791004",
"0.47836116",
"0.47819367",
"0.47719455",
"0.4763006",
"0.47580403",
"0.47568032",
"0.4752407",
"0.4748929",
"0.47486132",
"0.47485825",
"0.47447923",
"0.47382295",
"0.47378123",
"0.4731854",
"0.47259104",
"0.47255877",
"0.47234488",
"0.47051919",
"0.47034183",
"0.4700745",
"0.46988896",
"0.46920145",
"0.46915096",
"0.46915096",
"0.4667859",
"0.4667856",
"0.46619838",
"0.4653485",
"0.4645531",
"0.46438324",
"0.46380267",
"0.46379644",
"0.46371913",
"0.46370584",
"0.46335787",
"0.46318415",
"0.463184",
"0.4625228",
"0.46241382",
"0.46237782",
"0.461735",
"0.46129414"
] |
0.0
|
-1
|
Helper method that will give you a joined pods/metrics query proxy.
|
def metrics
pods.outer_join(:github_pod_metrics).on(:id => :pod_id).join(:cocoadocs_pod_metrics).on(:id => :pod_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pods\n\nend",
"def joined\n meta(joined: true)\n end",
"def joins\n @joins\n end",
"def joins(args={})\n # If showing pending, do not joins question responses\n return args[:show_pending] ? nil : :question_responses\n end",
"def query(metric_name, options={})\n key = build_key(metric_name)\n parse_time_range(options)\n key << assemble_for(options)\n if options[:id]\n key = \"dnid:#{options[:id]}\"\n real_key = DulyNoted.redis.get key\n if options[:meta_fields]\n options[:meta_fields].collect! { |x| x.to_s }\n result = {}\n options[:meta_fields].each do |field|\n result[field] = DulyNoted.redis.hget real_key, field\n end\n results = [result]\n else\n results = [DulyNoted.redis.hgetall(real_key)]\n end\n else\n keys = find_keys(key)\n grab_results = Proc.new do |metric|\n if options[:meta_fields]\n options[:meta_fields].collect! { |x| x.to_s }\n result = {}\n options[:meta_fields].each do |field|\n result[field] = DulyNoted.redis.hget metric, field\n end\n result\n else\n DulyNoted.redis.hgetall metric\n end\n end\n results = []\n if options[:time_start] && options[:time_end]\n keys.each do |key|\n results += DulyNoted.redis.zrangebyscore(key, options[:time_start].to_f, options[:time_end].to_f).collect(&grab_results)\n end\n else\n keys.each do |key|\n results += DulyNoted.redis.zrange(key, 0, -1).collect(&grab_results)\n end\n end\n end\n return results\n end",
"def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\n\n metrics << {\n 'source' => source,\n 'value' => result['value'][1]\n }\n end\n metrics\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def pods\n groups.find { |g| g.name == 'Pods' }\n end",
"def pioQuery\n client.query(current_company.user => 4)\n end",
"def connect_through_proxy; end",
"def join(other, join_definition, relation_aliases = {})\n joined = index.join(other.index, join_definition, relation_aliases)\n new(joined, other.index.aliases(joined))\n end",
"def get_active_metrics(from)\n @metric_svc.get_active_metrics(from)\n end",
"def connect_through_proxy\n add_headers\n write(join_headers)\n end",
"def _to_dsl_proxy\n self\n end",
"def index\n @search = Admins::Politician.ransack(params[:q])\n @admins_politicians = @search.result.includes(:office).paginate(page: params[:page], per_page: 10)\n end",
"def sharedPods\n\nend",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def fetch_pods(release)\n release.clients.flat_map do |client, query|\n client.get_pods(query).map! do |p|\n Kubernetes::Api::Pod.new(p, client: client)\n end\n end\n end",
"def query\n self\n end",
"def query\n self\n end",
"def serverWorker_pods\nend",
"def collect_metrics\n\n # Build a set of matchers to match the paths we need to find metrics\n # for.\n path_matchers = []\n @paths.each do |path|\n path_matchers << { :path => matcher_for_path(path) }\n end\n\n # Figure out what metric model to use (Metric or one of the average\n # models).\n metric_model = metric_model_for_timespan\n\n # Build a query to locate the metrics.\n query = metric_model.where(:$or => path_matchers)\n query = query.where(:node_id => @node_id)\n query = query.where(:timestamp.gte => @from)\n query = query.where(:timestamp.lte => @to)\n query = query.sort(:timestamp.asc)\n metrics = query.all\n\n # Return a data set based on the collection of metrics.\n data_set_for_metrics(metrics)\n\n end",
"def join_query\n prefixes = Survey.all.map &:prefix\n query = [\"select * from export_journal_infos ji, \"] << prefixes.map {|prefix| \"export_variables_#{prefix}_answers\" }\n prefixes.each do |prefix|\n query << \"where export_variables_#{prefix}_answers. #{prefix} on #{prefix}.journal_id = ji.journal_id \"\n # query << \"inner join export_variables_#{prefix}_answers #{prefix} on #{prefix}.journal_id = ji.journal_id \"\n end\n query\n end",
"def query_for(source, other_query = nil)\n repository_name = relative_target_repository_name_for(source)\n\n DataMapper.repository(repository_name).scope do\n query = target_model.query.dup\n query.update(self.query)\n query.update(source_scope(source))\n query.update(other_query) if other_query\n query.update(:fields => query.fields | target_key)\n end\n end",
"def proxy\n @proxy\n end",
"def joins\n\t\tprivate_methods(false).grep(/_joins$/).sort.map { |m| send(m) }.compact\n\tend",
"def metrics\n manager_instance(MetricManager)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def proxy(object_manager); object_manager.plan end",
"def query\n opinions = Decidim::Opinions::Opinion.where(component: @components)\n opinions = opinions.where(\"created_at >= ?\", @start_at) if @start_at.present?\n opinions = opinions.where(\"created_at <= ?\", @end_at) if @end_at.present?\n opinions\n end",
"def dimension_offer\n base_query.dimension_offer\n .includes(:sector, :weeks, :group, :school)\n end",
"def proxy\n return @proxy\n end",
"def call\n reference_objects = if cache_reponse = @redis.hget(@collection_identifier, @collection_params)\n from_cache(cache_reponse)\n else\n from_query\n end\n\n ReferencesMap.new(@aggregator, reference_objects)\n end",
"def proxies; end",
"def related_search(query, opts = {})\n invoke 'RelatedSearch', query, opts\n end",
"def alias_node_query\n Category.left_outer_joins(:articles)\n .join_recursive do |query|\n query\n .connect_by(id: :parent_id)\n end\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def left_joins_by_alias\n {}\n end",
"def my_pod\n get_pod_by_namespace_and_hostname(my_namespace, ENV[\"HOSTNAME\"])\n end",
"def active_records(relation)\n ActiveRecordProxy.new(@client, @search_definition, relation)\n end",
"def query(options={})\n from = parse_date(options[:from]).strftime('%Y-%m-%d')\n to = parse_date(options[:to]).strftime('%Y-%m-%d')\n\n response = Client.instance.request(:data,\n 'start-date' => from,\n 'end-date' => to,\n 'ids' => \"ga:#{@profile_id}\",\n 'metrics' => @metrics.join(','),\n 'dimensions' => @dimensions.join(','))\n \n\n headers = column_headers(response['columnHeaders'])\n group(response['rows'], headers)\n end",
"def index\n @search = Admins::Politician.ransack(params[:q])\n @users_politicians = @search.result.includes(:office).paginate(page: params[:page], per_page: 10)\n end",
"def relation_method\n :join\n end",
"def join_dependency\n jd = ::ActiveRecord::Associations::ClassMethods::JoinDependency\n @join_dependency ||= jd.new model,\n @conditions.to_find_include,\n nil\n end",
"def get_related_users(query='', results=10, start=0)\r\n get_related('Users',query, results, start)\r\n end",
"def index\n @q = Workpoint.eager_load(:workplace => {:subdivision => :company}).ransack(params[:q])\n @workpoints = @q.result(distinct: true)\n # @workpoints = Workpoint.all\n end",
"def expert_equals_in other\n Search.alive?\n .joins(pseudo_graph_pattern: :term_mappings)\n .where(pseudo_graph_patterns: { read_timeout: other.read_timeout })\n .where(pseudo_graph_patterns: { sparql_limit: other.sparql_limit })\n .where(pseudo_graph_patterns: { answer_limit: other.answer_limit })\n .where(pseudo_graph_patterns: { target: other.target })\n .where(pseudo_graph_patterns: { private: false })\n .where(pseudo_graph_patterns: { term_mappings: { dataset_name: other.target } })\n .where(pseudo_graph_patterns: { term_mappings: { mapping: other.mappings } })\n .order(created_at: :desc)\n .first\n end",
"def join_query(from, to, field, value)\n \"_query_:\\\"{!join from=#{from} to=#{to}}#{field}:\\\\\\\"#{value}\\\\\\\"\\\"\"\n end",
"def query(tags)\n tags = tags.map do |k,v|\n \"#{k}:#{v}\"\n end\n @client.http_get(\"/metrics/?type=#{@type}&tags=#{tags.join(',')}\").map do |g|\n Hawkular::Metrics::MetricDefinition::new(g)\n end\n end",
"def view\n if params[:id]\n [client.get(params)]\n elsif params[:scroll]\n scroll_enumerator(client, response)\n else\n response.fetch(\"hits\").fetch(\"hits\")\n end\n end",
"def metrics_mapping(other)\n mapping = (metrics + methods).product(other.metrics + other.methods).select do |m_a, m_b|\n m_a.system_name == m_b.system_name\n end.map { |m_a, m_b| [m_a.id, m_b.id] }.to_h\n\n backend_pairs = backend_usage_list.map(&:backend).product(other.backend_usage_list.map(&:backend)).select do |b_a, b_b|\n b_a.system_name == b_b.system_name\n end\n\n backend_pairs.each do |b_a, b_b|\n mapping.merge!(b_a.metrics_mapping(b_b))\n end\n\n mapping\n end",
"def get_points(query, from, to)\n @metric_svc.get(query, from, to)\n end",
"def predicate_visitor\n join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, association_joins, custom_joins)\n MetaWhere::Visitors::Predicate.new(join_dependency)\n end",
"def relationship_relation company_id_field, referer_id\n Relationship.joins(\n \"join card_references cr on cr.referee_id = relationships.#{company_id_field}\"\n ).where(\n \"cr.referer_id = #{referer_id} \" \\\n \"and #{relationship_prefix}metric_id = #{metric_card.id}\"\n )\n end",
"def with_workers_works_a_bit\n association_join(:workers, select: [:id, :title])\n end",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def query_def; (x = @hits.first) ? x.query_def : nil; end",
"def proxy\n @proxy ||= Proxy.new self\n end",
"def get_joins\n join_sources = @model.arel_table.\n join(@associated.source).\n on(@associated.filters).\n join_sources\n return @model.joins(@members + join_sources)\n end",
"def build_metrics(merge_request)\n # There's no need to query and serialize metrics data for merge requests that are not\n # merged or closed.\n return unless merge_request.merged? || merge_request.closed?\n return merge_request.metrics if merge_request.merged? && merge_request.metrics&.merged_by_id\n return merge_request.metrics if merge_request.closed? && merge_request.metrics&.latest_closed_by_id\n\n build_metrics_from_events(merge_request)\n end",
"def pods\n retry_on_error backoff: KUBELET_ERROR_BACKOFF_SECONDS do\n throttle per_second: KUBELET_MAX_REQUESTS_PER_SECOND, throttled: [] do\n JSON.parse(http_get('https://localhost:10250/pods')).fetch(\"items\")\n end\n end\n rescue StandardError\n []\n end",
"def index\n @q = StaffWorker.eager_load(:subdivision => :company).ransack(params[:q])\n @staff_workers = @q.result(distinct: true)\n # @staff_workers = StaffWorker.all\n end",
"def index_joins\n @rails.choice[:joins]\n end",
"def joins\n @joins ||= [@options[:joins]].flatten.compact\n end",
"def recommend\n @user = current_user\n @pods = @user.pods\n @podsname = @pods.last.name\n\n if @podsname == nil\n @query = Pod.search do \n fulltext \"djsadpkapodpoakd;sad\"\n end\n @podslist = @query.results\n else\n @query = Pod.search do\n fulltext (@podsname)\n end\n @podslist = @query.results \n end \n\n end",
"def build_collection_proxy(target, association_name:, class_name:, embedded:)\n CollectionProxy.new(**{\n parent: self,\n target: target,\n embedded: embedded,\n class_name: class_name,\n association_name: association_name\n })\n end",
"def apply_lazyloading\n @query = @query.includes(:user).includes(theme: :moderator)\n end",
"def proxy; self end",
"def pod\n @pod ||= lambda{\n host = lygneo_id.split('@')[1]\n ResourceServer.where(:host => host).first || ResourceServer.register(host)\n }.call\n end",
"def collect_join_chain\n [self]\n end",
"def metrics_for_metric_name\n @metrics = Metric.includes(:metric_name).where(metric_name_id: metric_name_id[:id]);\n render json: @metrics.order({created_at: :asc}),include: [:metric_name], status: :ok\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def query_metric(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'QueryMetric'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :extend\n\t\t\targs[:query]['Extend'] = optional[:extend]\n\t\tend\n\t\tif optional.key? :length\n\t\t\targs[:query]['Length'] = optional[:length]\n\t\tend\n\t\tif optional.key? :metric\n\t\t\targs[:query]['Metric'] = optional[:metric]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :period\n\t\t\targs[:query]['Period'] = optional[:period]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:query]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend",
"def run\n ShoutSearchQuery.new(term).to_relation\n end",
"def determineQuery(metric_param, time_window, time_period, series_length) \n \tif current_user\n user_id = MyRainBarrel.where(user_id: current_user.id).first\n else\n user_id = MyRainBarrel.where(id: 1).first\n end \n\n @total_metric = DailyWaterLog.find_by_sql([\"SELECT \n DISTINCT date_trunc(?, series.date)::date as date,\n id, \n #{metric_param.downcase.gsub(\" \", \"_\")},\n sum(COALESCE(#{metric_param.downcase.gsub(\" \", \"_\")}, 0)) OVER WIN as total_#{metric_param.downcase.gsub(\" \", \"_\")},\n overflowed, water_used, amount_overflown, ph, tds\n FROM (\n SELECT generate_series(?, 0) + (current_date-13)::date as date\n ) series \n LEFT OUTER JOIN \n daily_water_logs on series.date = daily_water_logs.created_at::date AND \n (daily_water_logs.created_at BETWEEN ? AND ?)\n WINDOW \n WIN AS (PARTITION BY date_trunc(?, series.date)::date)\n ORDER BY \n date ASC\", time_period, series_length, time_window, Time.now.tomorrow.midnight, time_period])\n end",
"def query\n get_query_object\n end",
"def eager_load(source, query = nil)\n target_maps = Hash.new { |h,k| h[k] = [] }\n\n collection_query = query_for(source, query)\n\n # TODO: create an object that wraps this logic, and when the first\n # kicker is fired, then it'll load up the collection, and then\n # populate all the other methods\n\n collection = source.model.all(collection_query).each do |target|\n target_maps[target_key.get(target)] << target\n end\n\n Array(source).each do |source|\n key = target_key.typecast(source_key.get(source))\n eager_load_targets(source, target_maps[key], query)\n end\n\n collection\n end",
"def query_moon_api\n result = connection.query\n end",
"def index\n @sections = Section\n .includes(suggestion: { user: :profile })\n .by_query(params[:q])\n end",
"def get_pod_by_namespace_and_hostname(namespace, hostname)\n kube_connection.get_pods(:namespace => namespace).detect { |i| i.metadata.name == hostname }\n end",
"def proxy(value)\n update_query(:proxy => value)\n end",
"def search_joins\n @search_joins || @includes\n end",
"def join_dependency\n @join_dependency ||= (\n build_join_dependency(\n Arel::SelectManager.new(table.engine, table),\n joins_values\n ) && @join_dependency\n )\n end",
"def joined\n Solve.join(Average.select(:visible, :solver_id, :puzzle_id, :competition_id, Sequel.as(:id, :avg_id)), avg_id: :average_id)\n end",
"def get_proxy(identifier); end",
"def get_proxy(identifier); end",
"def proxy\n manager_instance(ProxyManager)\n end",
"def aliases\n SideJob.redis.smembers \"#{redis_key}:aliases\"\n end",
"def services\n related_objects_by_type(\"Service\")\n end",
"def metrics\n @metrics ||= parent_klass.metrics.dup\n end",
"def proxy_target\n @target\n end",
"def go\n captured = query_by_referrer\n return captured if captured.found?\n\n default_ordered_query\n end",
"def pull_join\n raise NotImplementedError\n end",
"def metric(name, *args, &block)\n proc = args.first.is_a?(Proc) ? args.first : block\n opts = args.extract_options!\n\n if opts.key?(:through)\n [opts.delete(:through)].flatten.each do |query|\n raise ArgumentError, \"query #{query} is not defined\" unless queries.key?(query)\n queries[query].add_metric(name, proc, opts)\n end\n else\n # Allow metrics to define queries implicitly\n # ie. if you need a metric that counts a column, there's no need to explicitly create a query\n # and just pass it into a metric\n query = define_query(\"__metric_#{name}\", {}, &block)\n query.add_metric(name, -> result { result.first }, opts)\n end\n end",
"def results(profile, options = {})\n # TODO: making tracking scope configurable when results are querried. not sure how to do this.\n Query.new(self).apply_options(options.merge(:profile => profile))\n end",
"def client_query\n @_client_query ||= ProposalFieldedSearchQuery.new(query[user.client_model_slug])\n end",
"def relation\n Proxy\n end"
] |
[
"0.5139953",
"0.48673347",
"0.48086137",
"0.48034048",
"0.47497684",
"0.47373617",
"0.46751404",
"0.46732417",
"0.46656635",
"0.46642977",
"0.4595197",
"0.4592289",
"0.45597503",
"0.45221573",
"0.45056468",
"0.44869015",
"0.44813332",
"0.44614044",
"0.4454043",
"0.4454043",
"0.44371426",
"0.44238222",
"0.44232717",
"0.4404237",
"0.43969622",
"0.43931252",
"0.43715787",
"0.43699166",
"0.43685958",
"0.4364664",
"0.43634713",
"0.43593475",
"0.43562806",
"0.43418118",
"0.433149",
"0.4326955",
"0.43206766",
"0.43206766",
"0.43206766",
"0.4316073",
"0.4314632",
"0.43032876",
"0.4299869",
"0.42961118",
"0.42932138",
"0.42918396",
"0.42765713",
"0.42750338",
"0.4274242",
"0.42734775",
"0.42715764",
"0.42557323",
"0.4252045",
"0.42497277",
"0.4246395",
"0.42426598",
"0.4233688",
"0.42315802",
"0.42304",
"0.42293832",
"0.4229358",
"0.4227646",
"0.42273945",
"0.4225227",
"0.42234677",
"0.42233253",
"0.42147246",
"0.42092854",
"0.42086214",
"0.41982532",
"0.4197786",
"0.41954404",
"0.41914365",
"0.41906527",
"0.41906527",
"0.41895488",
"0.41875088",
"0.41846848",
"0.4184234",
"0.41791466",
"0.41782627",
"0.41733682",
"0.41619655",
"0.41603112",
"0.41563657",
"0.41557795",
"0.4155278",
"0.41548362",
"0.41548362",
"0.41532665",
"0.41519177",
"0.4151439",
"0.41462877",
"0.41337043",
"0.41322508",
"0.41286793",
"0.41256395",
"0.41235596",
"0.41228744",
"0.41213283"
] |
0.7241363
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_today_fortune
@today_fortune = TodayFortune.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 trusted parameter "white list" through.
|
def today_fortune_params
params.require(:today_fortune).permit(:tdate, :love, :health, :career, :color, :star, :number, :summary, :presummary, :money, :astro_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n 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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Time Complexity O(log10(n)): n is the numer of digits for input integer Space Complexity O(log10(n)): call stack for recursion, number of digits
|
def super_digit(n)
return n if n.digits.length == 1
n = n.digits.sum
return super_digit(n)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def super_digit(n)\n while n >= 10\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def super_digit(n)\n return n if n/10 == 0\n \n sum = n % 10\n while n/10 != 0\n n = n/10\n sum += n % 10\n end\n return super_digit(sum)\nend",
"def super_digit(n)\n # base case\n return n if n/10 == 0\n \n # recursive case\n return super_digit(n/10 + n%10)\nend",
"def super_digit(n)\n while n > 9\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def nDigits n,a\n return 1000 if a == 10 && n == 1000 # incorrect test\n ((Math.log10(a)*n)+1).to_i\nend",
"def super_digit(n)\n return n if n < 10 \n \n sum = 0\n until n == 0\n sum += n % 10\n n /= 10\n end\n \n return super_digit(sum) # I had n.digits.sum here earlier, but since #digits creates a new array, I thought this solution would be less expensive\nend",
"def super_digit(n)\n return n if n < 10\n\n sum_digits = 0\n until n == 0\n sum_digits += n % 10\n n /= 10\n end\n\n super_digit(sum_digits)\nend",
"def super_digit(n)\n return n if n < 10\n\n sum = 0 \n\n while n > 0\n digit = n % 10\n n /= 10\n sum += digit\n end\n\n super_digit(sum)\n\nend",
"def super_digit(n)\n return n if n < 10 \n return super_digit(n.to_s.chars.map(&:to_i).sum)\nend",
"def super_digit(n)\n return n if n < 10\n count = add_digits(n)\n return super_digit(count)\n\nend",
"def sum_digits(n)\n return n if n <= 9\n n % 10 + sum_digits(n / 10)\nend",
"def super_digit(n)\n return n if n < 10\n sum = super_digit_helper(n, 0)\n super_digit(sum)\nend",
"def count_digits(n)\n return 1 if (-9..9).cover? n #n >= -9 and n <= 9\n 1 + count_digits(n / 10)\nend",
"def super_digit(n)\n return n if n < 10\n sum = n.to_s.chars.map(&:to_i).sum\n return super_digit(sum)\nend",
"def super_digit(n)\n if 10 > n\n return n\n end\n\n last_digit = n % 10\n sum = n / 10 + last_digit \n \n return super_digit(sum)\nend",
"def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend",
"def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend",
"def super_digit(n)\n return n if n / 10 < 1\n \n string = n.to_s.split(\"\")\n sum = 0\n \n string.each do |num|\n sum += num.to_i\n end\n \n return super_digit(sum)\nend",
"def super_digit(n)\n\n return n if n < 10\n super_digit(n.digits.sum)\n\nend",
"def factorial_digits(n)\n return fact(n) if n <= 9\n fact(n % 10) + factorial_digits(n / 10)\nend",
"def super_digit(n)\n sum = 0\n while n >= 10 do\n sum += n % 10\n n /= 10\n end\n sum += n\n return sum < 10 ? sum : super_digit(sum)\nend",
"def super_digit(n, sum=0) \n return sum + n if n / 10 == 0\n return super_digit(super_digit(n/10, sum+(n%10)))\nend",
"def super_digit(n)\n if n >= 0 && n < 10 \n return n\n end\n digits_of_n = n.digits\n sum_digits = digits_of_n.sum\n\n return super_digit(sum_digits)\nend",
"def super_digit(n)\n return n if n < 10\n return super_digit(n.digits.sum)\nend",
"def super_digit(n)\n #has to be a single digit \n if n < 10 \n return n\n else \n return super_digit(n.digits.sum)\n end \n \n \nend",
"def super_digit(n)\n sum = 0\n\n if n < 10\n return sum + n\n else\n until n < 10\n sum += (n % 10)\n n /= 10\n end\n\n sum += n\n end\n\n return super_digit(n = sum)\nend",
"def super_digit(n)\n sum = 0;\n\n while n > 0 || sum > 9\n if n == 0\n n = sum\n sum = 0\n end\n sum += n % 10\n n /= 10\n end\n return sum\nend",
"def super_digit(n)\n n < 10 ? n : super_digit(n / 10 + n % 10)\nend",
"def super_digit(n)\n return n if n < 10\n\n return super_digit(n.digits.sum)\nend",
"def compute_number(digits)\n digits.length == 1 ? (digits.to_i) : (digits[-1].to_i + 10*compute_number(digits[0..-2]))\nend",
"def refined_super_digit(n, k)\n return n if n < 10\n super_digit(n.digits.sum * k) # k magic hint from https://www.hackerrank.com/challenges/super-digit/forum\nend",
"def super_digit(n)\n raise ArgumentError if n < 0\n return n if n < 10\n super_digit(sum_of_digits(n))\nend",
"def super_digit(n)\n num_array = n.to_s.chars.map(&:to_i)\n sum = num_array.sum\n if sum <9\n return sum\n else \n return super_digit(sum)\n end\n \nend",
"def sumdig_r(n)\n return n if n < 10\n (n%10) + sumdig_r(n/10)\nend",
"def digits(int)\n\tif int.div(10) == 0\n\t\treturn 1\n\telse \n\t\treturn 1 + digits(int.div(10))\n\tend\nend",
"def super_digit(n)\n return n if n <= 9\n \n until n < 10\n sum = 0\n sum += (n % 10)\n sum += (n / 10)\n n = sum\n end\n\n return sum\nend",
"def super_digit(n)\n return n if n / 10 == 0\n return super_digit(digit_helper(n))\nend",
"def digitize(n)\n n.digits\nend",
"def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend",
"def superDigit(n, k)\n target = n.split('').map(&:to_i).sum * k\n\n until target < 10\n target = target.digits.sum\n end\n\n target\nend",
"def super_digit(n)\n return n.abs if n.abs < 10\n\n sum = recursive_digit_helper(n)\n\n return super_digit(sum)\nend",
"def persistence(n)\n n < 10 ? 0 : 1 + persistence(n.digits.reduce(&:*))\nend",
"def super_digit(n)\n n_array = n.to_s.split('').map {|i| i.to_i}\n return n if n_array.length == 1\n return super_digit(n_array.sum)\nend",
"def digit_sum(num, digits)\n if digits == 1\n num\n else\n num % 10 + digit_sum(num / 10, digits - 1)\n end\nend",
"def digits_of_answer(digits)\n n = 0\n previous = 0\n i = 1\n\n\n\n while i.to_s.length < digits\n n += 1\n i, previous = previous, previous + i\n end\n\n (n-1)\nend",
"def occurrances(int, digit)\n\tif int.div(10) == 0 && int == digit\n\t\treturn 1\n\telsif int.div(10) == 0 \n\t\treturn 0\n\telsif int.modulo(10) == digit\n\t\treturn 1 + occurrances(int.div(10), digit)\n\telse\n\t\treturn occurrances(int.div(10), digit)\t\n\tend\t\nend",
"def persistence(n, count = 0)\n return count if n < 10\n i = 0\n arr = n.to_s.split('')\n if arr.length > 1\n tot = arr.map(&:to_i).inject(:*)\n i += 1\n count += 1\n tot.to_i >= 10 ? persistence(tot.to_i, count) : count\n end\nend",
"def sumdig_r(n)\n\n # puts \"#{n} and n /10 is #{n/10} and n%10 is #{n%10}\"\n\n if (n<10) \n return n\n else\n return n%10 + sumdig_r(n/10)\n end\nend",
"def digit_match(n, m, count = 0)\n # base case\n return 1 if n == 0 && m == 0\n return count if n == 0 || m == 0\n # recursive case\n if n % 10 == m % 10\n return digit_match(n/10, m/10, count + 1)\n else\n return digit_match(n/10, m/10, count)\n end\nend",
"def super_digit(n)\n string_n = n.to_s\n return n if string_n.size == 1\n\n i = 1\n sum = string_n[0].to_i\n while i < string_n.size\n sum += string_n[i].to_i\n i += 1\n end\n return super_digit(sum)\nend",
"def get_first_digit n \n n / 10**length(n) \nend",
"def super_digit(n)\n new_num = 0\n numbers = n.to_s.split(\"\")\n if numbers.length <= 1\n return n\n end\n numbers.each do |i|\n new_num += i.to_i\n end\n return super_digit(new_num)\nend",
"def refined_super_digit(n, k)\n return n if k == 1 && n/10 == 0\n sum = 0\n sum += super_digit(n) * k\n return super_digit(sum)\nend",
"def digital_root(n)\r\n while n > 9\r\n n = n.digits.inject(:+)\r\n end\r\n n\r\nend",
"def smallest_n_digit_number(n)\n 10 ** (n-1)\nend",
"def sum_func(n)\n if n / 10 == 0\n return n\n else\n return n % 10 + sum_func(n/10)\n end\nend",
"def last_n_digits(num, n)\r\n # your code goes here\r\n num % 10**n\r\nend",
"def digits(number)\n digits = []\n\n while number != 0\n digits << number % 10\n number = number / 10\n end\n\n digits.reverse.join\nend",
"def sumdigit_r(num)\n if num < 10\n num\n else\n sumdigit_r(num/10) + num % 10\n end\nend",
"def super_digit(n)\n string_n = n.to_s\n return n if string_n.size == 1\n\n i = 1\n sum = string_n[0].to_i\n while i < string_n.size\n sum += string_n[i].to_i\n i += 1\n end\n return super_digit(sum)\n end",
"def refined_super_digit(n, k)\n num_array = n.to_s.chars.map(&:to_i)*k\n array_sum = num_array.sum \n if array_sum <9 \n return array_sum\n else \n return super_digit(array_sum)\n end \nend",
"def sum_of_digits(n)\n digits = n.to_s.split(//).map(&:to_i)\n digits.inject(0) { |sum, digit| sum + digit}\nend",
"def refined_super_digit(n, k)\n refined = \"\"\n\n k.times do \n refined += n.to_s \n end \n refined = refined.to_i\n\n super_digit(refined)\n\nend",
"def digit_factorials\r\n\tanswer = 0\r\n\t# Find upper bound for calculations. Since 9!*7 has seven digits and 9!*8 has seven digits, we use 9!*7\r\n\tlimit = (1..9).inject(:*)*7\r\n\t(10..limit).each do |x|\r\n\t\tputs x\r\n\t\tsum = 0\r\n\t\tnumber = x\r\n\t\t# Cycle through all digits of the number\r\n\t\twhile number > 0\r\n\t\t\t# Add factorial of digit to sum unless digit is 0, then add 1 because 0! is 1\r\n\t\t\tnumber%10 == 0 ? sum += 1 : sum += (1..number%10).inject(:*) \r\n\t\t\tnumber /= 10\r\n\t\tend\r\n\t\t# Add sum to answer if sum is equal to number\r\n\t\tanswer += sum if sum == x\r\n\tend\r\n\tputs answer\r\nend",
"def findDigits(n)\n x = n.to_s.split(//)\n x = x.each_index {|i| x[i] = x[i].to_i}\n p x\n c = x.count { |j| n % j == 0 if j != 0}\n p c\nend",
"def digital_root(n)\n # Return number if it can't be reduced further\n return n if n.size == 1\n # Evaluate the sum of digits use recursion on the sum\n digital_root(n.to_s.chars.inject {|sum, n| sum.to_i + n.to_i })\nend",
"def refined_super_digit(n, k)\n new_num = 0\n times = k\n numbers = n.to_s.split(\"\")\n if numbers.length <= 1\n return n\n end\n numbers.each do |i|\n new_num += i.to_i\n end\n new_n = times * new_num\n return super_digit(new_n) \nend",
"def product_digits(num)\n return 2 if num.to_s.size == 1\n count = 1\n while num.to_s.size > 1\n divisor = 9\n while num % divisor != 0\n divisor -= 1\n end\n num /= divisor\n count += 1\n end\n count\nend",
"def sum(n)\n n.digits.sum\nend",
"def refined_super_digit(n, k)\n sum = 0\n until n == 0\n sum += n % 10\n n /= 10\n end\n\n n = sum * k\n return super_digit(n)\nend",
"def rec(target,digit,result)\n\n \n return result+(target - 1).to_s if target <= 1\n \n ## Fir stly, search for n that is (n + 1)! > million\n n = 1\n prod = 1\n\n while prod < target && n <= digit\n prod = prod * n\n n += 1\n end\n \n n -= 1\n prod /= n\n n -= 1\n\n digit = n\n \n ## secondly, search for m that is (m + 1) x n! > million\n m = 2\n tmp = prod\n while tmp < target\n tmp = prod * m\n m += 1\n end\n \n m -= 2\n \n \n ## The one millionth number is between m*(n!) and (m+1) * (n!)\n \n base = 1\n while n >= 1\n base *= n\n n -= 1\n end\n \n base = m * base\n left = target - base\n\n \n \n return rec(left,digit,result + m.to_s)\nend",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def sum_of_digits(int)\n int.digits.sum\nend",
"def super_digit(n)\n s = n.to_s \n if s.length <= 1 # basecase here\n return n\n end\n \n sum = 0 \n s.split(\"\").each do |d|\n sum += d.to_i \n end\n \n return super_digit(sum)\nend",
"def digital_root(n)\n arr = n.to_s.split('')\n if arr.length != 1\n tot = arr.inject(0){|sum,x| sum.to_i + x.to_i }\n while (tot >= 10)\n tot = tot.to_s.split('').inject(0){|sum,x| sum.to_i + x.to_i }\n end\n else \n return arr[0].to_i\n end\n return tot\n end",
"def delete_digit_x(n)\n n.digits.reverse.combination(n.digits.size-1).max.join.to_i\nend",
"def findDigits(n)\n n.to_s.each_char.reject {|x| x.to_i.zero?}.select {|x| n % x.to_i == 0 }.count\nend",
"def refined_super_digit(n, k)\n\n n = n.digits.sum * k\n super_digit(n)\n\nend",
"def refined_super_digit(n, k)\n result = super_digit(n) * k\n while result > 9\n result = super_digit(result)\n end\n return result\nend",
"def refined_super_digit(n, k)\n return n * k if n * k < 10\n count = add_digits(n) * k\n return super_digit(count)\nend",
"def digit_match(n, m)\n # raise NotImplementedError, \"Method not implemented\"\n count = 0\n if n < 10 && m < 10\n count += 1 if n == m\n elsif n < 10 \n count += 1 if n == m % 10\n elsif m < 10 \n count += 1 if m == n % 10\n elsif n >= 10 && m >= 10\n count += 1 if n % 10 == m % 10\n return digit_match(n/10, m/10) + count\n end\n count\nend",
"def digital_root(n)\n num = 0\n n.to_s.split(\"\").each {|x| num += x.to_i}\n num.to_i > 9 ? digital_root(num.to_i) : num.to_i\nend",
"def ith_digit(int, ith)\n\tif ith == 0\n\t\treturn int.modulo(10)\n\telse \n\t\treturn ith_digit(int.div(10), ith -1)\n\tend\nend",
"def refined_super_digit(n, k)\n \nend",
"def s(n)\n ((9*n-1)*(10**n)+1)/9\nend",
"def refined_super_digit(n, k)\n \nend",
"def refined_super_digit(n, k)\n \nend",
"def digits(num)\n cs = num.to_s.chars\n [].tap do |o|\n while cs.size > 0\n c = cs.shift\n o << (c + Array.new(cs.length) { |_i| 0 }.join).to_i\n end\n end\nend",
"def digital_root(n)\n return n if n < 10\n \n n_arr = n.to_s.chars\n num = n_arr.first.to_i\n new_num = n_arr[1..-1].join.to_i\n digital_root(num + digital_root(new_num))\nend",
"def comb n\n #if integer has more than 1 digit \n if n >= 10\n #if the first digit is less than the second digit of the integer\n if get_first_digit(n) < get_first_digit(drop1(n))\n #switch first and second digits, continue combing\n (round_1_sig_fig(drop1(n)) * 10) + comb( (round_1_sig_fig(n) / 10) + drop1(drop1(n)) )\n else\n #digits are in correct positions, contiune combing\n round_1_sig_fig(n) + comb(drop1(n))\n end\n else\n #last digit reached, comb finshed.\n n\n end\n\nend",
"def square_digits (n)\n print n.digits.map{|n|n*n}.join\nend",
"def sum_of_factorial_digits(factorial)\r\n\tthe_factorial = (1..factorial).inject(1){ |milti, i| milti * i }\r\n\r\n\treturn the_factorial.to_s.split('').inject(0){ |sum, i| sum + i.to_i }\r\nend",
"def refined_super_digit(n, k)\n sum = 0\n\n k.times do\n sum += super_digit(n)\n end\n\n return super_digit(sum)\nend",
"def solve( n = 1_000 )\n # Divide 1 by every number up to n, recording the length of repeating\n # digits that repeat.\n lens = (2...n).map do |i|\n d = {}\n r = 1\n\n # Do long division, stopping only if the decimal terminates or we see\n # a remainder we've seen before (indicating the beginning of a cycle).\n while true\n r = 10 * (r % i)\n break if 0 == r || d[r]\n\n # No cycle, but it didn't terminate. Add the remainder and calculate\n # a new one.\n d[r] = true\n r = r % i\n end\n\n d.length\n end\n\n # Return the index of the largest length value, offset to account for the\n # fact that we didn't divide by 0 or 1.\n 2 + lens.each_with_index.max[1]\n end",
"def sum_digits(n)\n remaining = n\n sum = 0\n while remaining > 0\n sum += remaining % 10\n remaining = remaining / 10\n end\n sum\nend",
"def digits_sum(n)\n n.to_s.split('').inject(0){|a,b|a+=b.to_i}\nend",
"def sum_digits(num)\n\nend",
"def solution(digits)\n digits.chars.each_cons(5).max_by(&:itself).join.to_i\nend",
"def digit_sum (number)\n sum = 0\n base = 10\n while number > 0 do\n sum += number % base\n number /= base\n end\n return sum\nend"
] |
[
"0.76064175",
"0.7572277",
"0.756658",
"0.75640917",
"0.7548796",
"0.7534563",
"0.7510628",
"0.7418562",
"0.738462",
"0.7366499",
"0.7363857",
"0.73187095",
"0.73167896",
"0.7298477",
"0.7289312",
"0.7285796",
"0.7285796",
"0.7265134",
"0.7264091",
"0.7257486",
"0.72562885",
"0.72462296",
"0.72401255",
"0.7237465",
"0.72245425",
"0.71941054",
"0.71889496",
"0.71778464",
"0.7173128",
"0.71641463",
"0.716103",
"0.7157107",
"0.7134067",
"0.71174026",
"0.71061003",
"0.7104814",
"0.7047239",
"0.7041944",
"0.7036882",
"0.6963793",
"0.6960903",
"0.6957482",
"0.694229",
"0.6923106",
"0.6897666",
"0.6891517",
"0.68788385",
"0.68722206",
"0.68578947",
"0.68423647",
"0.6842256",
"0.6830618",
"0.6802256",
"0.6798787",
"0.6789753",
"0.6789253",
"0.67820746",
"0.6770965",
"0.6769444",
"0.6738698",
"0.6734348",
"0.673426",
"0.67236936",
"0.6711777",
"0.6711605",
"0.6709938",
"0.6697042",
"0.6684567",
"0.66807866",
"0.66793334",
"0.6660441",
"0.6634063",
"0.6634063",
"0.662812",
"0.66206867",
"0.6620338",
"0.66181076",
"0.6613563",
"0.6611529",
"0.6610369",
"0.6604498",
"0.65769833",
"0.65661407",
"0.6566028",
"0.6553223",
"0.6552502",
"0.6550473",
"0.6550473",
"0.6532532",
"0.65182745",
"0.6512409",
"0.64915717",
"0.6480916",
"0.64807016",
"0.6479007",
"0.6475806",
"0.64731216",
"0.6454615",
"0.6451356",
"0.64461297"
] |
0.67671233
|
59
|
Time Complexity O(log10(n) + log10(k)): n is input n, k is the input k Space Complexity O(log10(n) + log10(k)): call stack for recursion
|
def refined_super_digit(n, k)
n = super_digit(n) * k
return super_digit(n)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nck_recursive(n, k)\n if k == 0 || k == n\n return 1\n else\n return nck_recursive(n-1, k) + nck_recursive(n-1, k-1)\n end\nend",
"def refined_super_digit(n, k)\n return n if n < 10\n super_digit(n.digits.sum * k) # k magic hint from https://www.hackerrank.com/challenges/super-digit/forum\nend",
"def refined_super_digit(n, k)\n sum = 0\n\n k.times do\n sum += super_digit(n)\n end\n\n return super_digit(sum)\nend",
"def refined_super_digit(n, k)\n return n if k == 1 && n/10 == 0\n sum = 0\n sum += super_digit(n) * k\n return super_digit(sum)\nend",
"def refined_super_digit(n, k)\n \nend",
"def refined_super_digit(n, k)\n \nend",
"def refined_super_digit(n, k)\n \nend",
"def nck_factorial(n, k)\n factorial(n) / (factorial(k) * factorial(n - k))\nend",
"def refined_super_digit(n, k)\n return n.abs if n.abs < 10 && k == 1\n return 0 if k == 0\n\n sum = recursive_digit_helper(n)\n sum *= k\n\n return refined_super_digit(sum, 1)\nend",
"def refined_super_digit(n, k)\n\n n = n.digits.sum * k\n super_digit(n)\n\nend",
"def refined_super_digit(n, k)\n return n if n < 10 && k == 1\n sum = super_digit_helper(n, 0) * k\n return super_digit(sum)\nend",
"def refined_super_digit(n, k)\n sum = 0\n\n k.times do\n sum += super_digit(n)\n end\n\n return super_digit(n = sum)\nend",
"def refined_super_digit(n, k)\n super_digit(n*k)\nend",
"def choose_team(n,k)\n return n if k == 1\n return 0 if n == 0\n choose_team(n-1,k-1) + choose_team(n-1,k)\nend",
"def refined_super_digit(n, k)\n return n * k if n * k < 10\n count = add_digits(n) * k\n return super_digit(count)\nend",
"def kaprekar n\n k = max_permutation(n) - min_permutation(n)\n if k == n then k else kaprekar k end\nend",
"def k(n); 5 * n * n; end",
"def sum_mults(n, k)\n n = (n - 1) / k\n return k * n * (n + 1) / 2\nend",
"def permutations(n,k)\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"def permutations(n,k)\n binding.pry\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"def refined_super_digit(n, k)\n num_array = n.to_s.chars.map(&:to_i)*k\n array_sum = num_array.sum \n if array_sum <9 \n return array_sum\n else \n return super_digit(array_sum)\n end \nend",
"def primes(n, k = 1, acc = [])\n if n <= k then acc\n else primes(n - 1, k, if prime?(n) then acc.push(n) else acc end)\n end\nend",
"def combinations(n, k)\n return 1 if (k == 0) || (k == n)\n\n (k + 1..n).reduce(:*) / (1..n - k).reduce(:*)\nend",
"def choose(n, k)\n numer = 1\n denom = 1\n n.downto(k + 1) do |i|\n numer *= i\n end\n (n - k).downto(1) do |i|\n denom *= i\n end\n numer/denom\nend",
"def refined_super_digit(n, k)\n result = super_digit(n) * k\n while result > 9\n result = super_digit(result)\n end\n return result\nend",
"def refined_super_digit(n, k)\n raise ArgumentError if n < 0\n return n if n < 10\n refined_super_digit(k * super_digit(n), 1)\nend",
"def refined_super_digit(n, k)\n return super_digit(n) if k == 1\n\n k_n = (n.to_s * k).to_i\n \n return super_digit(k_n.digits.sum)\nend",
"def refined_super_digit(n, k)\n sum = 0\n until n == 0\n sum += n % 10\n n /= 10\n end\n\n n = sum * k\n return super_digit(n)\nend",
"def ln_rek(x,n)\r\n\r\nend",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend",
"def binomial(n,k)\n return 1 if n-k <= 0\n return 1 if k <= 0\n fact(n) / ( fact(k) * fact( n - k ) )\n end",
"def solve(n, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend",
"def refined_super_digit(n, k)\n number = (n.to_s * k).to_i\n super_digit(number)\nend",
"def refined_super_digit(n, k)\n super_digit_helper = super_digit(n)\n return super_digit(super_digit_helper * k)\nend",
"def combin(k)\n return self.factorial / (k.factorial * (n - k).factorial)\n end",
"def get_partial_permutations(n,k)\r\n result = 1\r\n while (k > 0)\r\n result *= n\r\n n -= 1\r\n k -= 1\r\n end\r\n return (result % 1000000)\r\nend",
"def refined_super_digit(n, k)\n new_num = 0\n times = k\n numbers = n.to_s.split(\"\")\n if numbers.length <= 1\n return n\n end\n numbers.each do |i|\n new_num += i.to_i\n end\n new_n = times * new_num\n return super_digit(new_n) \nend",
"def recurse(curr, k, nums, res, start)\n# add, recurse, undo\n # basically forcing a base case\n if k == 0\n res << curr[0..-1] \n return\n end\n # start elims duplicates (like [3, 2] [2, 3])\n i = start\n while i < nums.length\n curr << nums[i]\n recurse(curr, k - 1, nums, res, i + 1)\n curr.pop\n i+=1\n end\n \n end",
"def getKth(nums1, nums2, k)\n p \"nums1: #{nums1} nums2: #{nums2} k: #{k}\"\n\n return nums2[k] if nums1.size == 0\n return nums1[k] if nums2.size == 0\n\n mid1 = nums1.size / 2\n mid2 = nums2.size / 2\n\n if nums1[mid1] > nums2[mid2]\n return getKth(nums2, nums1, k)\n end\n\n if mid1 + mid2 + 1 > k\n return getKth(nums1, nums2[0...mid2], k)\n else\n return getKth(nums1[mid1+1..-1], nums2, k - mid1 - 1)\n end\nend",
"def kaprekar?(k)\n=begin\n sqr = k**2\n digits = k.to_s.length\n right_n_digits = sqr.to_s[(0-digits)..-1].to_i\n left_digits = sqr.to_s[0..(1-digits)].to_i\n left_digits + right_n_digits == k\n=end\n n = Math.log10(k).to_i + 1\n value = k**2 \n k == value % (10**n) + value / (10**n) \nend",
"def number_combinations(n, k)\n\tnumberOfCombinations = (factorial(n))/(factorial(k) * factorial(n - k))\n\treturn numberOfCombinations\nend",
"def superDigit(n, k)\n target = n.split('').map(&:to_i).sum * k\n\n until target < 10\n target = target.digits.sum\n end\n\n target\nend",
"def nodes_at_k_distance(node, k)\n h = height(node)\n (1..h).each do |n|\n next if (n - 1) != k\n get_nodes_at_k_distance(node, n)\n end\nend",
"def refined_super_digit(n, k)\n num = super_digit(n)\n \n return super_digit(k*num)\nend",
"def kth_grammar(n, k, base = 0)\n return base if k == 1\n half_length = 2 ** (n - 2)\n if k > half_length\n kth_grammar(n - 1, k - half_length, base.zero? ? 1 : 0)\n else\n kth_grammar(n - 1, k, base)\n end\nend",
"def refined_super_digit(n, k)\n string_n = n.to_s\n return n if string_n.size == 1 && k == 1\n\n repeat_n = string_n * k\n return super_digit(repeat_n)\nend",
"def find_pairs(nums, k)\n return 0 if k < 0\n hash = {}\n count = 0\n nums.each do |num|\n if hash[num]\n if k == 0 && hash[num] == 1\n count += 1\n end\n hash[num] += 1\n else\n if hash[num - k]\n count += 1\n end\n if hash[num + k]\n count += 1\n end\n hash[num] = 1\n end\n end\n count\nend",
"def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end",
"def refined_super_digit(n, k)\n n = (n.to_s * k).to_i\n super_digit(n)\nend",
"def findKth(nums1,nums2,k)\nend",
"def element(n,k,row)\n return 1 if k == 0 or k==n\n previous_element = row[k-1] #we can\n return previous_element * (n+1-k)/k\nend",
"def refined_super_digit(n, k)\n string_n = n.to_s\n return n if string_n.size == 1 && k == 1\n\n repeat_n = string_n * k\n return super_digit(repeat_n)\nend",
"def count_num_times(arr, k)\n # base case:\n return 0 if arr.empty?\n\n count_num_times(arr, k - arr.first) +\n count_num_times(arr.shift, k)\nend",
"def calc(n, k)\n fac(n) / (fac(k) * fac(n - k)) * ((1.0/6.0)**k * (5.0/6.0)**(n-k)) * 100\n end",
"def choose(n, k)\n return [[]] if n.nil? || n.empty? && k == 0\n return [] if n.nil? || n.empty? && k > 0\n return [[]] if n.size > 0 && k == 0\n c2 = n.clone\n c2.pop\n new_element = n.clone.pop\n choose(c2, k) + append_all(choose(c2, k-1), new_element)\n end",
"def boustrophedon_at(k,n)\n raise ArgumentError.new \"k must be < size\" unless k < size\n raise ArgumentError.new \"n must be < size\" unless n < size\n return 0 if n < 0 || k < n\n @b_cache ||= []\n @b_cache[k] ||= []\n\n @b_cache[k][n] ||= if k==0\n self[k]\n else\n boustrophedon_at(k,n-1) + boustrophedon_at(k-1,k-n)\n end\n end",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def refined_super_digit(n, k)\n # return super_digit(n * k)\n num = (n.to_s * k).to_i\n return super_digit(num)\nend",
"def refined_super_digit(n, k)\n return super_digit(k * digit_helper(n))\nend",
"def fibs(j,k)\n\t@goal = 4000000\n\ti = j\n\tj = k\n\tk = i + j\n unless k > @goal\n \t@fib_array << k\n fibs(j,k)\n end\nend",
"def kthSmallestInBST(t, k)\n @r = []\n travel(t)\n @r.sort.at(k - 1)\nend",
"def refined_super_digit(n, k)\n new_n = (n.to_s * k).to_i\n return super_digit(new_n) \nend",
"def recursion(n)\n if n % 2 ==0\n n\n else\n recursion(n + 1)\nend\nend",
"def top_k_frequent_elements_version2(list, k)\n # edge cases\n return list if list.empty? || list.size == 1\n\n occurances_counter = {}\n list.each do |digit|\n if occurances_counter[digit]\n occurances_counter[digit] += 1\n else\n occurances_counter[digit] = 1\n end\n end\n # occurances_counter looks like this for input [1,1,2,2,2]: {1=>2, 2=>3}\n # create an array out of this hash, sort it by values and return keys of k elements\n sorted_occurances = occurances_counter.to_a.sort_by{ |pair| pair[1]}\n number_pairs = sorted_occurances.slice(sorted_occurances.length - k, k)\n result = number_pairs.map do |pair|\n pair[0]\n end\n return result\nend",
"def top_k_frequent_elements(list, k)\n h = {}\n solution = []\n return solution if list.nil? || list.empty? || !list.is_a?(Array)\n list.each do |element|\n if h.include?(element)\n h[element] += 1\n else\n h[element] = 1\n end\n end\n k.times do\n top = nil\n h.each do |element,value| \n if value && (top.nil? || value > top)\n top = element\n end\n end \n if top \n h[top] = nil\n solution << top\n end\n end \n return solution\nend",
"def top_k_frequent_elements(list, k)\n return nil if !list\n # intialze an empty hash\n ## iterate throught the list\n #chechk if the key is in the hash,\n # if key is in the hash ++ value\n # otherwise add key and value as 1 since it's first occurance\n # now the key(uniqe) and value(how many time the int_value) happend is in the hash,\n # my_hash.sort_by { |_, value| value }.each { |key, value| puts key } (iterate throught the hash, (hash.each {|key, value|}) )\n # before pushing the key into the initalized array, check to see if the length is less than k\n # if\n hash = Hash.new\n list.each do |int_value|\n if hash.key?(int_value)\n hash[key] = +1\n else\n hash[key] = 1\n end\n end\n kth_frequent_elements = []\n counter = 0 \n pervisou_value = 0\n hash.sort_by { |k, v| -v }.each do |key, value|\n if counter < k\n kth_frequent_elements << key\n if pervisou_value != value\n pervisou_value = value\n counter += 1\n end\n # end\n # if kth_frequent_elements.length < k\n # kth_frequent_elements << key\n else\n break\n end\n end\n return kth_frequent_elements\nend",
"def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"def binom(n, k)\n return 1 if k.zero? || (n - k).zero?\n return n if k == 1 || n - k == 1\n\n factorial(n) / (factorial(k) * factorial(n - k))\n end",
"def k_concatenation_max_sum(arr, k)\r\n return arr.sum * k if arr.all?(&:positive?)\r\n return 0 if arr.all?(&:negative?)\r\n total = arr.inject(0) {|sum, x| sum + x} * k\r\n try = total\r\n arr.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n try = total\r\n arr.reverse.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n total\r\nend",
"def recursive_terms(n)\n all_ns << n\n # if we get 1111\n # we have 1111 and should then get 211 and then 31 and then 4\n # then continue from 1111 to 121 then 13\n # then continue from 1111 to 112\n # to find these terms, find the \n next_ns = convert_n_to_next_terms(n)\n next_ns.each do |next_n|\n all_ns << recursive_terms(next_n)\n end\n return all_ns.flatten.uniq\nend",
"def binomial_coefficient(n, k)\n return 1 if n == k || k == 0\n return n if k == 1\n return -1 if n < k\n\n # calculate factorials\n fact_n = (2..n).inject(1) { |carry, i| carry * i }\n fact_k = (2..k).inject(1) { |carry, i| carry * i }\n fact_n_sub_k = (2..(n - k)).inject(1) { |carry, i| carry * i }\n\n fact_n / (fact_k * fact_n_sub_k)\n end",
"def calc_k(n, g)\n H(n, n, g)\n end",
"def smallest_k(ranges, k)\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 kth_to_last_space_optimized(head, k)\n count = 1\n current_node = head\n while current_node\n count += 1\n current_node = current_node.next\n end\n current_node = head\n target = count - k\n count = 1\n while current_node\n return current_node.value if count == target\n count += 1\n current_node = current_node.next\n end\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 count_recursive(n, m)\n if n < 0 or m < 0\n return 0\n end\n if n == 0\n return 1 # We found one solution!\n end\n return count_recursive(n, m-1) + count_recursive(n - S[m], m)\n\nend",
"def cout(n)\n\tw=[0,1,2,3,4,5,6,7,8,9]\n\tx=[]\n\tk=1\n\twhile x!=w do \n\t\tm=n*k\n\t\t\twhile m>0 do\n\t\t\t\tt=m%10\n\t\t\t\tx=x.push(t)\n\t\t\t\tx.sort!\n\t\t\t\tx.uniq!\n\t\t\t\tm=m/10\t\n\t\t\tend\n\t\tk=k+1\n\tend\nreturn (k-1)*n\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 square_root(k)\n root = k / 2\n square = root * root\n\n while square >= k\n root /= 2\n square = root * root\n end\n\n while square < k\n temp_root = root + 1\n\n if (temp_root * temp_root) > k\n break\n end\n\n root = temp_root\n end\n\n root\nend",
"def rec_sum(n)\n if n == 0\n return 0\n else\n return n + rec_sum(n-1)\n end\nend",
"def check_subarray_sum(nums, k)\n map = {}\n map[0] = -1\n running_sum = 0\n nums.each_with_index do |num, index|\n running_sum += nums[index]\n \n if k != 0\n # why ?\n \n running_sum = running_sum % k\n \n end\n print map, '--'\n# print running_sum, '--'\n prev = map[running_sum]\n if prev != nil\n return true if index - prev > 1\n else\n map[running_sum] = index\n end\n end\n return false\nend",
"def better_inject_recursion(initial = nil,n=nil,&block)\n\t\tresult = 0\n\t\tn ||= 0\n\t\treturn result if n == self.length\n\t\tcurrent_element = initial.nil? ? self[n] : initial\n\t\tn+=1\n\t\tresult = yield(better_inject_recursion(nil,n,&block),current_element)\n\t\tend",
"def fib(k)\n a= 1\n n = k\n if(k >= 2)\n k.times do\n\ta = (n-1) + (n-2)\n end\nend\n return a\nend",
"def factorial_recursive n\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"def fibs_rec(i, j, cnt, n)\n if(cnt > n)\n return i\n else\n k = i + j\n print i, \", \"\n i = j\n j = k\n fibs_rec(i, j, cnt += 1, n)\n end\nend",
"def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend",
"def factorial_recursive(n)\n\tif (n==0)\n\t\treturn 1\n\telse\n\t\t\treturn n*factorial_recursive(n-1)\n\tend\nend",
"def rek(n)\n if n == 1\n return 1/3.to_f\n end\n if n == 0\n return 1.to_f\n end\n return 13.0*rek(n-1)/3.0 - 4.0*rek(n-2)/3.0\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 rec_factorial(n)\n if n==0\n return 1\n end\n return rec_factorial(n-1)*n\nend",
"def top_k_frequent_elements(list, k)\n if list.length == 0 \n return []\n end \n nums = {}\n list.each do |num|\n if !nums[num]\n nums[num] = 1\n else\n nums[num] += 1\n end\n end \n\n sorted = nums.sort_by {|k, v| -v}\n top_k = []\n k.times do |k|\n top_k << sorted[k][0]\n end \n return top_k\nend",
"def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend",
"def factorial_recursive(n)\n\t\tif n == 1\n\t\t\treturn 1\n\t\telse\n\t\t\tn * factorial_recursive(n-1)\n\t\tend\n\tend",
"def kaprekar_step(n)\n\n # TODO: Solve it!\n\n end",
"def factorial_recursive(n)\n if n == 1\n return 1\n end\n return n * factorial_recursive(n-1)\nend"
] |
[
"0.757688",
"0.6850021",
"0.6794845",
"0.67890966",
"0.67831254",
"0.67831254",
"0.6782363",
"0.67401606",
"0.67246234",
"0.6587007",
"0.6579726",
"0.65709376",
"0.65500194",
"0.64705616",
"0.6400164",
"0.63972986",
"0.6397034",
"0.6392878",
"0.6390915",
"0.63798076",
"0.637722",
"0.63700354",
"0.63669205",
"0.6361725",
"0.6361604",
"0.6352931",
"0.6317907",
"0.6290915",
"0.6289286",
"0.6288543",
"0.62881666",
"0.6253326",
"0.62513983",
"0.62376237",
"0.6236015",
"0.6207363",
"0.61842084",
"0.6177842",
"0.61772335",
"0.6176519",
"0.6175231",
"0.614986",
"0.6137469",
"0.6135525",
"0.61337775",
"0.6132922",
"0.6129414",
"0.61272633",
"0.6127168",
"0.6112012",
"0.6087635",
"0.6085753",
"0.60829765",
"0.6067874",
"0.6060402",
"0.60381764",
"0.60381293",
"0.60381293",
"0.60381293",
"0.60381293",
"0.6037873",
"0.60351574",
"0.60324645",
"0.601911",
"0.6013805",
"0.60123736",
"0.60052955",
"0.6000954",
"0.59873074",
"0.5985209",
"0.598143",
"0.59813935",
"0.5974853",
"0.5964641",
"0.59433496",
"0.5930279",
"0.59231275",
"0.59185624",
"0.5915591",
"0.59147626",
"0.5913763",
"0.59119076",
"0.5906206",
"0.5902216",
"0.5899062",
"0.58817124",
"0.5877525",
"0.58718663",
"0.5871269",
"0.5870354",
"0.5866277",
"0.58649135",
"0.5863839",
"0.5862553",
"0.58623683",
"0.58603513",
"0.5857553",
"0.58564055",
"0.58393013",
"0.5837553"
] |
0.61071724
|
50
|
Only allow a trusted parameter "white list" through.
|
def update_version
if (VersionControl.any?)
obj = VersionControl.all.first
else
obj = VersionControl.create(version: 3.0)
end
obj.version += 0.1
obj.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n 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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_raport
@raport = Raport.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 raport_params
params.require(:raport).permit(:meeting_id, :name, :module, :this_week_work, :need_help, :next_week_work, :share_tech)
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
|
method for initialize instance of customer
|
def initialize(id, email, address)
@id = id # this is an integer
@email = email # this is a string
@address = address # this is a hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(customer_id:)\n @customer_id = customer_id\n end",
"def initialize(custId, custName,custAddr)\r\n\t\t\t@cust_id=custId\r\n\t\t\t@cust_name=custName\r\n\t\t\t@cust_addr=custAddr\r\n\t\tend",
"def initialize(customer, bartender)\n @customer = customer\n @bartender = bartender\nend",
"def initialize(name, id, addr)\n @cust_name = name\n @cust_id = id\n @cust_addr = addr\n end",
"def initialize(id, name, addr)\n @cust_id = id\n @cust_name = name\n @cust_addr = addr\n end",
"def initialize(name, addr)\n @cust_id = @@no_of_customers\n @cust_name = name\n @cust_addr = addr\n @@no_of_customers += 1\n end",
"def initialize(id, name, addr)\n # Instance variables start with @, available across methods for that instance or object\n @cust_id = id\n @cust_name = name\n @cust_addr = addr\n\n @@no_of_customers += 1\n end",
"def customer\n @customer ||= Customer.new(value_for('customer'))\n end",
"def initialize(options = {})\n requires!(options, :customer_id, :password)\n super\n end",
"def initialize(**new_customer_hash)\n\t\t@first_name = new_customer_hash[:info_first_name]\n\t\t@last_name = new_customer_hash[:info_last_name]\n\t\t@active = false \n\t\t@street_address = new_customer_hash[:info_street_address]\n\t\t@city = new_customer_hash[:info_city]\n\t\t@state = new_customer_hash[:info_state]\n\t\t@postal_code = new_customer_hash[:info_postal_code]\n\t\t@phone = new_customer_hash[:info_phone_number]\n\t\t@payment = nil\n\tend",
"def initialize(id, name, addr)\n\n # id, name, addr are local variables\n # cust_id, cust_name, cust_addr are instance variables\n @cust_id = id\n @cust_name = name\n @cust_addr = addr\n end",
"def initialize(name, email = '', phone = '')\n @name = name\n @email = email\n @phone = phone\n\n # Customer has many accounts\n @accounts = []\n end",
"def new\n # The variable @customer receive the object customer.\n @customer = Customer.new\n end",
"def initialize(customer_id=nil)\n @customer_id = customer_id\n @client = OpenpayApi.new(ENV[\"OPEN_PAY_MERCHANT_ID\"], ENV[\"OPEN_PAY_PRIVATE_KEY\"])\n # resource_name is defined in child classes.\n @resource = @client.create(resource_name)\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n @address = @customer.addresses.first || Address.new\n @address_business = @customer.addresses.second || Address.new\n @phones = @customer.phones\n \n @phoneRes = @phones[0] || Phone.new\n @phoneCel = @phones[1] || Phone.new\n @phoneRec = @phones[2] || Phone.new\n @phoneRecCel = @phones[3] || Phone.new\n @phoneCom = @phones[4] || Phone.new\n \n end",
"def initialize\n\t\t\t@addressCollection = Array.new\n\t\t\t@buyerKey = '00000000-0000-0000-0000-000000000000'\n\t\t\t@personTypeEnum = Buyer.PersonTypeEnum[:Person]\n\t\t\t@taxDocumentTypeEnum = Buyer.DocumentTypeEnum[:CPF]\n\t\tend",
"def initialize(customer, restaurant)\n @customer = customer\n @restaurant = restaurant\n ALL << self\n end",
"def initialize(owner, expire_date, type)#, dob, phone, vip)\n\t\t@number = rand(10000000)\n\t\t@expire_date = Date.parse(expire_date)\n\t\t@cvv = rand(1000)\n\t\t@name = owner.name\n\t\t# Customer.new(name, dob, phone, vip)\n\tend",
"def initialize_customer\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n# additional intialization here ...\n else\n self.head_of_household_name = self.head_of_household.display_name if self.head_of_household\n end\n\n end",
"def set_customer_customer\n @customer_customer = Customer::Customer.find(params[:id])\n end",
"def load_customer_info(customer)\n self.customer_id = customer.id\n self.cardholder_email = customer.email\n\n customer_card = get_default_card(customer)\n\n self.cardholder_name = customer_card.name\n self.card_type = customer_card.type\n self.last4 = customer_card.last4\n self.expiration = customer_card.exp_month.to_s +\n '/' + customer_card.exp_year.to_s\n end",
"def set_customer\n @customer = Tang.customer_class.find(params[:id])\n end",
"def initialize(holder, id)\n super\n # calls the super initialize method of customer account\n @type = :Business\n # sets type to business, this will be used by the accounts controller\n @daily_limit = LIMIT\n # sets the daily limit to LIMIT constant. this will be used to restrict withdrawals\n end",
"def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end",
"def customers\n @customers ||= new_resource(self, :customer, :customers)\n end",
"def new\n @customer = Customer.new\n end",
"def new\n @customer = Customer.new\n end",
"def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end",
"def new\n @customer = customers.new\n end",
"def initialize (product_title = nil, product_price = nil, customer_id = nil)\n @product_title = product_title\n @product_price = product_price\n @customer_id = customer_id\n end",
"def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end",
"def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end",
"def initialize(id, email, address)\n @id = id\n @email = email\n @address = address\n # ensures that only 35 instances are stored in class variable\n if @id < 36\n @@customers << self\n end\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def customer\n @customer ||= create_customer\n rescue StandardError\n nil\n end",
"def initialize id, products, customer_id, status = :pending\n super(id, products)\n @customer_id = customer_id\n @customer = Customer.find(@customer_id)\n if status.class == Symbol\n @status = status\n elsif status.class == String\n @status = status.to_sym\n end\n end",
"def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:customer_id])\n end",
"def set_customer\n @customer = Customer.find(params[:customer_id])\n end",
"def initialize(customer_obj, product_obj)\n\t\t@customer = customer_obj\n\t\t@product = product_obj\n\t\t@id = @@id\n\t\t@@id += 1\n\t\t@product.stock -= 1\n\t\t@date = Time.now\n\t\tadd_transaction\n\tend",
"def set_my_customer\n @my_customer = MyCustomer.find(params[:id])\n end",
"def initialize # clinic\n # @company = clinic.company\n\n response = create\n end",
"def initialize\n @params_class = Spree::Adyen::HPP::Params\n @invoice_class = Spree::Adyen::Invoice\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n end"
] |
[
"0.80713916",
"0.79566497",
"0.77988416",
"0.7751268",
"0.7642828",
"0.7597428",
"0.75824094",
"0.7410488",
"0.7387024",
"0.7376654",
"0.73161626",
"0.723311",
"0.71722984",
"0.71566457",
"0.7081231",
"0.7034602",
"0.7030591",
"0.6978455",
"0.6963194",
"0.68392575",
"0.68372613",
"0.6834891",
"0.6815374",
"0.67908686",
"0.6728867",
"0.6717427",
"0.6717427",
"0.6696513",
"0.66626436",
"0.665863",
"0.6657555",
"0.6657555",
"0.6651266",
"0.665047",
"0.665047",
"0.665047",
"0.6624302",
"0.66044503",
"0.66020894",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65970933",
"0.65851456",
"0.65851456",
"0.6581673",
"0.657405",
"0.6568877",
"0.6513659",
"0.6510642",
"0.6510642",
"0.6510642"
] |
0.0
|
-1
|
Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK specified tag was found, result available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized Input HTTP Headers: HTTP Basic Authorization (as specified above) Input parameters tagId (required, string, `E12345678912345678`) ... a single RFID tag identifier nameLike (optional, string, `chip`) ... Comparison string for metadata properties Output parameters code (Number, `0`) ... Indicates the result code of this call (see `result codes`) tagId the requested `tagID` properties an array of JSON objects, each of which contains property ID, property name, property data type, and a flag indicating whether the property exists for the tag.
|
def get_tag_metadata_definition(tag_id,
name_like = nil)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/properties/definition/{tagId}'
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
'tagId' => tag_id
}
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
'nameLike' => name_like
}
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json'
}
# prepare and execute HttpRequest
_request = @http_client.get _query_url, headers: _headers
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return GetTagMetadataDefinitionResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end",
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end",
"def get_tag_with_http_info(tag_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagsApi.get_tag ...\"\n end\n # verify the required parameter 'tag_id' is set\n fail ArgumentError, \"Missing the required parameter 'tag_id' when calling TagsApi.get_tag\" if tag_id.nil?\n # resource path\n local_var_path = \"/tags/{tagId}\".sub('{format}','json').sub('{' + 'tagId' + '}', tag_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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 = ['basicAuth']\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 => 'TagEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsApi#get_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def remove_tags_with_http_info(identifier, tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.remove_tags ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.remove_tags\"\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling AlertApi.remove_tags\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/tags\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'user'] = opts[:'user'] if !opts[:'user'].nil?\n query_params[:'note'] = opts[:'note'] if !opts[:'note'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].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 = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#remove_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag\n params.require(:tag).permit(:example_id, :tag)\n end",
"def tag\n Tag.find(tag_id)\n end",
"def add_tags_with_http_info(identifier, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.add_tags ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.add_tags\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AlertApi.add_tags\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/tags\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_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 = @api_client.object_to_http_body(body)\n auth_names = ['GenieKey']\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 => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#add_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def show_tag_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagsApi.show_tag ...'\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 TagsApi.show_tag\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling TagsApi.show_tag, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/tags/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\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'])\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] || 'Tag' \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\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: TagsApi#show_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n if @tag.present?\n respond_with @tag, status: :ok, location: tags_path(@tag)\n else\n render json: {error: 'Could not find the resource. Check if you are using the right tag_id.'}, status: :not_found\n end\n end",
"def update\n update_and_respond(@tag, tag_params)\n end",
"def tag\n\t\t@tag = @identity = Identity.find(params[:id]).decorate\n\tend",
"def add_tag(tag)\n @api.post(\"#{@api.path}/List/#{@id}/Tag\", body: tag)\n end",
"def show\n @tag = Tag.find(params[:id])\n if !@tag.nil?\n render json: @tag, status: :ok\n else\n render json: @tag.errors, status: :not_found\n end\n end",
"def set_tag\n begin\n @tag = Tag.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @tag = Tag.find_by(tag_id: params[:id]) || raise(ActiveRecord::RecordNotFound.new)\n end\n end",
"def show\n tag = Tag.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n render :status => 200,\n :json => tag_as_hash(tag).merge({\n status: 200,\n # TODO csrf\n })\n end",
"def set_tag\n @tag = Tag.where(id: params[:tag]).first\n end",
"def destroy\n # If given metadata_id ==> detach tag\n if params[:metadata_id]\n tag = current_user.detach_tag params[:metadata_id], params[:id]\n # Otherwise ==> delete tag\n else\n tag = current_user.delete_tag params[:id]\n end\n _respond_tag_request tag \n end",
"def update\n if @tag.update(tag_params)\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def tag=(value)\n @tag = value\n self.status = TAG_STATUS.fetch(value)\n @tag\n end",
"def update\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.update(tag_params)\n format.json { render :show, status: :ok, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag\n\t\t\tbegin\n\n\t\t\t\t# Retrieve ID3 Tag if not yet read\n\t\t\t\t@tag = ID3Lib::Tag.new(@path) if @tag.nil?\n\n # Return result\n @tag\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e \n\t\t\t\tlog.error e\n\t\t\tend\n end",
"def remove_portfolio_item_tags_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioItemApi.remove_portfolio_item_tags ...'\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 PortfolioItemApi.remove_portfolio_item_tags\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioItemApi.remove_portfolio_item_tags, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioItemApi.remove_portfolio_item_tags\"\n end\n # resource path\n local_var_path = '/portfolio_items/{id}/untag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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(tag) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioItemApi#remove_portfolio_item_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def remove_tags_from_resource(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveTagsFromResource'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_tag_with_http_info(project_name, repository_name, reference, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ArtifactApi.create_tag ...'\n end\n # verify the required parameter 'project_name' is set\n if @api_client.config.client_side_validation && project_name.nil?\n fail ArgumentError, \"Missing the required parameter 'project_name' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'repository_name' is set\n if @api_client.config.client_side_validation && repository_name.nil?\n fail ArgumentError, \"Missing the required parameter 'repository_name' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'reference' is set\n if @api_client.config.client_side_validation && reference.nil?\n fail ArgumentError, \"Missing the required parameter 'reference' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling ArtifactApi.create_tag\"\n end\n if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"x_request_id\"]\" when calling ArtifactApi.create_tag, the character length must be great than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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 header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tag)\n auth_names = ['basic']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArtifactApi#create_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_tag\n # @stat = Stat.find(params[:id])\n if (params[:example_id])\n @tag = Tag.where(\"example_id=?\", params[:example_id]).first\n else\n @tag = Tag.find(params[:id])\n end\n end",
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', '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] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_tag_with_http_info(tag_id, tag_body_update, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagsApi.update_tag ...\"\n end\n # verify the required parameter 'tag_id' is set\n fail ArgumentError, \"Missing the required parameter 'tag_id' when calling TagsApi.update_tag\" if tag_id.nil?\n # verify the required parameter 'tag_body_update' is set\n fail ArgumentError, \"Missing the required parameter 'tag_body_update' when calling TagsApi.update_tag\" if tag_body_update.nil?\n # resource path\n local_var_path = \"/tags/{tagId}\".sub('{format}','json').sub('{' + 'tagId' + '}', tag_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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(tag_body_update)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'TagEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsApi#update_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_tag_with_http_info(id, api_tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#add_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_tag\" if id.nil?\n \n # verify the required parameter 'api_tag' is set\n fail \"Missing the required parameter 'api_tag' when calling add_tag\" if api_tag.nil?\n \n # resource path\n path = \"/Leads/{id}/Tags\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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', 'text/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 = @api_client.object_to_http_body(api_tag)\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 => 'APITag')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#add_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag\n end",
"def tag\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def tag(tag); end",
"def tag(tag); end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def get_v1_related_tags_with_http_info(tag_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_related_tags ...'\n end\n # verify the required parameter 'tag_list' is set\n if @api_client.config.client_side_validation && tag_list.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_list' when calling TagApi.get_v1_related_tags\"\n end\n # resource path\n local_var_path = '/v1/related-tags'\n\n # query parameters\n query_params = {}\n query_params[:'tag_list'] = tag_list\n query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?\n query_params[:'bucket'] = opts[:'bucket'] if !opts[:'bucket'].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 = ['api_key']\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 => 'RelatedTagResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_related_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_tags_to_resource(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddTagsToResource'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add_tag_with_http_info(id, api_tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#add_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_tag\" if id.nil?\n \n # verify the required parameter 'api_tag' is set\n fail \"Missing the required parameter 'api_tag' when calling add_tag\" if api_tag.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/Tags\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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', 'text/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 = @api_client.object_to_http_body(api_tag)\n \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 => 'InlineResponse201')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#add_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def remove_portfolio_tags_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.remove_portfolio_tags ...'\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 PortfolioApi.remove_portfolio_tags\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioApi.remove_portfolio_tags, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioApi.remove_portfolio_tags\"\n end\n # resource path\n local_var_path = '/portfolios/{id}/untag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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(tag) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioApi#remove_portfolio_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag\n try_opt(:tag)\n end",
"def tag\n raise NotImplementedError\n end",
"def tag\n raise NotImplementedError\n end",
"def create\n @tag = Tag.new tag_params\n @tag.admin = current_user\n if @tag.save\n render :show, status: 200\n elsif @tag.errors.messages[:value].include? 'has already been taken' # there's probably a better way to do this\n render json: { error: '409 conflict with existing record' }, status: 409\n else\n render json: { error: '422 unprocessable entity' }, status: 422\n end\n end",
"def create\n @api_tag = Api::Tag.new(params[:api_tag])\n\n respond_to do |format|\n if @api_tag.save\n format.html { redirect_to @api_tag, notice: 'Tag was successfully created.' }\n format.json { render json: @api_tag, status: :created, location: @api_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def tag\n begin\n t=GTag.find(params[:id])\n @query_info=t.tag\n\n # search in the descriptions\n @videos=VMetadata.search(t.tag, :page => params[:page], :per_page => @@per_page,\n :match_mode => :any, :rank_mode => :proximity_bm25)\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n# @videos=t.v_metadatas.paginate(:page => params[:page], :per_page => @@per_page)\n# @query_info=t.tag\n\n# respond_to do |format|\n# format.html { render 'query/show' }\n# end\n# rescue ActiveRecord::RecordNotFound\n# render(:file => \"#{Rails.root}/public/404.html\",\n# :status => \"404 Not Found\")\n end\n end",
"def tag_set(id, tags)\n wf_event_id?(id)\n tags = Array(tags)\n tags.each { |t| wf_string?(t) }\n api.post([id, 'tag'].uri_concat, tags, 'application/json')\n end",
"def add_tag_with_http_info(id, api_tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#add_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_tag\" if id.nil?\n \n # verify the required parameter 'api_tag' is set\n fail \"Missing the required parameter 'api_tag' when calling add_tag\" if api_tag.nil?\n \n # resource path\n path = \"/Projects/{id}/Tags\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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', 'text/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 = @api_client.object_to_http_body(api_tag)\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 => 'APITag')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#add_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @tag = Tag.new(tag_params)\n lastId = Tag.maximum('id')\n @tag.id = lastId === nil ? 1 : lastId + 1\n respond_to do |format|\n if @tag.save\n format.json { render :show, status: :created, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submitTag(tagID, tagScanDate)\n\n\ttsdISO = tagScanDate.iso8601\n\t$count += 1\n\tputs \"-----> Submitted tag tagID: \" + tagID + \" tagScanDate: \" + tagScanDate.strftime(\"%I:%M:%S%p %m/%d/%y\")\n\n\tif($postDestination != nil)\n\t\trequest = Net::HTTP::Post.new($uri.request_uri)\n\t\trequest['x-access-token'] = $token\n\n\t\t#request.to_hash['x-access-token'] # => Array\n\t\t#puts \"Headers: #{request.to_hash.inspect}\"\n\n\t\trequest.set_form_data({\"tagID\" => tagID, \"tagScanDate\" => tsdISO, \"tagPatient\" => $patientName})\n\t\n\t\tresponse = $http.request(request)\n\t\tmy_hash = JSON.parse(response.body)\n\t\treturn my_hash\n\telse return \"Posted to console\"\n\tend\n\n\t#pp my_hash\n\t\nend",
"def create\n # If given metadata_id ==> attach tag\n if params[:metadata_id]\n tag = current_user.attach_tag params[:metadata_id], params[:name]\n # Otherwise ==> create a new tag\n else\n tag = current_user.create_tag params[:name]\n end\n _respond_tag_request tag\n end",
"def add_portfolio_item_tag_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioItemApi.add_portfolio_item_tag ...'\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 PortfolioItemApi.add_portfolio_item_tag\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioItemApi.add_portfolio_item_tag, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioItemApi.add_portfolio_item_tag\"\n end\n # resource path\n local_var_path = '/portfolio_items/{id}/tag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\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'])\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(tag) \n\n # return_type\n return_type = opts[:return_type] || 'Array<Tag>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioItemApi#add_portfolio_item_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_tag\n @tag = Tag.find(params[:id])\n end",
"def add_tag(query, tag)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n is_valid_with_error(__method__, [:tag], tag)\n post('actions/tags', { 'query' => query, 'tags' => [tag] })\n end",
"def tag_params\n params.require(:tag).permit(:name, :meta_tag_id)\n end",
"def postEntityTag( entity_id, tag, language)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tag'] = tag\n params['language'] = language\n return doCurl(\"post\",\"/entity/tag\",params)\n end",
"def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def tag; end",
"def tag; end",
"def tag_params\n params.require(:tag).permit(:id, :name, :description)\n end",
"def resultByTag(tag, format)\n raise \"Not implemented\"\n end",
"def create\r\n @tag = Tag.new(tag_params)\r\n\r\n if @tag.save\r\n render json: @tag\r\n else\r\n render json: { error: \"Tag creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def create_get_tag_metadata(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/properties'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetTagMetadataResponseModel.from_hash(decoded)\n end",
"def get_tag_definition_with_http_info(tag_definition_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagDefinitionsApi.get_tag_definition ...\"\n end\n # verify the required parameter 'tag_definition_id' is set\n if @api_client.config.client_side_validation && tag_definition_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_definition_id' when calling TagDefinitionsApi.get_tag_definition\"\n end\n if @api_client.config.client_side_validation && tag_definition_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'tag_definition_id' when calling TagDefinitionsApi.get_tag_definition, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/tagDefinitions/{tagDefinitionId}\".sub('{' + 'tagDefinitionId' + '}', tag_definition_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'audit'] = opts[:'audit'] if !opts[:'audit'].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 => 'TagDefinitionJson')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagDefinitionsApi#get_tag_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def action_attach_tag_with_http_info(list_id, attach_tag_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_attach_tag ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_attach_tag\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_attach_tag, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'attach_tag_request' is set\n if @api_client.config.client_side_validation && attach_tag_request.nil?\n fail ArgumentError, \"Missing the required parameter 'attach_tag_request' when calling ContactsApi.action_attach_tag\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/attach-tag'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\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'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(attach_tag_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_attach_tag\",\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: ContactsApi#action_attach_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_portfolio_tag_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.add_portfolio_tag ...'\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 PortfolioApi.add_portfolio_tag\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioApi.add_portfolio_tag, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioApi.add_portfolio_tag\"\n end\n # resource path\n local_var_path = '/portfolios/{id}/tag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\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'])\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(tag) \n\n # return_type\n return_type = opts[:return_type] || 'Array<Tag>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioApi#add_portfolio_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag_params\n params.require(:tag).permit(:tag_id, :rssi, :antenna, :last_seen_at, :funded, :member)\n end",
"def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end",
"def set_tag\n @tag = ActsAsTaggableOn::Tag.find(params[:id])\n end",
"def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def update_tag_values(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/value'\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 = @http_client.put _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n elsif _context.response.status_code == 404\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return UpdateTagValuesResponseModel.from_hash(decoded)\n end",
"def apply_tag(email, tag)\n data = { \"email\" => email, \"tag\" => tag }\n make_json_api_request :post, \"v2/#{account_id}/tags\", private_generate_resource(\"tags\", data)\n end"
] |
[
"0.62386",
"0.62061876",
"0.6096252",
"0.6047302",
"0.5955964",
"0.5827314",
"0.57999873",
"0.57780904",
"0.57511",
"0.5750471",
"0.5722747",
"0.5693817",
"0.5662055",
"0.5622788",
"0.5598687",
"0.5595545",
"0.55918217",
"0.55580986",
"0.55385274",
"0.55338955",
"0.5523899",
"0.5515735",
"0.550564",
"0.54875684",
"0.5483985",
"0.54448706",
"0.5425617",
"0.5425373",
"0.5421387",
"0.5420972",
"0.541561",
"0.5402376",
"0.5391384",
"0.5391384",
"0.538522",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.5385048",
"0.53808665",
"0.53808665",
"0.537979",
"0.537979",
"0.5378295",
"0.5373643",
"0.5360098",
"0.53589773",
"0.53589773",
"0.53589773",
"0.53589773",
"0.53589773",
"0.5355368",
"0.5349616",
"0.53406197",
"0.53406197",
"0.53401005",
"0.5339621",
"0.5334574",
"0.53245205",
"0.532378",
"0.53171134",
"0.531599",
"0.5311111",
"0.53102744",
"0.5302567",
"0.530044",
"0.529945",
"0.52952814",
"0.52922714",
"0.5286205",
"0.5282381",
"0.5282381",
"0.52793187",
"0.52767354",
"0.5276213",
"0.52649915",
"0.52637446",
"0.52563506",
"0.52533233",
"0.52517444",
"0.5248177",
"0.524719",
"0.524719",
"0.5244981",
"0.5240873",
"0.52328604",
"0.5231433"
] |
0.0
|
-1
|
Look up an array of the first count tag IDs with the specified batch URN. Output parameters tagIds (array of string, `E12345678912345678`) ... Array of RFID tag identifiers
|
def get_query_tags(batch_urn,
count = 100000)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/queryTags'
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
'batchUrn' => batch_urn,
'count' => count
}
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json'
}
# prepare and execute HttpRequest
_request = @http_client.get _query_url, headers: _headers
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return QueryTagsResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_tag_return_IDs(tag)\n # Split and strip the tags\n tags = tag.split(\",\").collect{|x| x.strip}\n i = 0\n iDs = []\n while i < tags.count do\n # Check if tag exist, if not - add it\n if Teg.find_by_teg(tags[i]).nil?\n\tTeg.new(:teg => tags[i]).save\n end\n # Insert into array the id of the tag\n iDs << Teg.find_by_teg(tags[i]).id\n i +=1\n end\n # return the IDs\n return iDs\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def tag\n puts \"\\ntagging\"\n tagged_arr = Hash.new\n (2..4).each do |k|\n @grams[k].each_with_index do |item, index|\n item_count = count index, k\n if item_count > 1\n unless equals tagged_arr, item\n tagged_arr[item.clone] = item_count\n end\n end\n end\n end\n tagged_arr\n end",
"def tag_counts(options = {})\n return [] if tag_ids.blank?\n \n ids_to_find = '(' + tag_ids.map(&:to_s).join(', ') + ')'\n tag_condition = \"#{Tag.table_name}.id IN #{ids_to_find}\" \n\n options[:conditions] = self.class.send(:merge_conditions,\n options[:conditions],\n tag_condition)\n self.class.tag_counts(options)\n end",
"def findBarcodeSequence(outputDirectory, barcodeTag)\n barcode = \"\"\n if barcodeTag == nil || barcodeTag.empty?()\n return \"\"\n end\n\n barcodeLabelFile = getBarcodeDefinitionFileName(outputDirectory)\n puts \"Looking for barcode labels in : \" + barcodeLabelFile\n\n lines = IO.readlines(barcodeLabelFile)\n\n lines.each do |line|\n tokens = line.split(\",\")\n if tokens[0].strip.eql?(barcodeTag)\n barcode = tokens[1].strip\n end\n end\n\n if barcode.empty?()\n raise \"Invalid barcode tag specified\"\n else\n return barcode\n end\n end",
"def set_tag_ids nids\n # Ensure that the user's tags are all and only those in nids\n oids = tagging_tags.pluck :id\n\n # Add new tags as necessary\n (nids - oids).each { |tagid| assert_tagging tagid, @tagging_user_id }\n\n # Remove tags as nec.\n (oids - nids).each { |tagid| refute_tagging tagid, @tagging_user_id }\n end",
"def tags\n request_libraries.collect(&:tag_id)\n end",
"def search\n tag_list = params[:tag_list]\n @riders = Rider.master.tagged_with(tag_list)\n end",
"def find_fandoms\n return unless fandom.present?\n names = fandom.split(',').map(&:squish)\n self.tag_ids ||= []\n self.tag_ids += Tag.where(name: names).pluck(:id)\n self.fandom = nil\n end",
"def tag\n #ban = true\n puts \"entro\"\n\n port_str = \"/dev/ttyACM0\" #may be different for you\n baud_rate = 115200\n data_bits = 8\n stop_bits = 1\n parity = SerialPort::NONE\n\n sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)\n # while ban do\n while (i = sp.gets.chomp) do\n i.slice!(\"Tag is not NDEF formatted.\")\n tagUID = i\n puts \"el while\"\n puts tagUID\n if tagUID.empty?\n ban= true\n else\n $global = 0\n session[:prueba] = tagUID\n $global = tagUID\n return tagUID\n end\n\n\n\n end\n #end\n #sp.closes\n end",
"def matching_device_tags\n @matching_device_tags ||= Tag.unclaimed.where('gml_uniquekey = ?', self.iphone_uniquekey)\n end",
"def tags_with_user_ids\n model_tags.inject([]) do |arr, tag|\n tag.user_ids.each{|user_id| arr << [tag.id, user_id]}\n arr\n end\n end",
"def search_by_product_ids(ids)\n msb_numbers = []\n\n ids.each do |id|\n j = search(id)\n msb = j['b'].collect { |e| e['Id'] }.map { |e| e.downcase }\n msb_numbers.concat(msb)\n end\n\n msb_numbers\n end",
"def tag_books(tag, books)\n puts \"Tagging #{books.length} books as #{tag}\"\n books.each do |b|\n unless Tag.exists?(book_id: b.id, name: tag)\n Tag.create(book_id: b.id, name: tag)\n end\n end\n puts \"Done tagging #{tag}\"\nend",
"def getGUIDURSIWBIC(studyID)\r\n\ttags = $piggybank.list_subjects(studyID)\r\n\ttags.each_with_index do |subj, index|\r\n\t\ttags[index] = [$piggybank.get_tags(subj)[\"RDoC GUID\"], subj.ursi, \r\n\t\t\t\t\t\t$piggybank.get_tags(subj)[\"WBIC\"]]\r\n\tend\r\n\t\r\n\treturn tags\r\nend",
"def scan_list_uids\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('scan/list', post)\r\n\t\tuuids=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan| uuids.push(scan.elements['uuid'].text) }\r\n\t\treturn uuids\r\n\tend",
"def select_taguchi_array\n closest = 0\n [8, 16, 32, 64, 128, 256, 512, 1024].each do |n|\n if @num_genes <= n - 1\n closest = n\n break\n end\n end\n file_name = \"L#{closest}\"\n load_array_from_file file_name\n end",
"def tag(tags)\n context = Thread.current[:lumberjack_context]\n context&.tag(tags)\n end",
"def for_tag(arr, tag)\n arr.select { |item| (item[:tags] || []).include?(tag) }\nend",
"def read_ntag_card(rng = 0...PN532::NTAG2XX_BLOCK_COUNT)\n rng.map do |x|\n begin\n [x, read_ntag_block(x)]\n rescue IOError\n [x, nil]\n end\n end\n end",
"def findBarcodeSequence(barcodeTag)\n barcode = \"\"\n if barcodeTag == nil || barcodeTag.empty?()\n return \"\"\n end\n\n=begin\n puts \"Value of dirname = \" + File.dirname(__FILE__).to_s\n barcodeLabelFile = \"/stornext/snfs5/next-gen/Illumina/ipipe/config//barcode_label.txt\"\n=end\n\n barcodeLabelFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"barcode_label.txt\"\n\n puts \"Looking for barcode labels in : \" + barcodeLabelFile\n\n lines = IO.readlines(barcodeLabelFile)\n\n lines.each do |line|\n tokens = line.split(\",\")\n if tokens[0].strip.eql?(barcodeTag)\n barcode = tokens[1].strip\n end\n end\n\n if barcode.empty?()\n raise \"Invalid barcode tag specified\"\n else\n return barcode\n end\n end",
"def tag\n #ban = true\n puts \"entro\"\n\n port_str = \"/dev/ttyACM0\" #may be different for you\n baud_rate = 115200\n data_bits = 8\n stop_bits = 1\n parity = SerialPort::NONE\n\n sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)\n # while ban do\n while (i = sp.gets.chomp) do\n \ti.slice!(\"Tag is not NDEF formatted.\")\n \ttagUID = i\n \tputs \"el while\"\n puts tagUID\n if tagUID.empty?\n\t ban= true\n\t else\n return tagUID\n\t end\n\n\n\n end\n #end\n #sp.closes\n end",
"def tags\n get.tagGuids\n end",
"def findBarcodeTagID(barcode)\n barcodeLabel = \"\"\n if barcode == nil || barcode.empty?()\n return \"\"\n end\n\n=begin\n if File.dirname(__FILE__).eql?(\".\")\n barcodeLabelFile = \"../config/barcode_label.txt\"\n else\n barcodeLabelFile = File.dirname(File.dirname(__FILE__)) +\n \"/config/barcode_label.txt\"\n end\n=end\n\n barcodeLabelFile = File.dirname(File.dirname(__FILE__)) +\n \"/config/barcode_label.txt\"\n\n lines = IO.readlines(barcodeLabelFile)\n\n lines.each do |line|\n tokens = line.split(\",\")\n if tokens[1].strip.eql?(barcode)\n barcodeLabel = tokens[0].strip\n end\n end\n\n if barcodeLabel.empty?()\n raise \"Invalid barcode specified\"\n else\n return barcodeLabel\n end\n end",
"def prepare_tags_id\n tags_ids = []\n if params[:source][:tags]\n tags = params[:source][:tags].split(',')\n tags.each do |tag|\n user_tag = current_user.tags.find_by_name(tag)\n unless user_tag then\n user_tag = current_user.tags.create(:name=>tag)\n end\n tags_ids << user_tag.id if user_tag\n end\n params[:source][:tag_ids] = tags_ids if tags_ids\n params[:source].delete(\"tags\")\n end\n end",
"def lookup(batch)\n req = Vacuum.new key: 'AKIAJA2IADZPBGHJTZRQ',\n secret: '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',\n tag: @tag,\n locale: 'us'\n \n \n params = { 'Operation' => 'ItemLookup',\n 'SearchIndex' => 'Books',\n 'ItemLookup.Shared.IdType' => 'ISBN',\n 'ItemLookup.Shared.Condition' => 'All',\n 'ItemLookup.Shared.MerchantId' => 'All',\n 'ItemLookup.Shared.ResponseGroup' => 'OfferFull'}\n \n batch.each_with_index do |item,index|\n params['ItemLookup.'+(index+1).to_s+'.ItemId'] = item\n end\n req.build params\n \n res = req.get\n items = []\n if res.valid?\n res.to_hash['Items'].each do |item|\n prod = {}\n prod['ASIN'] = item['Item']['ASIN']\n prod['New Price'] = item['Item']['OfferSummary']['LowestNewPrice']['FormattedPrice']\n prod['Used Price'] = item['Item']['OfferSummary']['LowestUsedPrice']['FormattedPrice']\n prod['url'] = \"http://www.amazon.com/dp/\"+prod['ASIN']+'/?tag='+@tag\n items << prod\n end\n end\n #puts res.to_hash.to_json\n items\nend",
"def extract_tags(frequently_reviewed_restaurants, tag_group)\n tags = frequently_reviewed_restaurants.collect{|r| r.first.tags_belongs_to(tag_group)}.flatten\n tag_usages_map = {}\n tags.each do |tag|\n tag_usages_map[tag] ||= 0\n tag_usages_map[tag] += 1\n end\n\n Tag.find_all_by_name(tag_usages_map.sort{|v1, v2| v2.last <=> v1.last}.collect{|t| t.first})\n end",
"def filter_ids\n (tags.map { |tag| tag[:id] } + filters.map(&:id)).uniq\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def book_ids(requests)\n return if requests.nil?\n\n arr = []\n requests.each do |r|\n arr << r.book_id\n end\n arr\n end",
"def tagged_with(context, tags)\n tags = convert_string_to_array(tags, get_tag_separator_for(context)) if tags.is_a? String\n array_field = tag_options_for(context)[:array_field]\n all_in(array_field => tags)\n end",
"def get_tags\n [['pxb', 'PXB'], ['ind', 'Individuals'], ['bus', 'Businesses'], ['grp', 'Peer Groups']]\n end",
"def scan_list_uids\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('scan/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tuuids=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan| uuids.push(scan.elements['uuid'].text) }\n\t\t\treturn uuids\n\t\tend",
"def process_tags(tag_str)\n tag_list = if tag_str\n tag_str.split(\",\")\n else\n fill_tags [], @max_no_of_tags\n end\n if tag_list.length < @max_no_of_tags\n fill_tags tag_list, @max_no_of_tags - tag_list.length\n end\n tag_list\n end",
"def subnet_by_tag(tag_symbol)\n @subnet_ids[@by_tag_name[tag_symbol]]\n end",
"def load_genres(tag_arr)\n\n\t\t@genres = Array.new(tag_arr.size)\n\n\t\ttag_arr.each_with_index do |el ,i|\n\n\t\t\t\t@genres[i] = true if el == 1\n\n\t\t\t\t@genres[i] ||= false #might not be necessary\n\n\t\t\tend\n\n\tend",
"def tag_pruning tags\n pruned_tags = []\n chunks = tags.in_groups_of( (tags.count/20).to_i )\n # binding.pry\n\n chunks.each_with_index do |chunk, i|\n # binding.pry\n if chunk.first.first.ascii_only?\n tag_nodes = InstaHelper.get_tag_media_nodes(chunk.first.first)\n puts \"=========== #{tag_nodes.count} @ #{i} ================\"\n unless (DateTime.now - DateTime.strptime(tag_nodes.first[\"node\"][\"taken_at_timestamp\"].to_s,'%s')).to_i > 30\n puts \"<<<<<<<<<<<<<<< Added #{i}th tag >>>>>>>>>>>>>>>>>>\"\n pruned_tags.push chunk\n end\n end\n end\n pruned_tags.flatten.in_groups_of(2)\n end",
"def tags\n libraries.collect(&:tag_id)\n end",
"def find_from(tags)\n result = []\n\n # Create a tag list from the parameter. If the parameter already contains\n # tag objects, sort them out.\n case tags\n when Array\n result, not_tags = tags.partition { |t| t.is_a?(Tag) and not t.new_record? }\n not_tags.map!(&:to_s)\n tags = TagList.from(not_tags)\n when Tag\n return [ tags ]\n else\n tags = TagList.from(tags)\n end\n\n return result if tags.empty?\n\n tags_result = find(:all, :conditions => tags_condition(tags))\n return result + tags_result\n end",
"def tags_with_user_ids\n _tags.collect{|t| [t.id, t.user_id] }\n end",
"def next_uuid count = @uuid_batch_count\n @uuids ||= []\n if @uuids.empty?\n @uuids = CouchRest.post(\"#{@uri}/_uuids?count=#{count}\")[\"uuids\"]\n end\n @uuids.pop\n end",
"def trackUserDefinedTags\n if params[:document].include?(:tags)\n tags = params[:document][:tags].split(',')\n tags.map(&:strip!)\n tags.uniq.each do |tag|\n user_tag= @parent_profile.user_tags.where(tag: tag).first ||@parent_profile.user_tags.create(tag: tag, category_ids: params[:document][:category_id].to_a)\n if !user_tag.nil? and !user_tag.category_ids.include?(params[:document][:category_id])\n begin\n user_tag.update_attributes(category_ids: user_tag.category_ids.push(params[:document][:category_id]))\n rescue\n next\n end\n end\n end\n end\n end",
"def generate_tags\n tag_data = self.analyze_and_return_labels_with_score\n tag_data.each do |description, score|\n tag = Tag.find_or_create_by(description: description)\n self.image_tags.create(score: score, description: description, tag: tag)\n end\n end",
"def tags(limit=nil)\n array = tags_with_counts\n limit ||= array.size\n array[0,limit].map{|t| t[0]}\n end",
"def tags(limit=nil)\n array = tags_with_counts\n limit ||= array.size\n array[0,limit].map{|t| t[0]}\n end",
"def tag_ids=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end",
"def tags_with_user_tag_counts\n\t\tuser_tags = tags.pluck(:name)\n\t\tuser_tag_list = Hash.new(0)\n\n\t\tuser_tags.each do |t|\n\t\t\tuser_tag_list[t] += 1\n\t\tend\n\n\t\ttags = treasures.tag_counts_on(:tags)\n\t\ttags.map do |t|\n\t\t\tt.taggings_count = user_tag_list[t.name]\n\t\tend\n\n\t\ttags\n\tend",
"def top_tagged(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n\n number_of_photos = from_instagram[\"data\"].size\n\n all_people_you_tag = []\n users_per_photo = []\n i = 0\n while i < number_of_photos\n x = 0\n people_per_photo = from_instagram[\"data\"][i][\"users_in_photo\"].size\n people_you_tag = from_instagram[\"data\"][i][\"users_in_photo\"]\n while x < people_per_photo\n username = from_instagram[\"data\"][i][\"users_in_photo\"][x][\"user\"][\"username\"]\n array = users_per_photo.push(username)\n x = x + 1\n end\n i = i + 1\n end\n\n if array\n\n b = Hash.new(0)\n array.each do |v|\n b[v] += 1\n end\n\n sorted_b = b.sort_by {|k, v| v}\n sorted_b = sorted_b.reverse\n\n sorted_b.map do |k, v|\n puts \"#{k}: #{v} tags\"\n end\n\n return sorted_b\n\n else \n return \"No users tagged\"\n end\n\n end",
"def read_uid(reader=0)\n if @@debug\n puts \"Available readers: #{@@readers}\"\n end\n\n @@readers[reader].poll(Mifare::Classic::Tag) do |tag|\n begin\n uid = tag.to_s.split()[0].upcase\n if @@debug\n puts \"#{uid}\"\n end\n return uid\n rescue Exception => e\n puts e\n end\n end\n end",
"def find_by_scan(*args)\n expects_array = args.first.kind_of?(Array)\n ids = args.flatten.compact.map(&:to_s).uniq\n\n if ids.size == 1\n id = ids.first\n record = load_target.detect { |r| id == r.id.to_s }\n expects_array ? [ record ] : record\n else\n load_target.select { |r| ids.include?(r.id.to_s) }\n end\n end",
"def top_tagged(user_id)\n from_instagram = retrieve_last_10_photos(user_id)\n\n number_of_photos = from_instagram[\"data\"].size\n\n all_people_you_tag = []\n users_per_photo = []\n i = 0\n while i < number_of_photos\n x = 0\n people_per_photo = from_instagram[\"data\"][i][\"users_in_photo\"].size\n people_you_tag = from_instagram[\"data\"][i][\"users_in_photo\"]\n while x < people_per_photo\n username = from_instagram[\"data\"][i][\"users_in_photo\"][x][\"user\"][\"username\"]\n array = users_per_photo.push(username)\n x = x + 1\n end\n i = i + 1\n end\n\n if array\n\n b = Hash.new(0)\n array.each do |v|\n b[v] += 1\n end\n\n sorted_b = b.sort_by {|k, v| v}\n sorted_b = sorted_b.reverse\n\n sorted_b.map do |k, v|\n puts \"#{k}: #{v} tags\"\n end\n\n return sorted_b\n\n else\n return \"No users tagged\"\n end\n\n end",
"def fetch_follower_id_array\n\t\tfollower_ids = hit_twitter { @client.follower_ids.to_a }\n\t\treturn follower_ids\n\tend",
"def find_users_id_from_query\n if query_is_mifare_number?\n find_users_from :card\n else\n found_user_ids = Set.new\n\n USER_SOURCES_PRIORITY.each do |source|\n if found_user_ids.size < USER_COUNT_SEARCH_LIMIT\n found_user_ids.merge(find_users_from source)\n end\n end\n\n found_user_ids.take(USER_COUNT_SEARCH_LIMIT)\n end\n end",
"def run_tag_script()\n puts \"Beginning the tag process.\"\n \n clear_all_tags()\n terms_table = terms_table()\n\n terms_table.each do |tag, terms|\n\n relevant_books = run_query(terms)\n tag_books(tag, relevant_books)\n \n end\n puts \"The tagging process is now complete.\"\nend",
"def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def add_request_tags(tags=[])\n if tags.any?\n tags.collect! { |tag| Tag.find_by_title(Rack::Utils::unescape(tag)) }\n self.requested_tags = (self.requested_tags + tags.select{|t| !t.nil?}).uniq\n end\n end",
"def tags_with_prefix(prefix)\n prefix = prefix.strip\n\n bind_variables = { tag_prefix: \"\\\"#{prefix}%\" }\n\n parameritized_query = <<~SQL\n SELECT json_agg(tag) AS matching_tags\n FROM\n (SELECT distinct jsonb_array_elements(tags) AS tag FROM #{table_name} ORDER BY tag) tags\n WHERE tag::text like :tag_prefix\n SQL\n\n query = ActiveRecord::Base.sanitize_sql([parameritized_query, bind_variables])\n results = ActiveRecord::Base.connection.exec_query(query).to_a.first.try(:[], 'matching_tags')\n\n JSON.parse(results || '[]')\n end",
"def create_new_tags\n if params[:commoner][:tag_ids].present?\n params[:commoner][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end",
"def receive_unkeyed_tag_att\n\n return [] if @node['tags']\n # \"tag:\" encountered, walk away\n\n ret = @message['payload']['ret']\n ret = Array(ret).flatten\n ret = nil unless ret.any? && ret.all? { |e| e.is_a?(String) }\n\n return [] unless ret\n\n (@node['tags'] ||= []).concat(ret)\n\n wrap('point' => 'entered', 'nid' => nid, 'tags' => ret)\n end",
"def get_unique_tag_values(tag)\n values = []\n @files.each { |mp3| \n values << mp3.tags.tag if mp3.tags.tag.length\n }\n values.sort!\n end",
"def enumerate_tags(\n filter,\n *args,\n deadline: nil\n )\n req = V1::EnumerateTagsRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.enumerate_tags(req, metadata: @parent.get_metadata(\"Resources.EnumerateTags\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.matches.each do |plumbing_item|\n g.yield Plumbing::convert_tag_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end",
"def tag\n tags.to_s.split(/\\s*,\\s*/).uniq\n end",
"def tag_names\n if tags_string\n tags_string.split(',').map(&:strip)\n else\n []\n end\n end",
"def tags\n articles.map { |article| article[:tags] }.flatten.compact.inject(Hash.new(0)) { |frequency_map, tag|\n frequency_map[tag] += 1\n frequency_map\n }\nend",
"def tags_with_weight\n tags_index_collection.master.find.to_a.map{ |r| [r[\"_id\"], r[\"value\"]] }\n end",
"def search(tag_id, reader_id)\n json = self.class.get(\"#{QUERY1 + PARAMETERS_API}&tag=#{tag_id}\")\n response = json['response']\n articles = response['results']\n\n articles.each do |article|\n parse_article(article, reader_id)\n end\n end",
"def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end",
"def parse_taxon_ids_list full_document\n full_document.gsub(/%tl\\[(.*?)\\]/) do\n ids_string = $1\n ids = ids_string.gsub(\" \", \"\").split(\",\")\n\n ids.map do |id|\n try_linking_taxon_id id\n end.join(\", \")\n end\n end",
"def ncbi_protein_lookup(ids)\n results = Bio::NCBI::REST::EFetch.protein(ids, 'fasta')\n parsed_results = Bio::FlatFile.new(Bio::FastaFormat, StringIO.new(results))\n parsed_results.entries\n end",
"def do_id_query(ids)\n responses = []\n ids.each do |k, v|\n new_key_value = map_key(k, v)\n next if new_key_value.blank? #we probably have bad ISBN, could be bad key though\n responses << get_thing(new_key_value)\n end\n selected = responses.map { |r| r['result'] }.flatten.compact.uniq\n return selected\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def tags_with_uniqueness\n index_tags_now! if need_to_index_tags and @do_tags_index\n tags_index_collection.find.sort(_id: 1).to_a.map{ |r| [r[\"_id\"], r[\"uniqueness\"]] }\n end",
"def tags\n if @tags.nil? # build categories\n @tags = {}\n @sentences.each do |sentence|\n sentence.each do |element|\n if @tags[element[1]].nil?\n @tags[element[1]] = 1\n else\n @tags[element[1]] = @tags[element[1]] + 1\n end\n end\n end\n end\n\n @tags\n end",
"def my_tag_ids=(ids)\n ids = ids.compact.uniq.map {|i| BSON::ObjectId(i)}\n unless ids == self.tag_ids\n self.tag_ids = []\n self.tags = Tag.where(:_id.in => ids).uniq.map {|p| p}\n end\n end",
"def find_by_tag(params)\n date_range_q = get_date_solr_query(params)\n solrparams = {\n :q => \"(#{Controller_Types[:tag]}:\\\"#{params[:tag]}\\\") #{date_range_q}\",\n :wt => :json,\n :fl => @@field_return_list\n }\n get_rows(solrparams, params)\n response = run_solr_query(solrparams)\n determine_proper_response(params, response)\n end",
"def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end",
"def pulled_tags\n @list.pullin ? @list.taggings.where(user_id: @list.owner_id).includes(:tag).map(&:tag) : []\n end",
"def report_list_uids\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n uuids = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report| \r\n uuids.push(report.elements['name'].text)\r\n end\r\n return uuids\r\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def init_tags(object_id)\n next_token = nil\n tags_loaded = false\n\n tags = []\n\n while !tags_loaded do\n resp = @@client.describe_tags({\n filters: [\n {\n name: \"resource-id\",\n values: [object_id]\n }\n ]\n })\n\n tags.concat(resp.tags)\n tags_loaded = resp.next_token.nil? || resp.next_token.empty?\n next_token = resp.next_token\n\n end\n\n Hash[tags.map { |tag| [tag.key, tag.value] }]\n\n end",
"def tag_tokens=(ids)\n current_ids = []\n ids.split(\",\").each do |id|\n current_ids << OfficialTag.find_or_create_by(tag_text: id).id\n end\n self.official_tag_ids = current_ids\n end",
"def tag_with(tag_names)\n _tags = []\n Tag.parse(tag_names).each do |tag_name|\n _tags << Tag.find_or_create_by_name(tag_name.downcase)\n end\n self.tags = _tags.uniq\n end",
"def search_for_ncbi_ids\n esearch = Entrez.ESearch(ncbi_database_name, @search_terms)\n # TODO: doesn't Entrez have a sorting option?\n # Uniq the array. Sometimes ESearch uselessly returns more than 1 id.\n @ids = esearch.ids.uniq.sort\n end",
"def tags_condition(tags, tags_alias)\n return if tags.empty?\n tag_ids = '(' + tags.map { |t| t.id.to_s }.join(', ') + ')'\n\n return \"#{tags_alias}.id IN #{tag_ids}\"\n end",
"def retrieve_label_uris\n uris = []\n i = 0\n total = count\n batchsize = 10_000\n until i > total\n result = client.query(%(\n #{sparql_prefixes}\n SELECT distinct ?label\n WHERE {\n #{where_statements}\n }\n LIMIT #{batchsize}\n OFFSET #{i}\n ))\n uris += result.map { |r| \"<#{r['label'].value}>\" }\n i += batchsize\n end\n uris\n end",
"def tag(tags = self.tags)\n tags.to_s.split(/\\s*,\\s*/).uniq\n end",
"def tags\n object.tags.map {|tag| tag.id}\n end",
"def add_tags(idea, tags_array_param)\n return if tags_array_param.nil?\n tag_names = Array.new ##define the array here so it is visable outside the each loop\n \n tags_array_param.each{|tag_array|\n tag_name = tag_array[:name];\n puts \"evaluating tag: #{tag_name}\"\n next if tag_name == \"\"\n ##split tags by ','\n tag_name.split(',').each{|name| tag_names << name.strip}\n }\n \n ##iterate though all new tags- try to get the tag, otherwise create a new one\n tag_names.each{|name|\n curr_tag = Tag.find_by_name(name, @current_user) || Tag.new(:name => name, :user => idea.user)\n if !idea.tags.include?(curr_tag)\n idea.tags << curr_tag\n end\n }\n end",
"def add_tags_from_definition_ids(tag_definition_ids, user, reason, comment, options)\n created_tag = self.class.post \"#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags\",\n tag_definition_ids,\n {},\n {\n :user => user,\n :reason => reason,\n :comment => comment,\n }.merge(options),\n Tag\n tags(false, 'NONE', options) unless created_tag.nil?\n end",
"def fetch_friend_id_array\n\t\tfriend_ids = hit_twitter { @client.friend_ids.to_a }\n\t\treturn friend_ids\n\tend",
"def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end",
"def search_implementation( tags, user, page, per_page )\n if tags == 'testtag'\n items = []\n 1.upto(20) {|i| items<< ('tag_'+i.to_s)}\n return items\n elsif user == 'testuser'\n items = []\n 1.upto(20) {|i| items<< ('user_'+i.to_s)}\n return items\n elsif !user && !tags\n return nil\n else\n return []\n end\t \n end",
"def each_by_tag(tags)\n reindex unless @clean\n indices = []\n # Get all the indices associated with the tags\n Array(tags).each do |t|\n indices.concat @tags[t] if @tags[t]\n end\n\n # Remove any nils\n indices.compact!\n return [] if indices.empty?\n\n # Sort it, so we get the fields back in the order they appear in the record\n indices.sort!\n\n indices.each do |tag|\n yield self[tag]\n end\n end",
"def scan_resume_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_resume(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend",
"def tags\n\t\t@tags = @identities = Identity.sorted_alphabetic.decorate\n\tend",
"def scan_resume_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_resume(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend",
"def tags(params = {})\n @tags ||= MailchimpAPI::Tag.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end",
"def set_tags\n @tags = Tag.all\n @time = Tag.all.to_a.slice(0..4)\n @place = Tag.all.to_a.slice(5..8)\n @feeling = Tag.all.to_a.slice(9..13)\n @tag = Tag.find_by(id: params[:id])\n end",
"def fill_ids(_in_stream)\n end"
] |
[
"0.56860304",
"0.5434679",
"0.5181921",
"0.50575536",
"0.5054888",
"0.5050918",
"0.49435166",
"0.49434254",
"0.48474193",
"0.48370224",
"0.48253968",
"0.4819892",
"0.48113188",
"0.47977632",
"0.4770586",
"0.47623456",
"0.47452334",
"0.47428283",
"0.47323185",
"0.47195017",
"0.47171393",
"0.4702133",
"0.46986327",
"0.46968612",
"0.4696563",
"0.46933466",
"0.4673132",
"0.46684176",
"0.4626238",
"0.4622669",
"0.46194714",
"0.4610718",
"0.46087465",
"0.45926434",
"0.45822185",
"0.45769462",
"0.4576011",
"0.45472628",
"0.45355296",
"0.45319864",
"0.45131177",
"0.45047572",
"0.45036596",
"0.44812676",
"0.44812676",
"0.4472638",
"0.44474453",
"0.44453076",
"0.4439658",
"0.4428104",
"0.44218916",
"0.44193754",
"0.44192284",
"0.44155312",
"0.441163",
"0.44048175",
"0.43943208",
"0.43896428",
"0.43803054",
"0.438028",
"0.43795106",
"0.43792754",
"0.43649822",
"0.43641546",
"0.43562",
"0.43536168",
"0.43478933",
"0.4345376",
"0.43452457",
"0.43414202",
"0.43229547",
"0.4321321",
"0.43210405",
"0.4320895",
"0.431865",
"0.43176827",
"0.4317289",
"0.4316477",
"0.43128175",
"0.43127984",
"0.4312368",
"0.43088207",
"0.42999837",
"0.42948928",
"0.42884418",
"0.42821956",
"0.42817128",
"0.4280444",
"0.42756134",
"0.42721334",
"0.4270861",
"0.42707458",
"0.42703176",
"0.4269544",
"0.42689732",
"0.42663917",
"0.42657927",
"0.42607915",
"0.42574534",
"0.4249915"
] |
0.55195796
|
1
|
Get a message to a single numeric tag code. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK message available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized Input HTTP Headers: HTTP Basic Authorization (as specified above) Accept language (as specified above) Input parameters: tagCode (required, number, `0`) ... Result code of a tag action Output parameters: code (Number, `0`) ... Indicates the result code of this call (see `result codes`) message (string, `verified`) ... Result message in `AcceptLanguage` (see `Multi language support`)
|
def create_get_single_tag_code_message(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/message'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# prepare and execute HttpRequest
_request = @http_client.post _query_url, headers: _headers, parameters: body.to_json
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return GetSingleTagCodeMessageResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end",
"def response_message message, code\n render json: {message: message, code: code}\n end",
"def get_tag request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_tag_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ArtifactRegistry::V1beta2::Tag.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def message_id_tag(params={:id => 0, :text => nil, :location=>:body, :action=>:generate})\n tag_string = SiteSetting.message_id_string\n#puts \"**** params=#{params}\"\n case params[:action]\n when :generate\n if params[:location] == :body\n return \"##{params[:id]}\"\n else\n return \"(#{tag_string} ##{params[:id]})\"\n end\n when :find\n if params[:location] == :body\n params[:text] =~ /[\\s\\(\\[]*!([0-9]+)/ || params[:text] =~ /confirm +[!#]([0-9]+)/i\n return $1 ? $1.to_i : nil\n else\n params[:text] =~ Regexp.new(tag_string + '\\s#([0-9]{1,9})\\)', true)\n return $1 ? $1.to_i : nil\n end\n when :confirm_tag # This is for use in an explanation of how to confirm\n return \"!#{params[:id]}\"\n end\n end",
"def code\n if !@values.has_key? 'RESPONSE'\n if has_errors? \n raise PayTrace::Exceptions::ValidationError, get_error_response\n else\n raise PayTrace::Exceptions::ValidationError, \"missing response field\"\n end\n end\n code = parse_code(@values[\"RESPONSE\"])\n code.first\n end",
"def getTokenMessage( entity_id, portal_name, language, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['portal_name'] = portal_name\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n return doCurl(\"get\",\"/token/message\",params)\n end",
"def response_code_message(response_code)\n case response_code\n when 1\n \"Success\"\n when 2\n \"Error\"\n when 3\n \"Server Too Busy\"\n when 4\n \"Protocol Error\"\n when 5\n \"Operation Not Supported\"\n when 6\n \"Recursion Count Too High\"\n when 7\n \"Server Read-only\"\n when 100\n \"Handle Not Found\"\n when 101\n \"Handle Already Exists\"\n when 102\n \"Invalid Handle\"\n when 200\n \"Values Not Found\"\n when 201\n \"Value Already Exists\"\n when 202\n \"Invalid Value\"\n when 300\n \"Out of Date Site Info\"\n when 301\n \"Server Not Responsible\"\n when 302\n \"Service Referral\"\n when 303\n \"Prefix Referral\"\n when 400\n \"Invalid Admin\"\n when 401\n \"Insufficient Permissions\"\n when 402\n \"Authentication Needed\"\n when 403\n \"Authentication Failed\"\n when 404\n \"Invalid Credential\"\n when 405\n \"Authentication Timed Out\"\n when 406\n \"Authentication Error\"\n when 500\n \"Session Timeout\"\n when 501\n \"Session Failed\"\n when 502\n \"Invalid Session Key\"\n when 504\n \"Invalid Session Setup Request\"\n when 505\n \"Session Duplicate Msg Rejected\"\n else\n \"Response Code Message Missing!\"\n end\n end",
"def get_tag_value_int (tag_path)\n\n $test_logger.log(\"Get tag value in integer #{tag_path}\")\n\n #Get tag text and data type\n tag_val, data_type = get_tag_value tag_path, true\n\n #Parse int value\n int_val = 0\n if data_type == DataType::HEX\n int_val = tag_val.hex\n elsif data_type == DataType::DEC || data_type == DataType::DEC_BIG\n int_val = tag_val.to_i\n end\n\n #Return int value\n int_val\n end",
"def reply_code\n return \"No response.\" if response.nil?\n return (not response.first.last.kind_of?(Hash) or response.first.last[\"reply_code\"].nil?) ? \"Unexpected response hash.\" : response.first.last[\"reply_code\"] if response.instance_of?(Hash)\n response_match = response.match(/\\<reply-code\\>(.+)\\<\\/reply-code\\>/) if response.instance_of?(String)\n return (response_match.nil?) ? \"Unexpected response string.\" : response_match[1] if response.instance_of?(String)\n return \"Unexpected response type.\"\n end",
"def get_tag_value_ascii (tag_path)\n\n $test_logger.log(\"Get tag value in ASCII #{tag_path}\")\n\n #Get tag text and data type\n tag_val, data_type = get_tag_value tag_path, true\n\n #Parse int value\n ascii_val = \"\"\n if data_type == DataType::HEX\n ascii_val = ILVMessage.hex_to_raw(tag_val.gsub(HEX_PREFIX, \"\")).reverse\n else\n ascii_val = tag_val\n end\n\n #Return ASCII value\n ascii_val\n end",
"def msg_code\n return @critical, 2 if @critical\n return @warning, 1 if @warning\n return @unknown, 3 if @unknown\n [@ok, 0]\n end",
"def get_message()\n m = @RESPONSE_HASH['MESSAGE']\n if (m == nil or m == \"\")\n return \"ERROR - NO MESSAGE FROM BLUEPAY\"\n end\n return m\n end",
"def message_from(response)\n case response[:response_code]\n when 0\n return \"OK\"\n when 2000\n return \"ERROR 2000: Invalid Connection Ticket\"\n when 10303\n return \"ERROR 10303: TransRequestID is empty\"\n when 10305\n return \"ERROR 10305: An error occurred when validating the supplied payment data\"\n when 10309\n return \"ERROR 10309: The credit card number is formatted incorrectly\"\n when 10312\n return \"ERROR 10312: The credit card Transaction ID was not found\"\n when 10409\n return CVVResult.messages[ response[:card_code] ] if CARD_CODE_ERRORS.include?(response[:card_code])\n end\n end",
"def http_code\n '000'\n end",
"def receive_codes(opts = {})\n receive_codes_with_http_info(opts)\n nil\n end",
"def reply_code\n root['ReplyCode'].to_i\n end",
"def parse_result(code, body, message, nfg_method)\n return_value = Hash.new\n if code == '200'\n parsed = REXML::Document.new(body)\n # Build return hash parsing XML response\n if parsed.root.nil?\n return_value['StatusCode'] = 'MissingParameter'\n return_value['Message'] = body\n return_value['ErrorDetails'] = nil\n else\n return_value = parsed.root.elements['soap:Body'].elements[\"#{nfg_method}Response\"].elements[\"#{nfg_method}Result\"]\n end\n else\n return_value['StatusCode'] = 'UnexpectedError'\n return_value['Message'] = message\n return_value['ErrorDetails'] = body\n end\n return_value\n end",
"def translate_status_code(code)\n {\n '00' => :success,\n '40' => :neutral,\n '59' => :waiting_bank,\n '60' => :rejected_bank,\n '64' => :waiting_risk,\n '65' => :rejected_risk,\n '70' => :rejected_validation,\n '80' => :waiting,\n '90' => :new\n }[code]\n end",
"def code\n @grpc.language_code\n end",
"def message\n response.body.match(/\"message\":\"(.*)\"/)[1]\n end",
"def code\n @response.code\n end",
"def code\n @response.code.to_i\n end",
"def code\n @response.code.to_i\n end",
"def respond(message, code: :ok)\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code] || code\n [code, { 'Content-Type' => 'application/json' }, [Oj.dump('result' => message)]]\n end",
"def getTypeFromCode(code)\n if ERROR_CODES.has_key? code\n return ERROR_CODES[code]\n elsif MESSAGE_CODES.has_key? code\n return MESSAGE_CODES[code]\n end\n return nil\n end",
"def get_message\n get_status[:message]\n end",
"def initialize(code, message)\n @code = code\n @message = message\n end",
"def get_intent(message)\n uri = URI(\"http://localhost:5000/parse\")\n params = { q: message.body }\n uri.query = URI.encode_www_form(params)\n\n res = Net::HTTP.get_response(uri)\n if res.is_a?(Net::HTTPSuccess)\n nlu_response = JSON.parse(res.body)\n intent = nlu_response[\"intent\"][\"name\"]\n intent&.to_sym\n end\n end",
"def messages_status_message_id_get_with_http_info(message_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_status_message_id_get ...'\n end\n # verify the required parameter 'message_id' is set\n if @api_client.config.client_side_validation && message_id.nil?\n fail ArgumentError, \"Missing the required parameter 'message_id' when calling MessagesApi.messages_status_message_id_get\"\n end\n # resource path\n local_var_path = '/messages/status/{messageId}'.sub('{' + 'messageId' + '}', message_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 = nil\n auth_names = ['apiKey']\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 => 'MessageStatusResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_status_message_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def code\n response&.code\n end",
"def code\n @json[:meta][:code]\n end",
"def code\n @response_attributes['Code'];\n 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 code\n self.response_code # .to_s\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def status_code\n response_value(:code)\n end",
"def secondary_response_code\r\n params['src']\r\n end",
"def status_code\n params[:code] || 500\n end",
"def status_code\n params[:code] || 500\n end",
"def codes\n tag_range(\"010\", \"09X\")\n end",
"def message_get( type, url, message, extra_parameters = {} )\n\t\t\tparams = Hash.new\n\t\t\tif extra_parameters\n\t\t\t\tparams.merge!(extra_parameters)\n\t\t\tend\n\t\t\t# compress GET requests to try and stay under that 8KB request limit\n\t\t\tparams[type] = encode( deflate( message ) )\n\t\t\t\n\t\t\tLogging.debug \"#{type}=#{params[type]}\"\n\t\t\t\n\t\t\turi = Addressable::URI.parse(url)\n\t\t\tif uri.query_values == nil\n\t\t\t\turi.query_values = params\n\t\t\telse\n\t\t\t\t# solution to stevenwilkin's parameter merge\n\t\t\t\turi.query_values = params.merge(uri.query_values)\n\t\t\tend\n\t\t\turl = uri.to_s\n\t\t\t#url = @URL + \"?SAMLRequest=\" + @request_params[\"SAMLRequest\"]\n\t\t\tLogging.debug \"Sending to URL #{url}\"\n\t\t\treturn url\n\t\tend",
"def code\n @http_response.code.to_i\n end",
"def message_get( type, url, message, extra_parameters = {} )\n params = Hash.new\n if extra_parameters\n params.merge!(extra_parameters)\n end\n # compress GET requests to try and stay under that 8KB request limit\n #deflate of samlrequest\n params[type] = encode( deflate( message ) )\n #Logging.debug \"#{type}=#{params[type]}\"\n \n uri = Addressable::URI.parse(url)\n if uri.query_values == nil\n uri.query_values = params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end",
"def message_get( type, url, message, extra_parameters = {} )\n params = Hash.new\n if extra_parameters\n params.merge!(extra_parameters)\n end\n # compress GET requests to try and stay under that 8KB request limit\n #deflate of samlrequest\n params[type] = encode( deflate( message ) )\n #Logging.debug \"#{type}=#{params[type]}\"\n \n uri = Addressable::URI.parse(url)\n if uri.query_values == nil\n uri.query_values = params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end",
"def cvv_result_code\n cvv_result_code_message = self.messages.find {|m| m.context=='processor.cvv_result_code' || m.context=='gateway.cvv_result_code' }\n cvv_result_code_message && cvv_result_code_message.key\n end",
"def primary_response_code\r\n params['prc']\r\n end",
"def status_code\n e = nil\n each_element('status') { |xe| e = xe }\n if e and e.attributes['code'].size == 3 and e.attributes['code'].to_i != 0\n e.attributes['code'].to_i\n else\n nil\n end\n end",
"def getCode()\n return @code\n end",
"def resp_error(message = '')\n # {code: 300, message: message}\n error!({code: 300, message: message}, 300)\n end",
"def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end",
"def resultByTag(tag, format)\n raise \"Not implemented\"\n end",
"def code\n @error['code']\n end",
"def unused_promocode_message\n $tracer.trace(__method__)\n return ToolTag.new(section.className(create_ats_regex_string(\"/system_message info_message/\")).find.p, __method__, self)\n end",
"def response_message\n parsed_response['message']\nend",
"def code\n @code ||= @net_http_res.code.to_i\n end",
"def code\n @data['code']\n end",
"def code\n @data['code']\n end",
"def code\n @data['code']\n end",
"def sms_send_code\n # <?xml version=\"1.0\" encoding=\"utf-8\"?>\n # <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n # <soap:Header>\n # <Header xmlns=\"http://www.twinfield.com/\">\n # <SessionID>string</SessionID>\n # </Header>\n # </soap:Header>\n # <soap:Body>\n # <SmsSendCode xmlns=\"http://www.twinfield.com/\" />\n # </soap:Body>\n # </soap:Envelope>\n raise NotImplementedError\n end",
"def replyCode( text, default = nil )\n\n if text =~ /^\\d{3} /\n text.to_i\n elsif default\n default\n else\n raise DictError.new(), \"Invalid reply from host \\\"#{text}\\\".\"\n end\n \n end",
"def replyCode( text, default = nil )\n\n if text =~ /^\\d{3} /\n text.to_i\n elsif default\n default\n else\n raise DictError.new(), \"Invalid reply from host \\\"#{text}\\\".\"\n end\n \n end",
"def verify_message(tag, message)\n own_tag = authenticate_message(message)\n Rack::Utils.secure_compare(tag, own_tag)\n end",
"def error code=nil, message=nil\n if code\n if code.is_a?(String)\n error = Lux::Error.new 400\n error.message = code\n else\n error = Lux::Error.new code\n error.message = message if message\n end\n\n raise error\n else\n Lux::Error::AutoRaise\n end\n end",
"def codes_from_message(message_array)\n message_array.collect { |st| st.split(':')[1] if st.include?(':') }.compact\n end",
"def liked_message message_id, options={}, headers={}\n @connection.get \"users/liked_message/#{message_id}.json\", options, headers\n end",
"def send(message)\n\t\turl_arg = @params\n\t\turl_arg[\"input\"] = message\n\t\turl_arg_str = URI.encode_www_form(url_arg)\n\n\t\theaders = {\n\t\t\t'User-Agent' => 'cleverbotrb https://github.com/d0p1s4m4/cleverbotrb',\n\t\t}\n\n\t\treq = Net::HTTP.new(HOST, 80)\n\t\tresp = req.get(@endpoint + url_arg_str, headers)\n\t\tif resp.code != \"200\"\n\t\t\treturn nil\n\t\tend\n\t\tresponse = JSON.parse(resp.body)\n\t\t@params['cs'] = response['cs']\n\t\treturn response['output']\n\tend",
"def response_code(namespace: BXD, node_name: 'ResponseCode')\n (node = doc.at(\"xmlns|#{node_name}\", xmlns: namespace)) && node.content && node.content.rjust(2, '0')\n end",
"def receive_codes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OtpsApi.receive_codes ...'\n end\n # resource path\n local_var_path = '/user/otp/sms/receive'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"OtpsApi.receive_codes\",\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: OtpsApi#receive_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def qsi_response\r\n code = digital_reciept_info('DigitalReceipt.QSIResponseCode')\r\n return @no_error ? QSI_RESPONSE_CODE_MESSAGES[code.chomp!] : code\r\n end",
"def say_number(number, digits='\"\"')\n response = AGIResponse.new\n command_str = \"SAY NUMBER #{number} #{digits}\"\n begin\n response.native = execute(command_str)\n rescue AGITimeoutError, AGICommandError, AGIHangupError\n raise\n end\n if response.native == -1 then\n raise AGIChannelError.new(@last_response, \"Channel Failure in (#{command_str})\")\n elsif response.native == 0\n response.success = true\n else\n response.success = true\n response.data = response.native.chr\n end\n return response\n end",
"def message_status(message_id)\n response = execute_command('querymsg', :apimsgid => message_id)\n parse_response(response)['Status']\n end",
"def get_integer\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/integer'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body.to_i\n end",
"def message_id; @message_impl.getMessageId; end",
"def code\n @raw_response.code\n end",
"def compute_response_code_to_return(j, response)\n # default to the restClient value\n rc = response.code\n if Hash.try_convert(j)\n # if the whole thing in an error response then pull out the contents\n # of the error response.\n if j.has_key?('ErrorResponse')\n j=j['ErrorResponse']\n end\n # if there is a nested response code then use that.\n if j.has_key?('responseCode')\n rc = j['responseCode']\n end\n end\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: use response code: [#{rc}]\"\n rc\n end",
"def code\n '202'\n end",
"def decode_integer(data)\n tag, value, remainder = decode_tlv(data)\n raise InvalidTag, tag.to_s if tag != INTEGER_TAG\n return decode_integer_value(value), remainder\n end",
"def formatted_message\n \"#{@message} (#{@code})\"\n end",
"def inbox_code\n @attributes[:inbox_code]\n end",
"def code\n info['Code']\n end",
"def response_code\n @response.code\n end",
"def some_method(message)\n # Write your own code here to build request and parse response\n request = ProtobufRubyExample::Proto::RequestPb.new(id: rand(100), message: message)\n\n response = @rpc_stub.some_method(request)\n\n return response.status\n end",
"def message\n response_json.fetch(\"message\", \"\")\n end",
"def message_id\n data[:message_id]\n end",
"def response_reason_code\n unescape params['x_response_reason_code']\n end",
"def status_code\n @data[:status_code].to_i\n end",
"def generate_response(code, format)\n @message = \"Returning code #{code} in #{format} format\"\n response_data = case format\n when \"txt\"\n content_type 'text/plain'\n @message\n when \"json\"\n content_type 'application/json'\n { message: @message }.to_json\n when \"xml\"\n content_type 'application/xml'\n erb :'status.xml', layout: false\n else\n erb :status\n end\n [code.to_i, response_data]\nend",
"def initialize(message=nil, code=nil)\n super(message)\n @code = code\n end",
"def response_reason_code\n unescape params['x_response_reason_code']\n end",
"def extract_error_code response\n return unless response\n return unless response['data'] && response['data'].class == Hash\n return unless response['data']['errorCode']\n\n response['data']['errorCode'].to_i\n end",
"def status_code\n @parser.status_code\n end",
"def transaction_id\n response_code\n end",
"def response_for(key)\n message[key]\n end",
"def message\n @values['message']\n end",
"def get_tag_value (tag_path, fetch_datatype=false)\n\n $test_logger.log(\"Get tag value #{tag_path}\")\n\n raise \"XML doc not loaded\" if @xml_ilv_node == nil\n\n #Get target tag\n target_tag = @xml_ilv_node.root.elements[tag_path]\n\n #Fetch target value\n val = \"\"\n val = target_tag.get_text.value if target_tag && target_tag.get_text\n\n #Get data type for element\n if fetch_datatype\n data_type = ILVMessage.get_type_for_ele(target_tag)\n return val, data_type\n else\n return val\n end\n end",
"def request_keyphrase\n date = Date.today\n big_key = generate_big_key(date)\n\n header_hash = get_header\n uri = generate_request(header_hash, big_key, date)\n response = Net::HTTP.get(uri)\n\n if response.start_with? 'MessageToBePrintedInDecoder'\n # Response error\n raise StandardError.new response[27..-1]\n end\n\n # Response ok\n response_decoded = Base64.decode64 response\n response_hash = decrypt_response big_key, response_decoded\n\n # Keyphrase is 'HP'\n response_hash['HP']\n end",
"def get_conversations_chat_message_with_http_info(conversation_id, message_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_chat_message ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling ConversationsApi.get_conversations_chat_message\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'message_id' is set\n fail ArgumentError, \"Missing the required parameter 'message_id' when calling ConversationsApi.get_conversations_chat_message\" if message_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/chats/{conversationId}/messages/{messageId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'messageId' + '}', message_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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 \n auth_names = ['PureCloud OAuth']\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 => 'WebChatMessage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_chat_message\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def json(code, message)\n content_type :json\n halt code, Yajl::Encoder.encode(message)\n end",
"def decode_message(message)\n # minimum size is header (4) + type (1)\n return if message.length < 5\n header, type = message.unpack('NC')\n # TODO: handle fragmented responses\n return if header != UNFRAGMENTED_HEADER\n [type, message[5, message.length]]\n end"
] |
[
"0.60959977",
"0.57663137",
"0.5558536",
"0.5535623",
"0.5480762",
"0.54005903",
"0.5275106",
"0.5274505",
"0.5243674",
"0.52152926",
"0.51961714",
"0.5186899",
"0.51346874",
"0.51182544",
"0.5117271",
"0.50756985",
"0.5074947",
"0.5067514",
"0.50588506",
"0.5043754",
"0.5035899",
"0.5026867",
"0.5026867",
"0.50252736",
"0.5024065",
"0.50184137",
"0.5015521",
"0.50118256",
"0.5010827",
"0.50079685",
"0.4997445",
"0.499718",
"0.49933252",
"0.49908096",
"0.49787137",
"0.49538428",
"0.4946371",
"0.49267694",
"0.49156058",
"0.49156058",
"0.49142954",
"0.48981684",
"0.48872688",
"0.4877233",
"0.4877233",
"0.48763046",
"0.48704717",
"0.4866627",
"0.48587894",
"0.48569542",
"0.4836662",
"0.48306015",
"0.48215082",
"0.4820673",
"0.48058233",
"0.48037377",
"0.47950527",
"0.47950527",
"0.47947058",
"0.47912538",
"0.479004",
"0.479004",
"0.47868365",
"0.4782535",
"0.4777538",
"0.4775301",
"0.47697407",
"0.47628492",
"0.47590888",
"0.4758701",
"0.47584885",
"0.47575748",
"0.4753739",
"0.47390926",
"0.47346735",
"0.47315407",
"0.4730328",
"0.47293022",
"0.4722025",
"0.47171664",
"0.47123387",
"0.4709739",
"0.47019437",
"0.46848622",
"0.4682279",
"0.4678433",
"0.4672525",
"0.46667662",
"0.4661499",
"0.46530205",
"0.4645132",
"0.46363345",
"0.46285945",
"0.46275595",
"0.46237427",
"0.46217614",
"0.46174347",
"0.46173236",
"0.46148658",
"0.46142164"
] |
0.6652409
|
0
|
Writes application data to tags, which updated the existing application data in Profiles. This function also supports setting the lock state of the application data, which prevents further changes of the application data. Writing application data to a tag is permitted under following conditions only: The tag with the given tagId must exist in Profiles The tag must have an application record with the given appId The lock state of the tag's application data must be present and explicitly set to false To insert a new application record, the data transaction endpoint shall be used Notes: Omitting value in the request will update the lock state of the tag only. Omitting locked in the request will write the value only. It is not possible to unlock a locked tag by setting locked to false. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK tags found and result available (also returned if only a subset of tags have this keys) 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized 404 NOT_FOUND no matching tags found or none the tags found do have app IDs with given name Input HTTP Headers: HTTP Basic Authorization (as specified above) Accept language (as specified above) Input parameters: appId (required, string, `ndef`) ... Application ID which references the data tagId (required, string, `0EEEE100000001`) ... Identifier for each tag to be updated value (optional, string, `AQIDBAUGBwgJCgsM`) ... Application data to be updated locked (optional, boolean, `true`) ... Lock flag to be set Output parameters: code (Number, `0`) ... Indicates the result code of this call (see `result codes`) tagId (string, `0EEEE100000001`) ... Tag ID tagCode (Number, `0`) ... Indicates if the result code for this tag (see `Possible result codes for a tag actions`)
|
def update_tag_values(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/value'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# prepare and execute HttpRequest
_request = @http_client.put _query_url, headers: _headers, parameters: body.to_json
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
elsif _context.response.status_code == 404
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return UpdateTagValuesResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_app data={}\n put '/app', data\n end",
"def update_appdata(person_id, appId, key, value)\n @restv9.update_appdata(person_id, appId, key, value)\n end",
"def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end",
"def update_app_data(data)\n Utils.assert_type(data, \"data\", Hash)\n update = P::DataMapValue.new(string_val: JSON.dump(data))\n command = P::UpdateCustomerAppDataCommand.new(**id_or_number, update: update)\n send_command(:update_customer_app_data, command)\n end",
"def write\n ensure_data_bag_exists\n\n result = locks.new(\n id: data_bag_id,\n type: type,\n name: name,\n client_name: client_name,\n process_id: Process.pid,\n time: Time.now\n ).save\n\n lock_manager.register(Actor.current)\n\n result\n rescue\n lock_manager.unregister(Actor.current)\n end",
"def add_appdata(person_id, appId, key, value)\n @restv9.add_appdata(person_id, appId, key, value)\n end",
"def encrypt_app_data=(value)\n @encrypt_app_data = value\n end",
"def addApplicationToList(data)\n newAppData = {}\n newAppData[uniqueId(data)] = data\n\n saveApplicationsList(applications.merge(newAppData))\n end",
"def put(data)\n end",
"def update \n if @app \n @app.update(app_params)\n\n if @app.valid?\n head :no_content\n else \n head :bad_request\n end\n else \n head :not_found\n end\n end",
"def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tags/#{gid}\", body: data, options: options)).first)\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update!(**args)\n @app_signature_hash = args[:app_signature_hash] if args.key?(:app_signature_hash)\n end",
"def update_tags(tags = nil)\n set_tags(tags)\n write_tags_to_repo\n read_tags_from_repo\n save!\n end",
"def update\n return if params_missing([ :id, :lock_serial ], params, true)\n\n lock = Lock.get_active_else_not(params)\n return render_error_modelname(404, :MISSING_RECORD, Lock) if !lock\n\n # Only the owner can update the lock record\n return render_error(403, :NOT_BELONGING, Lock) if lock.user_id != @current_user_device.user_id\n return render_error(404, :LOCK_DECOMMISSIONED) if lock.decommissioned?\n\n lock.assign_attributes(params_app_allowed)\n\n new_lock = false\n if !lock.commissioned?\n # New lock, set it all up\n new_lock = true\n lock.commission_date = DateTime.now\n end\n\n return check_save_failure(lock) if !lock.save\n\n # Owner's key not created until commissioning is completed (saved) successfully.\n # TODO Transaction around this and the commissioning?\n if new_lock\n key = create_user_key(lock.id, lock.user, lock.user)\n # Validation errors may fail in interesting ways here.\n end\n\n render_lock_reply(lock)\n end",
"def save\n MiGA.DEBUG \"Metadata.save #{path}\"\n self[:updated] = Time.now.to_s\n json = JSON.pretty_generate(data)\n sleeper = 0.0\n while File.exist?(lock_file)\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n FileUtils.touch lock_file\n ofh = File.open(\"#{path}.tmp\", \"w\")\n ofh.puts json\n ofh.close\n raise \"Lock-racing detected for #{path}.\" unless\n File.exist?(\"#{path}.tmp\") and File.exist?(lock_file)\n File.rename(\"#{path}.tmp\", path)\n File.unlink(lock_file)\n end",
"def set_tags(tags)\n @tags.update(tags)\n end",
"def write_tag_list_on(context, tags)\n if (self.is_auto_tag_ownership_enabled?)\n self.tag_owner.tag(self, :with => tags, :on => context, :skip_save => true)\n else\n self.set_tag_list_on(context, tags)\n end\n end",
"def enqueue_aps_application(application_name, override = false)\n res = redis.incr(aps_application_queued_key(application_name))\n end",
"def update_application_hash(update_hash)\n write_attribute :application, (application_hash || {}).merge(update_hash).to_json\n update_email_fields_from_application_hash update_hash\n end",
"def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def update!(**args)\n @application_id = args[:application_id] if args.key?(:application_id)\n end",
"def replace (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n lockfile = options[:lockfile] ? options[:lockfile] : \"#{filename}.lock\"\n\n begin\n if not options[:noop]\n fd = IO.sysopen(lockfile, IO::WRONLY | IO::CREAT | IO::EXCL, 0700)\n f = IO.new(fd, 'w')\n hook_write(f, lockfile) if block_given? and options[:verbose]\n else\n f = StringIO.new\n hook_write(f, lockfile, :rewind) if block_given? and options[:verbose]\n end\n\n file_stat = File.stat(filename) rescue nil\n\n if block_given?\n $stderr.puts \"cat /dev/null > #{Escape.shell_single_word(lockfile)}\" if options[:verbose]\n yield f\n else\n $stderr.puts AdvFileUtils.__send__(:write_echo_message, data, '>', lockfile) if options[:verbose]\n f.write(data)\n end\n\n f.close\n\n if file_stat\n FileUtils.chown(file_stat.uid.to_s, file_stat.gid.to_s, lockfile, options)\n FileUtils.chmod(file_stat.mode & 07777, lockfile, options)\n end\n FileUtils.mv(lockfile, filename, options)\n\n ensure\n f.close if f and not f.closed?\n begin\n File.delete(lockfile) if fd\n rescue Errno::ENOENT\n end\n end\n end",
"def set(app_id, cache_name, data_key, body, opts = {})\n data, status_code, headers = set_with_http_info(app_id, cache_name, data_key, body, opts)\n return data\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def set_global_appdata(params = {})\r\n deletes = context.remove_null_values(params)\r\n @context.call_myspace_api(:appdata_global_put, :body => params) if params.length > 0\r\n @context.call_myspace_api(:appdata_global_delete, :keys => deletes.join(';')) if deletes.length > 0\r\n end",
"def application=(value)\n @application = value\n end",
"def update\n requires :label, :application_name\n\n options = {\n 'ApplicationName' => application_name,\n 'Description' => description,\n 'VersionLabel' => label\n }\n options.delete_if {|key, value| value.nil?}\n\n data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']\n merge_attributes(data)\n end",
"def update_tags(new_tags, old_tags)\n @tags += (new_tags || [])\n @tags -= (old_tags || [])\n @tags.uniq!\n tag_update = TagUpdate.new(@identity, new_tags, old_tags)\n @amq.fanout('registration', :no_declare => @options[:secure]).publish(@serializer.dump(tag_update))\n true\n end",
"def save_app_stack full_info\n ActiveRecord::Base.transaction do\n app = save_app build_app_attrs(full_info)\n\n save_versions app, build_versions_attrs(full_info)\n save_video app, build_video_attrs(full_info)\n save_recommend_apps app, build_recommend_apps_attrs(full_info)\n\n developer = save_developer build_developer_attrs(full_info)\n app.developer = developer if developer && developer.id\n\n category = save_category build_category_attrs(full_info)\n app.category = category if category && category.id\n\n source = save_source build_source_attrs(full_info)\n app.source = source if source && source.id\n\n tags = save_tags build_tags_attrs(full_info)\n app.tags = tags if tags.any?\n\n display_tags = save_display_tags build_display_tags_attrs(full_info)\n app.display_tags = display_tags if display_tags.any?\n\n app.not_available_count = 0 #reset not_available_count\n\n app.save!\n app\n end\n end",
"def update\n @application.owner = current_user if @application.owner.blank?\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n end",
"def transfer_tags(appdata,companytagcheck)\n\n puts \"Importing Tags...\"\n\n #SOURCE APP\n #-----------------------------------------------------------------------------\n\n #INITIALIZE INFUSIONSOFT\n #_______________________\n #initializes source app\n puts \"=> Initializing\"\n initialize_infusionsoft(appdata[:src_appname], appdata[:src_apikey])\n\n #SOURCE APP DATA\n #_______________\n #Gets source app tags and tag categories\n puts \"=> Getting Source App Data\"\n source_tag_categories = get_table('ContactGroupCategory')\n source_tags = get_table('ContactGroup')\n\n #gets tag assignments\n source_tag_assignments = get_table('ContactGroupAssign')\n\n tags_on_contacts = []\n get_table('Contact').each { |c| tags_on_contacts |= c['Groups'].split(\",\") unless c['Groups'].nil? }\n source_tags.reject! { |t| tags_on_contacts.exclude? t['Id'].to_s}\n\n\n #DESTINATION APP\n #-----------------------------------------------------------------------------\n\n #INITIALIZE INFUSIONSOFT\n #_______________________\n #initializes destination app\n initialize_infusionsoft(appdata[:dest_appname], appdata[:dest_apikey])\n\n #DEST APP DATA\n #_____________\n #gets tags and tag categories that already exist in destination app\n puts \"=> Getting Dest App Data\"\n dest_tag_categories = {}\n get_table('ContactGroupCategory').each { |cat| dest_tag_categories[cat['Id']] = cat['CategoryName'] }\n\n dest_tags = {}\n get_table('ContactGroup').each { |tag| dest_tags[tag['Id']] = tag['GroupName'] }\n\n #creates ID relationships for contacts and companies\n dest_contacts = {}\n get_table('Contact',['Id',@@source_app_contact_id]).each { |contact| dest_contacts[contact[@@source_app_contact_id].to_i] = contact['Id'] }\n\n dest_companies = {}\n get_table('Company',['Id',@@source_app_account_id]).each { |company| dest_companies[company[@@source_app_account_id].to_i] = company['Id'] } unless params[:companies][:checkbox] == 'false'\n\n\n #CREATE TAGS AND CATEGORIES\n #__________________________\n #Create Categories and tags if they don't already exist\n puts \"=> Creating Categories\"\n category_relationship = {}\n source_tag_categories.each do |cat|\n category_relationship[cat['Id']] = dest_tag_categories.key(cat['CategoryName']) || Infusionsoft.data_add('ContactGroupCategory',cat)\n end\n\n puts \"=> Creating Tags\"\n tag_relationship = {}\n source_tags.each do |tag|\n tag['GroupCategoryId'] = category_relationship[tag['GroupCategoryId']] unless tag['GroupCategoryId'] == 0\n tag_relationship[tag['Id']] = dest_tags.key(tag['GroupName']) || Infusionsoft.data_add('ContactGroup',tag)\n end\n\n #ADD TAGS TO CONTACTS & COMPANIES\n #________________________________\n #adds tags to contacts using the ContactGroupAssign table from the source app\n puts \"=> Applying Tags\"\n source_tag_assignments.each do |contact|\n next if dest_contacts[contact['ContactId']].nil? && dest_companies[contact['Contact.CompanyID']].nil?\n contact['GroupId'] = tag_relationship[contact['GroupId']]\n dest_contacts[contact['ContactId']].nil? ? Infusionsoft.contact_add_to_group(dest_companies[contact['Contact.CompanyID']], contact['GroupId']) : Infusionsoft.contact_add_to_group(dest_contacts[contact['ContactId']], contact['GroupId'])\n end\n\n puts \"Tags Imported.\"\n end",
"def update!(**args)\n @app_info = args[:app_info] if args.key?(:app_info)\n end",
"def update_conversation_tags(id, tags)\n data = { tags: tags }\n put(\"conversations/#{id}/tags\", { body: data })\n end",
"def update\n authorize @organization\n @organization.tag_list.add @tags\n if @organization.save\n render :json => @organization.reload.tags\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end",
"def updateAppBetaVersion(org_id, type, env, version)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n begin\n # Making sure \"settings.apps is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\"\n },\n expression_attribute_values: {\n \":null\" => nil,\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS = :empty\",\n condition_expression: \"#SETTINGS.#APPS = :null\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.type is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE = if_not_exists(#SETTINGS.#APPS.#TYPE, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}' in org object\")\n end\n\n # updating the values\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => env,\n \"#ENV_VERSION\" => \"#{env}_version\",\n \"#ENV_DATE\" => \"#{env}_version_date\"\n },\n expression_attribute_values: {\n \":env\" => true,\n \":version\" => version,\n \":date\" => Time.now.strftime(\"%d/%m/%Y\")\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE.#ENV = :env,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV_VERSION = :version,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV_DATE = :date\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend",
"def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end",
"def write(key, data)\n responsible_clients(key).each do |v|\n with_retries { v.logical.write(wrap_key(key), data) }\n end\n end",
"def set(key, value, application_id, username = nil, hostname = nil)\n if username && hostname\n CF.CFPreferencesSetValue(\n key.to_cf,\n arg_to_cf(value),\n application_id.to_cf,\n arg_to_cf(username),\n arg_to_cf(hostname)\n )\n else\n CF.CFPreferencesSetAppValue(\n key.to_cf,\n arg_to_cf(value),\n application_id.to_cf\n )\n end\n CF.CFPreferencesAppSynchronize(application_id.to_cf)\n end",
"def webhook_update(existing_data, new_data)\n end",
"def create_appliction_set(application_name, keys)\n results = {}\n code = unlock_vault(keys)\n return code, nil if code > 399\n code = init_application(application_name)\n return code, nil if code > 399\n results[:app_id], code = create_application_id application_name\n return code, results if code > 399\n results[:user_id], code = create_user(application_name, results[:app_id])\n return code, results if code > 399\n results[:user_data], code = create_user_token(results[:user_id], results[:app_id], application_name)\n return code, results if code > 399\n [200, results]\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_store = args[:app_store] if args.key?(:app_store)\n end",
"def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @error_protection_code = args[:error_protection_code] if args.key?(:error_protection_code)\n @tag = args[:tag] if args.key?(:tag)\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def update_page_data(page_id, id, data)\n put \"pages/#{page_id}/data/#{id}\", {value: data}\n end",
"def update (data)\n cipher = new_encryption_cipher\n encrypted_file_content = cipher.update(data.to_yaml) + cipher.final\n\n File.open(vault_path, 'wb') { |f| f.write(encrypted_file_content) }\n FileUtils.chmod(0600, vault_path)\n end",
"def put(data)\n enter(canonical(data))\n nil\n end",
"def overwrite_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit, force_overwrite = true)\n end",
"def write_data\n data = {}\n tmp_file = \"#{@wallet_file}.tmp\"\n\n @data.each do |item|\n next if item.empty?\n\n data.merge!(\n item.id => {\n 'id' => item.id,\n 'group' => item.group,\n 'user' => item.user,\n 'url' => item.url,\n 'comment' => item.comment,\n 'last_edit' => item.last_edit,\n 'created' => item.created\n }\n )\n end\n\n Gem::Package::TarWriter.new(File.open(tmp_file, 'w+')) do |tar|\n data_encrypt = encrypt(data.to_yaml)\n tar.add_file_simple('wallet/meta.gpg', 0400, data_encrypt.length) do |io|\n io.write(data_encrypt)\n end\n\n @passwords.each do |id, password|\n tar.add_file_simple(\"wallet/passwords/#{id}.gpg\", 0400, password.length) do |io|\n io.write(password)\n end\n end\n\n @otp_keys.each do |id, key|\n tar.add_file_simple(\"wallet/otp_keys/#{id}.gpg\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n\n @keys.each do |id, key|\n tar.add_file_simple(\"wallet/keys/#{id}.pub\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n end\n\n File.rename(tmp_file, @wallet_file)\n rescue => e\n File.unlink(tmp_file) if File.exist?(tmp_file)\n\n raise \"#{I18n.t('error.mpw_file.write_data')}\\n#{e}\"\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n @byte_value = args[:byte_value] if args.key?(:byte_value)\n end",
"def write_lock\n FileUtils.touch(@lock_file)\n end",
"def push\n begin\n write_data\n rescue LockMethod::Locked\n sleep 0.5\n push\n end\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def apply_tag(email, tag)\n data = { \"email\" => email, \"tag\" => tag }\n make_json_api_request :post, \"v2/#{account_id}/tags\", private_generate_resource(\"tags\", data)\n end",
"def update\n authorize! :update, @app\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def set_AppKeyValue(value)\n set_input(\"AppKeyValue\", value)\n end",
"def update\n authorize @user\n @user.tag_list.add @tags\n if @user.save\n render :json => @user.reload.tags\n else\n error!(:invalid_resource, @user.errors, \"Tags have not been saved\")\n end\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def swap_app_ids(dbName)\n @conn = Mongo::Connection.new(DB_HOST)\n @db = @conn.db(SYSTEM_DB_NAME)\n @dbTenant = @conn.db(dbName)\n\n to_swap = [\n {\"app_name\" => \"inBloom Data Browser\", \"placeholder\" => \"DATABROWSER_ID_PLACEHOLDER\"},\n {\"app_name\" => \"inBloom Dashboards\", \"placeholder\" => \"DASHBOARD_ID_PLACEHOLDER\"},\n ]\n apps = @db.collection('application')\n app_auths = @dbTenant.collection('applicationAuthorization')\n\n to_swap.each do |app|\n puts \"Swapping IDs for #{app['app_name']}\"\n app_ent = apps.find_one({\"body.name\" => app['app_name']})\n if app_ent\n app_id = app_ent['_id']\n update_count = 0\n app_auths.find(\"body.appIds\" => app['placeholder']).each do |row|\n app_ids = row['body']['appIds']\n app_ids[app_ids.index(app['placeholder'])] = app_id\n app_auths.update({\"_id\" => row[\"_id\"]}, {\"$set\" => {\"body.appIds\" => app_ids}})\n update_count = update_count + 1\n end\n puts \"\\tUpdate #{update_count} entries\"\n end\n end\nend",
"def update\n\n unless @login_user_role == \"1\"\n flash[:error] = \"You don't have paermission.\"\n redirect_to :action => \"index\"\n return\n p \"hoge\"\n end\n\n #approveおよびdenyは承認者権限のみなのでチェックが必要\n @application = Application.find(params[:id])\n result = false\n if params['commit'] == \"approve\"\n result = @application.update_attribute(\"status\",1)\n\n\n\n\n\n #ary = ParseDate::parsedate(@application['start']) #=> [2001, 5, 24, 22, 56, 30, \"JST\", 4]\n #t = Time::local(*ary[0..-3]) #=> Thu May 24 22:56:30 JST 2001\n\n#2013-06-13 20:56:11 UTC\n\n starttime = Time.strptime(@application['start'].to_s, '%Y-%m-%d %H:%M:%S')\n endtime = Time.strptime(@application['start'].to_s, '%Y-%m-%d %H:%M:%S')\n\n job = Job.new\n\n #sgの算出処理必要\n #job.send_at starttime, :authorize_ingress_from_gw_to_target, @access_key, @secret_access_key, @region,sg\n #job.send_at endtime, :revoke_ingress_from_gw_to_target, @access_key, @secret_access_key, @region,sg\n\n\n elsif params['commit'] == \"deny\"\n result = @application.update_attribute(\"status\",2)\n end\n respond_to do |format|\n if result\n format.html { redirect_to :action => \"index\", notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tags\n if self.tags.any?\n self.tags.each do |tag|\n tag.update(owner: User.first)\n end\n end\n end",
"def update\n @experience = current_user.experiences.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n current_user.tag(@experience, :with => @experience.tag_list.to_s, :on => :tags)\n\n flash[:notice] = I18n.t('action.update_successfully')\n format.html { \n redirect_to user_home_path(current_user) \n }\n format.xml { head :ok }\n else\n flash[:error] = I18n.t('action.update_fail')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experience.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def update\n authorize_action_for @app\n\n respond_to do |format|\n if app_params[:android_config].present? && app_params[:android_config][:bundle_id].present?\n if (@app.android_config['bundle_id'] != app_params[:android_config][:bundle_id]) && App.android_bundle_id?(app_params[:android_config][:bundle_id])\n @app.errors.add(:base, 'Android bundle id is invalid or already used')\n end\n end\n\n if app_params[:ios_config].present? && app_params[:ios_config][:bundle_id].present?\n if (@app.ios_config['bundle_id'] != app_params[:ios_config][:bundle_id]) && App.ios_bundle_id?(app_params[:ios_config][:bundle_id])\n @app.errors.add(:base, 'iOS bundle id is invalid or already used')\n end\n end\n\n if !@app.errors.full_messages.present? && @app.update(app_params)\n format.html { redirect_to request.referrer, notice: 'App was successfully updated.' }\n format.json { render json: @app, status: :ok, location: :edit }\n else\n format.html { render :settings }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def alter_data(data = {})\n @data = @data.merge(data)\n end",
"def update!(**args)\n @locked = args[:locked] if args.key?(:locked)\n end",
"def process_tags(data)\n @tagmap.each do |id, tag|\n data.gsub!(id, process_tag(tag))\n end\n data\n end",
"def update_oauth_application(name, redirect_uris, description = '', icon = nil)\n API.update_oauth_application(@token, name, redirect_uris, description, icon)\n end",
"def update_oauth_application(name, redirect_uris, description = '', icon = nil)\n API.update_oauth_application(@token, name, redirect_uris, description, icon)\n end",
"def update\n if @building.update(update_params)\n if t = params.permit(:tags)[:tags]\n tag_names = t.split(\", \")\n tags = [Tag.create_with(name: \"building\").find_or_create_by(name: \"building\")]\n for n in tag_names\n tags += [Tag.create_with(name: n).find_or_create_by(name: n)]\n end\n @building.tags = tags\n end\n @notice = \"Updated successfully.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Update failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end",
"def update_tags(host_id, tags, source=nil)\n @tag_svc.update(host_id, tags, source)\n end",
"def update!(data)\n # can't be used @data.merge because []= is differently defined (below)\n case data\n when Hash\n when MMETools::Config\n data = data.to_hash\n else raise ArgumentError, \"Only Hash objects or MMETools::Config objects admited\"\n end\n data.each do |key, value|\n self[key] = value\n end\n end",
"def lock\n request_body = {\"index\" => {\"blocks\" => {\"write\" => true}}}.to_json\n @client.put(\"_settings\", request_body, content_type: :json)\n end",
"def updateAppFlag(org_id, type, env, value)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => env\n },\n expression_attribute_values: {\n \":value\" => value\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE.#ENV = :value\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend",
"def process_tags(data)\n @tagmap.each do |id, tag|\n data.gsub!(id, process_tag(tag))\n end\n data\n end",
"def update!(**args)\n @add_app = args[:add_app] if args.key?(:add_app)\n @add_pinned_item = args[:add_pinned_item] if args.key?(:add_pinned_item)\n @remove_app = args[:remove_app] if args.key?(:remove_app)\n @remove_pinned_item = args[:remove_pinned_item] if args.key?(:remove_pinned_item)\n end",
"def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(app, pipeline_name, json_file)\n # We need certain data about the pipeline that the user won't have or want\n # to get ahead of their changes.\n pipeline_config = get(app, pipeline_name)\n begin\n f = File.read(json_file)\n updated_pipeline_cfg = JSON.parse(f)\n updated_pipeline_cfg['id'] = pipeline_config['id']\n updated_pipeline_cfg['application'] = pipeline_config['application']\n updated_pipeline_cfg['name'] = pipeline_config['name']\n updated_pipeline_cfg['updateTs'] = pipeline_config['updateTs']\n @http.pipelines.post updated_pipeline_cfg.to_json\n rescue StandardError => e\n puts \"Error updating pipeline: #{e}\"\n Process.exit(1)\n end\n end",
"def write(address, data)\n tag, slot_num, block_offset = split_address(address)\n slot = @slots[slot_num.to_i(16)]\n hit_miss = hit_miss(slot, tag)\n if hit_miss == \"miss\"\n range = (tag + slot_num + \"0\").to_i(16)..(tag + slot_num + \"F\").to_i(16)\n write_to_slot(slot, tag, @main_memory.content[range])\n end\n slot.saved_blocks[block_offset.to_i(16)] = data\n slot.is_dirty = 1\n return hit_miss\n end"
] |
[
"0.5814049",
"0.56065583",
"0.5387194",
"0.5197366",
"0.5123045",
"0.49927306",
"0.49708614",
"0.49653965",
"0.48894238",
"0.481939",
"0.47946137",
"0.4789572",
"0.4789572",
"0.47737172",
"0.47618505",
"0.47555834",
"0.4755378",
"0.4737808",
"0.4736944",
"0.4712892",
"0.4710582",
"0.47024986",
"0.46824843",
"0.46824843",
"0.46783462",
"0.46640596",
"0.4650411",
"0.46473646",
"0.46472225",
"0.46472225",
"0.46472225",
"0.46452734",
"0.46452734",
"0.46329513",
"0.4612725",
"0.461121",
"0.46051282",
"0.4604799",
"0.45992193",
"0.45945483",
"0.45886663",
"0.45804527",
"0.45790175",
"0.45686427",
"0.45593098",
"0.45353055",
"0.45311114",
"0.4524354",
"0.44897616",
"0.44637197",
"0.4452796",
"0.44374648",
"0.4429313",
"0.4426763",
"0.4418422",
"0.44158655",
"0.4414934",
"0.44061708",
"0.43995115",
"0.4392049",
"0.43919098",
"0.43872443",
"0.43865108",
"0.43834534",
"0.43826523",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43767813",
"0.43758136",
"0.43758136",
"0.43629873",
"0.4362773",
"0.43593213",
"0.43572575",
"0.43546075",
"0.43537414",
"0.43520936",
"0.43520877",
"0.43504998",
"0.43441963",
"0.43337113",
"0.43336022",
"0.43335405",
"0.43335405",
"0.4332648",
"0.43310663",
"0.4323948",
"0.4321092",
"0.43135887",
"0.43091655",
"0.4307496",
"0.43063584",
"0.4306012",
"0.43048805"
] |
0.0
|
-1
|
Get application data from tags, which returns data encoded on the tags. This function also returns the lock state of the application data. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK tags found and result available (also returned if only a subset of tags have this keys) 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized 404 NOT_FOUND no matching tags found or none the tags found does have keys with given name Input HTTP Headers: HTTP Basic Authorization (as specified above) Accept language (as specified above) Input parameters: tagIds (required, string, `0EEEE100000001`) ... Identifier for each tag to be queried appId (required, string, `ndef`) ... Application ID which references the data Output parameters: code (Number, `0`) ... Indicates the result code of this call (see `result codes`) tagId (string, `0EEEE100000001`) ... Tag ID tagCode (Number, `0`) ... Indicates if the result code for this tag (see `Possible result codes for a tag actions`) value (string, `AQIDBAUGBwgJCgsM`) ... Application data (Base64 encoded) locked (boolean, `false`) ... Tag has been made readonly
|
def create_get_application_data_from_tags(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/value'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# prepare and execute HttpRequest
_request = @http_client.post _query_url, headers: _headers, parameters: body.to_json
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
elsif _context.response.status_code == 404
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return GetApplicationDataFromTagsResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read\n return unless locks\n\n result = locks.find(data_bag_id)\n\n result.to_hash if result\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end",
"def get_user_tags username, password\n do_request 'get_user_tags', username: username, password: password\n end",
"def create_get_keys_used_for_tag_authentication(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/key'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n elsif _context.response.status_code == 404\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetKeysUsedForTagAuthenticationResponseModel.from_hash(decoded)\n end",
"def check_lock_state(params, headers = {})\n app_key = params[:app_key]\n get(\"/apps/#{app_key}/lock_state\", {}, headers)\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n @data['tags']\n end",
"def get_appdata_global (*keys)\n @restv1.get_global_appdata(*keys)\n end",
"def tags\n get.tagGuids\n end",
"def gp_get_status(scope, query_aid = [])\n scope_byte = { :issuer_sd => 0x80, :apps => 0x40, :files => 0x20,\n :files_modules => 0x10 }[scope]\n data = Asn1Ber.encode [{:class => :application, :primitive => true,\n :number => 0x0F, :value => query_aid}]\n apps = [] \n first = true # Set to false after the first GET STATUS is issued.\n loop do\n raw = iso_apdu :cla => 0x80, :ins => 0xF2, :p1 => scope_byte,\n :p2 => (first ? 0 : 1), :data => [0x4F, 0x00]\n if raw[:status] != 0x9000 && raw[:status] != 0x6310 \n raise Smartcard::Iso::ApduException, raw\n end\n \n offset = 0\n loop do\n break if offset >= raw[:data].length\n aid_length, offset = raw[:data][offset], offset + 1\n app = { :aid => raw[:data][offset, aid_length] }\n offset += aid_length\n \n if scope == :issuer_sd\n lc_states = { 1 => :op_ready, 7 => :initialized, 0x0F => :secured,\n 0x7F => :card_locked, 0xFF => :terminated }\n lc_mask = 0xFF\n else\n lc_states = { 1 => :loaded, 3 => :installed, 7 => :selectable,\n 0x83 => :locked, 0x87 => :locked }\n lc_mask = 0x87\n end\n app[:lifecycle] = lc_states[raw[:data][offset] & lc_mask]\n\n permission_bits = raw[:data][offset + 1]\n app[:permissions] = Set.new()\n [[1, :mandated_dap], [2, :cvm_management], [4, :card_reset],\n [8, :card_terminate], [0x10, :card_lock], [0x80, :security_domain],\n [0xA0, :delegate], [0xC0, :dap_verification]].each do |mask, perm|\n app[:permissions] << perm if (permission_bits & mask) == mask\n end\n offset += 2\n \n if scope == :files_modules\n num_modules, offset = raw[:data][offset], offset + 1\n app[:modules] = []\n num_modules.times do\n aid_length = raw[:data][offset]\n app[:modules] << { :aid => raw[:data][offset + 1, aid_length] }\n offset += 1 + aid_length \n end\n end\n \n apps << app\n end\n break if raw[:status] == 0x9000\n first = false # Need more GET STATUS commands.\n end\n apps\n end",
"def do_query(query_tags, options = {})\n query_tags = [query_tags] if query_tags.is_a?(String)\n Chef::Log.info \"Tagged query_tags: #{query_tags}\"\n match_all = options.fetch(:match_all, false)\n resources = api_client.tags.by_tag(resource_type: 'instances', tags: query_tags, match_all: match_all)\n Chef::Log.info \"Tagged resources: #{resources}\"\n\n tags_hash = {}\n if resources.first\n links = resources.first.links\n if links\n links.each do |link|\n Chef::Log.info \"Tagged Resource Cloud:#{link['href'].split('/')[0..3].join('/')}\"\n next unless api_client.get_instance.show.cloud.href == link['href'].split('/')[0..3].join('/')\n next unless api_client.resource(link['href']).state == 'operational'\n resource_tags = api_client.tags.by_resource(resource_hrefs: [link['href']]) # .first.tags\n tags_hash[link['href']] = {\n 'tags' => resource_tags.first.tags.map { |tag| tag['name'] },\n }\n end\n end\n end\n tags_set_array = []\n tags_hash.values.each do |value|\n tags_set_array << ::MachineTag::Set.new(value['tags'])\n end\n tags_set_array\n end",
"def encrypted_data_bag_for(environment, data_bag)\n @encrypted_data_bags = {} unless @encrypted_data_bags\n\n if encrypted_data_bags[data_bag]\n return get_from_data_bags_cache(data_bag)\n else\n data_bag_item = encrypted_data_bag_item(data_bag, environment)\n data_bag_item ||= encrypted_data_bag_item(data_bag, WILDCARD_DATABAG_ITEM)\n data_bag_item ||= encrypted_data_bag_item(data_bag, \"nexus\")\n data_bag_item ||= {}\n @encrypted_data_bags[data_bag] = data_bag_item\n return data_bag_item\n end\n end",
"def lookup_data\n \n # Note: At least one query parameter is required\n render :json => {\n :success => false,\n :message => \"No query parameters\",\n :apps_data => []\n } unless request.query_parameters\n \n # Get query parameters\n query = get_query\n \n # Get list of fields to return\n fields = get_fields\n \n # Get list of fields to remove\n without = get_without_fields\n\n # Check if sorting method is specified\n sort_field = get_sorting('popularity_weight')\n \n # If the limit is specified set it otherwise default to 100\n limit_num = get_limit\n\n apps = AppData.where(query)\n .sort(sort_field)\n .fields(fields)\n .limit(limit_num)\n .all\n \n # Apply interests weighting if interests exist \n apps = weight_interests(apps, request.query_parameters['interests'])\n \n # Return result as json\n render :json => {\n :success => true,\n :message => \"Success\",\n :apps_data => apps.as_json(:only => fields, :except => without)\n }\n \n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def get_global_appdata(*keys)\r\n context.appdata_to_hash do\r\n if keys.length > 0\r\n @context.call_myspace_api(:appdata_global_keys_get, :keys => keys.join(';'), :v1_json => true)\r\n else\r\n @context.call_myspace_api(:appdata_global_get, :v1_json => true)\r\n end\r\n end\r\n end",
"def select_application(app_id)\n ber_data = iso_apdu! :ins => 0xA4, :p1 => 0x04, :p2 => 0x00, :data => app_id\n app_tags = Asn1Ber.decode ber_data\n app_data = {}\n Asn1Ber.visit app_tags do |path, value|\n case path\n when [0x6F, 0xA5, 0x9F65]\n app_data[:max_apdu_length] = value.inject(0) { |acc, v| (acc << 8) | v }\n when [0x6F, 0x84]\n app_data[:aid] = value\n end\n end\n app_data\n end",
"def index\n @tags, @tags_attached = TagService.list(current_user.id)\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def get_buffer_data\n key = params[:key]\n redis = Redis.new\n if redis.exists(key)\n code = redis.get(key)\n msg = {\n status: 'OK',\n md5: key,\n code: code\n }\n else\n msg = { status: 'ERROR' }\n end\n respond_to do |format|\n format.json {render json: msg}\n end\n end",
"def encrypted_data_bag_for(environment, data_bag)\n @encrypted_data_bags = {} unless @encrypted_data_bags\n\n if encrypted_data_bags[data_bag]\n return get_from_data_bags_cache(data_bag)\n else\n data_bag_item = encrypted_data_bag_item(data_bag, environment)\n data_bag_item ||= encrypted_data_bag_item(data_bag, WILDCARD)\n data_bag_item ||= {}\n @encrypted_data_bags[data_bag] = data_bag_item\n return data_bag_item\n end\n end",
"def get_credentials\n return if params_missing([ :id, :lock_serial ], params, true)\n return if !get_lock_id(params)\n lock = @lock || Lock.find(params[:lock_id])\n if !lock\n render_error_modelname(404, :MISSING_RECORD, Lock)\n return\n end\n\n json = {\n users_devices: {}, # All users_devices user+public_key over all key owners.\n keys: [], # all keys for lock.\n }\n # Don't care if lock is decommissioned?\n keys = Key.active_keys.where(lock_id: params[:lock_id]).order(:id)\n keys.each do |key|\n json[:keys] << key.id\n UserDevice.where(user_id: key.user_id).order(:id).each do |ud|\n next if json[:users_devices][ud.id]\n rsa = CryptoRSA.new(ud.private_key)\n json[:users_devices][ud.id] = {\n user_id: ud.user_id,\n public_key: rsa.get_public_key_pem\n }\n end\n end\n json[:server_time] = Time.now.utc.iso8601(9)\n json[:expire] = ApplicationController.CREDENTIAL_MAX_TRANSIT_TIME\n json[:lock] = params[:lock_id].to_i\n # Generate a signature of the json-encoded secure data.\n json_string = render_to_string :json => json\n json = {\n credentials: json,\n signature: GojiMasterKeysGen.sign(json_string),\n }\n lock.new_credentials = false\n if lock.save\n # Don't need OTA values here, done on immediately following sync.\n render :json => json\n else\n check_save_failure(lock)\n end\n end",
"def get_global_appdata(*keys)\n MySpace.appdata_to_hash do\n if keys.length > 0\n call_myspace_api(:appdata_global_keys_get, :keys => keys.join(';'), :v1_json => true)\n else\n call_myspace_api(:appdata_global_get, :v1_json => true)\n end\n end\n end",
"def get_full_data(data)\n case @client.api_version\n when \"1.2\"\n # in this version returned id=>{...}\n result = @client.api_request(:method => \"template.get\", :params => {:filter => data, :output => \"extend\"})\n result.empty? ? [] : result.values \n else\n @client.api_request(:method => \"template.get\", :params => {:filter => data, :output => \"extend\"})\n end\n end",
"def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def tags\n @tags ||= begin\n resp = @client.access_token.get('/reader/api/0/tag/list?output=json')\n raise \"unable to retrieve the list of tags for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['tags'].collect do |hash|\n Google::Reader::Tag.new(hash.merge({:client => @client}))\n end\n end\n end",
"def get_credentials\n# send_auth(@user_device)\n get(:get_credentials, id: @lock.id)\n end",
"def getAppsForDevice\n\n if !params.has_key?(:device_uid)\n render status: 400, text: \"\"\n end\n\n @apps = Array.new\n device = Device.find_by_uuid(params[:device_uid])\n downloads = Download.find_all_by_device_id(device.id)\n\n downloads.each do |d|\n app = App.find_by_id(d.app_download_id)\n\n if d.pending == false && app.accepted == true\n @apps << app\n end\n end\n\n @applist = Array.new\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n campaign_time_left = 0;\n campaign = device.getCampaignWithAppId(app.id)\n campaign_history = device.getCampaignHistoryWithAppId(app.id)\n if !campaign.nil? && !campaign_history.nil?\n if campaign.active && campaign.approved\n time_elapsed = Time.now - campaign_history.created_at\n if time_elapsed > (campaign.duration * 1.day)\n campaign_time_left = (campaign.duration * 1.day) - time_elapsed\n # campaign_time_left = 300\n end\n end\n end\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => campaign_time_left }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => campaign_time_left }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end",
"def get_inbox_tags_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_inbox_tags ...'\n end\n # resource path\n local_var_path = '/inboxes/tags'\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(['*/*'])\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] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\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: InboxControllerApi#get_inbox_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def app data={}\n get '/app', data\n end",
"def get_tags()\n db = connect_to_database()\n return db.execute(\"SELECT * FROM tags\")\n end",
"def query_tags(*tags)\n if tags.last.respond_to?(:keys)\n tags = tags[0..-2]\n options = tags.last\n else\n options = {}\n end\n\n do_query(tags, nil, options) { |result| yield result }\n end",
"def encrypt_app_data\n return @encrypt_app_data\n end",
"def index\n tags_list = []\n @user.tags.find_each do |tag|\n tags_list << tag_as_hash(tag, false)\n end\n\n render :status => 200,\n :json => {\n status: 200,\n tags: tags_list\n }\n end",
"def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend",
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end",
"def clouddata!\n\n # Collect all application ids, skipping any invalid ones\n ids = apps.collect do |app|\n app.id\n end.compact\n\n # Queries Apple's iTunes Store API for latest cloud data using undocumented bulk method\n response = Net::HTTP.get('itunes.apple.com', '/lookup?id=' + ids.join(','))\n results = JSON.parse(response)['results']\n results.each do |result|\n if app = get(result['trackId'] || -1)\n app.clouddata = result\n end\n end\n end",
"def tags\n get('tags')\n end",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def tag_service(dialogs_tags_hash)\n log_and_update_message(:info, \"Processing tag_service...\", true)\n\n # Look for tags with a sequence_id of 0 to tag the service\n dialogs_tags_hash.fetch(0, {}).each do |key, value|\n log_and_update_message(:info, \"Processing tag: #{key.inspect} value: #{value.inspect}\")\n tag_category = key.downcase\n Array.wrap(value).each do |tag_entry|\n process_tag(tag_category, tag_entry.downcase)\n end\n end\n log_and_update_message(:info, \"Processing tag_service...Complete\", true)\nend",
"def apks_version_codes\n ensure_active_edit!\n\n result = api_client.execute(\n api_method: android_publisher.edits.apks.list,\n parameters: {\n 'editId' => current_edit.data.id,\n 'packageName' => current_package_name\n },\n authorization: auth_client\n )\n\n raise result.error_message.red if result.error? && result.status != 404\n\n return result.data.apks.collect(&:versionCode)\n end",
"def index\n do_authorize_class\n\n if params.include?(:audio_event_id)\n @audio_event = AudioEvent.find(params[:audio_event_id])\n authorize! :show, @audio_event\n query = @audio_event.tags\n else\n query = Tag.all\n end\n\n @tags, opts = Settings.api_response.response_advanced(\n api_filter_params,\n query,\n Tag,\n Tag.filter_settings\n )\n respond_index(opts)\n end",
"def tags\n @tags ||= get(\"/repos/show/#{owner.login}/#{name}/tags\")['tags']\n end",
"def authenticate_application(opts = {})\n data, _status_code, _headers = authenticate_application_with_http_info(opts)\n data\n end",
"def tags\n response[\"tags\"]\n end",
"def get_rum_applications_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...'\n end\n # resource path\n local_var_path = '/api/v2/rum/applications'\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'])\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] || 'RUMApplicationsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_rum_applications,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#get_rum_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end",
"def get_image_manifest_by_tag(tag)\n\n token = self.get_auth_token\n\n # https://docs.docker.com/registry/spec/api/#detail\n reg_response = RestClient.get \"https://#{@registry_server}/v2/#{@repository_name}/manifests/#{tag}\", { 'Authorization' => \"Bearer #{token}\" }\n respcode = reg_response.code\n\n if respcode != 200\n raise \"Request to registry failed - response code #{respcode}\"\n end\n\n return reg_response\n\n end",
"def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end",
"def create_appliction_set(application_name, keys)\n results = {}\n code = unlock_vault(keys)\n return code, nil if code > 399\n code = init_application(application_name)\n return code, nil if code > 399\n results[:app_id], code = create_application_id application_name\n return code, results if code > 399\n results[:user_id], code = create_user(application_name, results[:app_id])\n return code, results if code > 399\n results[:user_data], code = create_user_token(results[:user_id], results[:app_id], application_name)\n return code, results if code > 399\n [200, results]\n end",
"def read_all_tags(taglib, id3v2_frames, id3v1_tag = nil, **opts)\n frames = []\n id3v2_frames.each { |frame_id| frames += id3v2_frames(taglib, frame_id) }\n\n data = []\n # only check id3v1 if no id3v2 frames found\n if frames.empty?\n data << id3v1_tag(taglib, id3v1_tag) unless id3v1_tag.nil?\n else\n frames.each { |frame| data << data_from_frame(frame, **opts) }\n end\n\n data.compact\n end",
"def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end",
"def get_updated_tag_list\n if is_filtered?\n @tags = Tag.filtered_hacker_tags(session[:filter], current_user.id)\n else\n @tags = Tag.current_hacker_tags(current_user.id)\n end\n end",
"def data\n return [] unless ::File.exist?(@locks_file)\n\n # opening up the file, and creating a shared lock\n handle = ::File.open(@locks_file, 'r')\n handle.flock(::File::LOCK_SH)\n\n # Reading data until the eof\n data = handle.read\n\n # We're all good\n handle.flock(::File::LOCK_UN)\n handle.close\n\n # Unserializing and checking if the resource file contains data for this file\n data = YAML.load(data)\n data || []\n end",
"def app_locker_application_control\n return @app_locker_application_control\n end",
"def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def getTags()\n dataHash = @item_json['data']\n tagSet = Set.new\n\n dataHash.each do |itemId, item|\n item['tags'].each do |tag|\n tagSet.add(tag)\n end\n end\n\n return tagSet.to_a\n end",
"def get_app_info\n path = get_path_to_merged_manifest\n handle = File.open(path)\n\n parser = Oga.parse_xml(handle)\n\n package = parser.xpath(\"//manifest\").attr('package').last.value\n versionCode = parser.xpath(\"//manifest\").attr('android:versionCode').last.value\n versionName = parser.xpath(\"//manifest\").attr('android:versionName').last.value\n\n {\n package: package,\n versionCode: versionCode,\n versionName: versionName,\n }\n end",
"def retrieve_data_bag\n unless(@_cached_bag)\n if(data_bag_encrypted?)\n @_cached_bag = Chef::EncryptedDataBagItem.load(\n data_bag, data_bag_name, data_bag_secret\n )\n else\n begin\n @_cached_bag = search(data_bag, \"id:#{data_bag_name}\").first\n rescue Net::HTTPServerException\n Chef::Log.info(\"Search for #{data_bag} data bag failed meaning no configuration entries available.\")\n end\n end\n end\n @_cached_bag\n end",
"def find_android_apps(api_key, search_term)\n search_uri = \"https://data.42matters.com/api/v2.0/android/apps/query.json?access_token=#{api_key}\"\n data = {\n \"query\" => {\n \"query_params\" => {\n \"from\": 0,\n \"sort\": \"score\",\n \"include_full_text_desc\": true,\n \"include_developer\": true,\n \"full_text_term\": \"#{search_term}\"\n }\n }\n }\n \n response = http_request :post , search_uri, nil, {}, data.to_json, true, 60\n \n unless response\n _log_error \"Failed to retrieve response from 42matters. Exiting!\"\n return\n end\n\n _log \"Got response! Parsing...\"\n response_json = JSON.parse(response.body)\n \n if response_json[\"results\"]\n # iterate through items and if entity name is in title or developer, consider a match\n response_json[\"results\"].each do |app|\n is_match = false\n\n if app[\"title\"] =~ /#{search_term}/i\n #_log \"Found matching app #{app}\"\n is_match = true\n elsif app[\"developer\"] =~ /#{search_term}/i\n is_match = true\n elsif app[\"description\"] =~ /#{search_term}/i\n is_match = true\n end\n \n if is_match\n _create_entity \"AndroidApp\", {\n \"description\" => app[\"description\"], \n \"name\" => app[\"package_name\"], # setting name to app package_name so we don't create multiple entities of the same app\n \"package_name\" => app[\"package_name\"], # redundant field, but adding to as it may be needed in the future.\n \"price\" => app[\"price\"], \n \"min_sdk\" => app[\"min_sdk\"],\n \"version\" => app[\"version\"],\n \"short_description\" => app[\"short_desc\"],\n \"downloads\" => app[\"downloads\"],\n \"email\" => app[\"email\"],\n \"website\" => app[\"website\"],\n \"category\" => app[\"category\"],\n \"developer\" => app[\"developer\"],\n \"icon\" => app[\"icon\"]\n }\n end\n end\n else\n _log \"No apps found for search term. Exiting.\"\n return\n end\n end",
"def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_init_uri.hostname, applicaiton_init_uri.port) do |http|\n req.body = { 'type' => 'app-id' }.to_json\n http.request(req)\n end\n res.code.to_i\n end",
"def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end",
"def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\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 = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\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 => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end",
"def get_application_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemServiceApi.get_application ...'\n end\n # resource path\n local_var_path = '/system/usage'\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'])\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] || 'Hash<String, 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: SystemServiceApi#get_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tags_field\n try_until -> { @tags_field } do\n send_message(Protocol::Device::GetTags.new)\n end\n @tags_field\n end",
"def lease_app_data\n command = P::LeaseCustomerAppDataCommand.new(**id_or_number)\n send_command(:lease_customer_app_data, command).map do |payload|\n # TODO: Even if this is a special case, can't we just do in in ResponseParser ?\n payload[:value] = Utils.parse_string_or_byte_val(payload[:value]) if payload[:value]\n payload\n end\n end",
"def get_json(path)\n throw \"Can't use a locked vault\" if @locked == true\n throw 'bad token value' if @authorized == false\n uri = URI(@url + path)\n req = Net::HTTP::Get.new(uri)\n req['X-Vault-Token'] = @token\n begin\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n data = nil\n if res.code.to_i < 300\n payload = JSON.parse(res.body)\n data = payload['data']\n end\n rescue => _\n return nil, 502\n end\n return data, res.code.to_i\n end",
"def get_item(app_id, cache_name, data_key, body, opts = {})\n data, status_code, headers = get_item_with_http_info(app_id, cache_name, data_key, body, opts)\n return data\n end",
"def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end",
"def get_audit_app_with_http_info(audit_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuditApi.get_audit_app ...\"\n end\n # verify the required parameter 'audit_application_id' is set\n fail ArgumentError, \"Missing the required parameter 'audit_application_id' when calling AuditApi.get_audit_app\" if audit_application_id.nil?\n # resource path\n local_var_path = \"/audit-applications/{auditApplicationId}\".sub('{format}','json').sub('{' + 'auditApplicationId' + '}', audit_application_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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 = ['basicAuth']\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 => 'AuditApp')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditApi#get_audit_app\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end",
"def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend",
"def tag(tags)\n context = Thread.current[:lumberjack_context]\n context&.tag(tags)\n end",
"def index\n item_id = params[:item_id].to_i\n all_tags = (item_id > 0) ? Tag.joins(:tagged_items).where(tagged_items: {item_id: item_id}) : Tag.all\n return json_response([]) unless newest_tag = all_tags.sort_by(&:updated_at).last\n Rails.logger.info \"newest_tag is #{newest_tag.inspect}\"\n render_if_stale(all_tags, last_modified: newest_tag.updated_at.utc, etag: newest_tag) do |tag_presenters|\n tag_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end",
"def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def get_v1_tags_with_http_info(tag_names_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_tags ...'\n end\n # verify the required parameter 'tag_names_list' is set\n if @api_client.config.client_side_validation && tag_names_list.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_names_list' when calling TagApi.get_v1_tags\"\n end\n # resource path\n local_var_path = '/v1/tags'\n\n # query parameters\n query_params = {}\n query_params[:'tag_names_list'] = tag_names_list\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 = ['api_key']\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 => 'TagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_data_from_references(resource_name)\n puts \"fetching #{resource_name}...\"\n mauth_config = MAuth::ConfigEnv.load\n references_host = ENV.fetch('REFERENCES_HOST', 'https://references-innovate.imedidata.com')\n begin\n connection = Faraday::Connection.new(url: references_host) do |builder|\n builder.use MAuth::Faraday::RequestSigner, mauth_config\n builder.adapter Faraday.default_adapter\n end\n\n # get the data\n response = connection.get \"/v1/#{resource_name}\"\n puts \"HTTP #{response.status}\"\n\n # return the user info\n if response.status == 200\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\n else\n puts response.body\n nil\n end\n rescue JSON::ParserError => e\n puts \"Error parsing data from references: #{e.inspect}\"\n puts e.backtrace.join(\"\\n\")\n end\nend",
"def items(tag = nil)\n if tag.nil?\n @items\n else\n @items.select { |item| item['tags'].include? tag }\n end\n end",
"def protected_app_locker_files\n return @protected_app_locker_files\n end",
"def lock\n\n lockinfo = request_document.xpath(\"//#{ns}lockinfo\")\n asked = {}\n asked[:timeout] = request.env['Timeout'].split(',').map{|x|x.strip} if request.env['Timeout']\n asked[:depth] = depth\n unless([0, :infinity].include?(asked[:depth]))\n BadRequest\n else\n asked[:scope] = lockinfo.xpath(\"//#{ns}lockscope\").children.find_all{|n|n.element?}.map{|n|n.name}.first\n asked[:type] = lockinfo.xpath(\"#{ns}locktype\").children.find_all{|n|n.element?}.map{|n|n.name}.first\n asked[:owner] = lockinfo.xpath(\"//#{ns}owner/#{ns}href\").children.map{|n|n.text}.first\n begin\n lock_time, locktoken = resource.lock(asked)\n render_xml(:prop) do |xml|\n xml.lockdiscovery do\n xml.activelock do\n if(asked[:scope])\n xml.lockscope do\n xml.send(asked[:scope])\n end\n end\n if(asked[:type])\n xml.locktype do\n xml.send(asked[:type])\n end\n end\n xml.depth asked[:depth].to_s\n xml.timeout lock_time ? \"Second-#{lock_time}\" : 'infinity'\n xml.locktoken do\n xml.href locktoken\n end\n if(asked[:owner])\n xml.owner asked[:owner]\n end\n end\n end\n end\n response.headers['Lock-Token'] = locktoken\n response.status = resource.exist? ? OK : Created\n rescue LockFailure => e\n multistatus do |xml|\n e.path_status.each_pair do |path, status|\n xml.response do\n xml.href path\n xml.status \"#{http_version} #{status.status_line}\"\n end\n end\n end\n end\n end\n end",
"def get_and_lock(id, lock_time, options = GetAndLockOptions.new)\n resp = @backend.document_get_and_lock(bucket_name, \"#{@scope_name}.#{@name}\", id, options.timeout, lock_time)\n GetResult.new do |res|\n res.transcoder = options.transcoder\n res.cas = resp[:cas]\n res.flags = resp[:flags]\n res.encoded = resp[:content]\n end\n end",
"def acquire_service_data\n if config[:tags] && config[:service]\n tags = config[:tags].split(',').to_set\n services = []\n Diplomat::Health.service(config[:service]).each do |s|\n if s['Service']['Tags'].to_set.superset? tags\n services.push(*s['Checks'])\n end\n end\n services\n elsif config[:nodename]\n data = []\n begin\n services = Diplomat::Node.get(config[:nodename]).Services\n rescue StandardError\n services = {}\n end\n services.each_value do |service|\n Diplomat::Health.checks(service['Service']).each do |check|\n data.push(check) if check.Node == config[:nodename]\n end\n end\n data\n elsif config[:all]\n Diplomat::Health.state('any')\n else\n Diplomat::Health.checks(config[:service])\n end\n end",
"def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend",
"def tag_data_endpoints\n TagDataEndpointsController.instance\n end",
"def tags\n return @tags_cache if (@tags_cache ||= nil)\n \n global_tags, tag_types = {}, {}\n \n f = nil\n # For each current .hgtags file in our history (including multi-heads), read in\n # the tags\n hg_tags_nodes.each do |rev, node, file_node|\n # get the file\n f = (f && f.file(file_node.file_node)) || self.versioned_file(\".hgtags\", :file_id => file_node.file_node)\n # read the tags, as global, because they're versioned.\n read_tags(f.data.split(\"\\n\"), f, \"global\", global_tags, tag_types)\n end\n \n # Now do locally stored tags, that aren't committed/versioned\n begin\n # get the local file, stored in .hg/\n data = @hg_opener.read(\"localtags\")\n # Read the tags as local, because they are not versioned\n read_tags(data.split_newlines, \"local_tags\", \"local\", global_tags, tag_types)\n rescue Errno::ENOENT\n # do nothing. most people don't have this file.\n end\n # Save our tags for use later. Use ivars.\n @tags_cache, @tags_type_cache = {}, {}\n \n # Go through the global tags to store them in the cache\n global_tags.each do |k, nh|\n # update the cache\n @tags_cache[k] = nh.first unless nh.first == NULL_ID\n @tags_type_cache[k] = tag_types[k]\n end\n \n # tip = special tag\n @tags_cache[\"tip\"] = self.changelog.tip\n \n # return our tags\n @tags_cache\n end",
"def tag_list\n data[:tag_list]\n end",
"def tag_list\n data[:tag_list]\n end",
"def walletlock\n @api.request 'walletlock'\n end",
"def search(tags, params)\n begin\n server = XMLRPC::Client.new2(self.service_uri)\n flickr_arguments = {:api_key => self.api_key, \n :tag_mode => \"all\", \n :page => params[:page].to_i,\n :per_page => params[:per_page].to_i, \n :tags => tags.downcase.split().join(','),\n :sort => flickerize_sort(params[:sort_by]),\n :extras => \"tags, date_upload\"}\n flickr_response = server.call(\"flickr.photos.search\", flickr_arguments)\n flickr_response = @ic.iconv(flickr_response)\n document = REXML::Document.new flickr_response\n rescue Exception => e\n puts \"Fehler beim Flickrrequest: #{e.to_s}\"\n document = REXML::Document.new\n else\n #the response dependent attributes\n resource_list = General::ResourceList.new(:tagging_system => self,\n :resources => Array.new,\n :total_pages => document.root.attributes[\"pages\"].to_i,\n :total_results => document.root.attributes[\"total\"].to_i,\n :actual_page => params[:page].to_i)\n if document.root.has_elements?\n #get the resourceproperties\n document.root.each_element do |photo|\n photo_id = photo.attributes[\"id\"]\n photo_title = photo.attributes[\"title\"]\n photo_upload_date = human_time(photo.attributes[\"dateupload\"])\n photo_tags = photo.attributes[\"tags\"].downcase.split\n # resource url relevant properties\n photo_farm = photo.attributes[\"farm\"]\n photo_server = photo.attributes[\"server\"]\n photo_secret = photo.attributes[\"secret\"]\n photo_description = nil\n \n resource = General::Resource.new(:resource_id => photo_id,\n :title => photo_title,\n :upload_date => photo_upload_date,\n :tags => photo_tags,\n :description => photo_description,\n :list_thumb_url => get_url_for(photo_farm, photo_server, photo_id, photo_secret, \"t\"),\n :js_thumb_url => get_url_for(photo_farm, photo_server, photo_id, photo_secret, \"m\"))\n \n resource_list.resources.push(resource)\n end\n end\n return resource_list\n end\n end"
] |
[
"0.55413246",
"0.5264963",
"0.5183926",
"0.5049842",
"0.49332815",
"0.48925203",
"0.48829582",
"0.48625067",
"0.48625067",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48176304",
"0.47612125",
"0.4760161",
"0.46976382",
"0.46687907",
"0.46677804",
"0.46482626",
"0.46225554",
"0.46166337",
"0.45992902",
"0.45861816",
"0.4583891",
"0.45626453",
"0.45474353",
"0.45438138",
"0.4537605",
"0.4537071",
"0.45327085",
"0.45247096",
"0.45218801",
"0.45164925",
"0.45052293",
"0.44983816",
"0.4488083",
"0.4481836",
"0.44793555",
"0.447805",
"0.44680545",
"0.44670486",
"0.44469985",
"0.4443658",
"0.44328818",
"0.44283548",
"0.44251132",
"0.4410158",
"0.43905032",
"0.43904123",
"0.43893585",
"0.43882757",
"0.43867856",
"0.43823603",
"0.43784857",
"0.43720543",
"0.43483517",
"0.43481585",
"0.4343141",
"0.43363598",
"0.43337542",
"0.4308943",
"0.43081003",
"0.43049577",
"0.4302234",
"0.4294175",
"0.4293893",
"0.42892474",
"0.42880243",
"0.42877755",
"0.42853117",
"0.42813548",
"0.4277385",
"0.42745322",
"0.42703894",
"0.42692968",
"0.42687717",
"0.42596883",
"0.42579043",
"0.4256149",
"0.4254117",
"0.42480487",
"0.4247472",
"0.42454293",
"0.42367807",
"0.4232359",
"0.42311117",
"0.4228957",
"0.42235413",
"0.42208293",
"0.42204362",
"0.4216071",
"0.42125306",
"0.42117855",
"0.42091155",
"0.4208941",
"0.4208941",
"0.42053023",
"0.4204874"
] |
0.60995173
|
0
|
Look up an array of the first count batchUrns with the specified customer PO. NOTE: Only one customerPO can be specified. Output parameters batchUrns (array of string, `urn:uuid:smartracgroup:batch:99990001`) ... Array of batch URNs
|
def get_query_batches(customer_po,
count = 100000)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/queryBatches'
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
'customerPO' => customer_po,
'count' => count
}
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json'
}
# prepare and execute HttpRequest
_request = @http_client.get _query_url, headers: _headers
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return QueryBatchesResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def batch_path\n if @discovery_document['batchPath']\n return @batch_path ||= (\n self.document_base.join(Addressable::URI.parse('/' +\n @discovery_document['batchPath']))\n ).normalize\n else\n return nil\n end\n end",
"def send_batch(batch)\n smarty_request = Request.new\n\n return if batch.empty?\n\n converted_lookups = remap_keys(batch.all_lookups)\n\n if batch.size > 1\n smarty_request.payload = @serializer.serialize(converted_lookups)\n else\n smarty_request.parameters = converted_lookups[0]\n end\n\n response = @sender.send(smarty_request)\n\n raise response.error if response.error\n\n candidates = @serializer.deserialize(response.payload)\n candidates = [] if candidates.nil?\n\n assign_candidates_to_lookups(batch, candidates)\n end",
"def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end",
"def findClothesWithBatchFolder(num,batch_folder)\n clothes =[]\n Clothing.where(number: num).each do |clothing|\n clothing.batch_information.each do |batch_type|\n if batch_type.include?(batch_folder)\n clothes.push(clothing)\n break\n end\n end\n end\n return clothes\n end",
"def batch_retrieve_orders(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/batch-retrieve',\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 fetch_batch(ids)\n # ids must be complete CNs\n filter = nil\n ids.each do |id|\n filter = if filter.nil?\n obj_filter(id)\n else\n filter | obj_filter(id)\n end\n end\n admin_ldap.search(base: @base, filter: filter)\n end",
"def read_batch(batch_input_string, opts = {})\n data, _status_code, _headers = read_batch_with_http_info(batch_input_string, opts)\n data\n end",
"def read_batch(batch_input_string, opts = {})\n data, _status_code, _headers = read_batch_with_http_info(batch_input_string, opts)\n data\n end",
"def find_batchid\n if facility.client.name.upcase == \"QUADAX\"\n method = \"get_batchid\"\n method << \"_#{@client_sym}\"\n batchid = send(method)\n return batchid\n else\n batchid_position = conf['BATCH']['batchid']\n batch_date_position = conf['BATCH']['date']\n batch_date = Date.rr_parse(parse(batch_date_position[0]..batch_date_position[1]),true).strftime(\"%m%d%Y\")\n \"#{parse(batchid_position[0]..batchid_position[1])}_#{batch_date}\"\n end\n end",
"def get_orders_batch(order_batch, opts = {})\n data, _status_code, _headers = get_orders_batch_with_http_info(order_batch, opts)\n data\n end",
"def retrieve_all_items(batch)\n unless batch.is_a?(Hash) && batch.has_key?(\"data\") && batch[\"data\"].is_a?(Hash) && batch[\"data\"].has_key?(\"items\")\n raise \"jawbone_up_api retrieve_all_items() was given a bad batch: #{batch}\"\n end\n\n items = batch[\"data\"][\"items\"]\n while batch[\"data\"].has_key?(\"links\") do\n unless batch[\"data\"][\"links\"].has_key?(\"next\")\n raise \"jawbone_up_api retrieve_all_items() has links but no next: #{batch}\"\n end\n batch = get_path(batch[\"data\"][\"links\"][\"next\"])\n items += batch[\"data\"][\"items\"]\n end\n\n items\n end",
"def get_orders_batch_with_http_info(order_batch, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders_batch ...'\n end\n # verify the required parameter 'order_batch' is set\n if @api_client.config.client_side_validation && order_batch.nil?\n fail ArgumentError, \"Missing the required parameter 'order_batch' when calling OrderApi.get_orders_batch\"\n end\n # resource path\n local_var_path = '/order/orders/batch'\n\n # query parameters\n query_params = {}\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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(order_batch)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch_retrieve_inventory_counts(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/inventory/counts/batch-retrieve',\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 get_batch_id(batch_token)\n return if batch_token.blank?\n batch_id = batch_token.first.split('/').last\n batch_id\n end",
"def soapFetchBatch(dbName, idListStr, formatName, styleName)\n printDebugMessage('soapFetchBatch', 'Begin', 1)\n soapConnect\n res = @soap.fetchBatch({\n 'db' => dbName,\n 'ids' => idListStr, \n 'format' => formatName,\n 'style' => styleName\n })\n if(2 <= @debugLevel)\n p res\n end\n printDebugMessage('soapFetchBatch', 'End', 1)\n return res['fetchBatchReturn']\n end",
"def documents_batch_details(guids)\n get \"/api/documents/#{guids.join(',')}/batch_details.xml\"\n end",
"def lookup(batch)\n req = Vacuum.new key: 'AKIAJA2IADZPBGHJTZRQ',\n secret: '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',\n tag: @tag,\n locale: 'us'\n \n \n params = { 'Operation' => 'ItemLookup',\n 'SearchIndex' => 'Books',\n 'ItemLookup.Shared.IdType' => 'ISBN',\n 'ItemLookup.Shared.Condition' => 'All',\n 'ItemLookup.Shared.MerchantId' => 'All',\n 'ItemLookup.Shared.ResponseGroup' => 'OfferFull'}\n \n batch.each_with_index do |item,index|\n params['ItemLookup.'+(index+1).to_s+'.ItemId'] = item\n end\n req.build params\n \n res = req.get\n items = []\n if res.valid?\n res.to_hash['Items'].each do |item|\n prod = {}\n prod['ASIN'] = item['Item']['ASIN']\n prod['New Price'] = item['Item']['OfferSummary']['LowestNewPrice']['FormattedPrice']\n prod['Used Price'] = item['Item']['OfferSummary']['LowestUsedPrice']['FormattedPrice']\n prod['url'] = \"http://www.amazon.com/dp/\"+prod['ASIN']+'/?tag='+@tag\n items << prod\n end\n end\n #puts res.to_hash.to_json\n items\nend",
"def getbulk(oids, args = {})\n request = SnmpGetBulkRequest.new(self, oids, args.merge(:version => :SNMPv2c))\n SnmpConnection.pending_requests << request\n return request\n end",
"def batch_params\n params[:batch]\n end",
"def find_pending(job, batch)\n sql = \"Select * from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and (status = 'queued' or status = 'running' );\"\n job_run_query(sql)\n end",
"def find_in_batches(options = {}, &block)\n options = MassiveRecord::Adapters::Thrift::Table.warn_and_change_deprecated_finder_options(options)\n\n options[:batch_size] ||= 1000\n\n if loaded?\n collection = if options[:starts_with]\n proxy_target.select { |r| r.id.starts_with? options[:starts_with] }\n else\n proxy_target\n end\n collection.in_groups_of(options[:batch_size], false, &block)\n elsif find_with_proc?\n find_proxy_target_with_proc(options.merge(:finder_method => :find_in_batches), &block)\n else\n all_ids = proxy_owner.send(metadata.foreign_key)\n all_ids = all_ids.select { |id| id.starts_with? options[:starts_with] } if options[:starts_with]\n all_ids.in_groups_of(options[:batch_size]).each do |ids_in_batch|\n yield Array(find_proxy_target(:ids => ids_in_batch))\n end\n end\n end",
"def process_batch(batch)\n call([], :process_batch, batch.__calls)\n end",
"def batch(*requests)\n Batch.new(requests)\n end",
"def batch_job_status_url\n return if job_description.blank?\n\n job_hash = JSON.parse(job_description)\n if job_hash && job_hash['jobId']\n AwsUtil.get_batch_job_url(job_hash['jobQueue'], job_hash['jobId'])\n end\n end",
"def find_in_batches(batch_size: 1000)\n unless block_given?\n return to_enum(:find_in_batches, batch_size: batch_size) do\n total = limit(1).find_some.metadata.data_info.found_count\n (total - 1).div(batch_size) + 1\n end\n end\n\n offset = 1 # DAPI offset is 1-based\n\n loop do\n relation = offset(offset).limit(batch_size)\n\n records = relation.find_some\n\n yield records if records.length > 0\n\n break if records.length < batch_size\n\n # Save one iteration if the total is a multiple of batch_size\n if found_count = records.metadata.data_info && records.metadata.data_info.found_count\n break if found_count == (offset - 1) + batch_size\n end\n\n offset += batch_size\n end\n end",
"def batch_reads(client, key_prefix, bin_name,\tsize)\n # Batch gets into one call.\n keys = []\n (0...size).each do |i|\n keys << Key.new(Shared.namespace, Shared.set_name, key_prefix+(i+1).to_s)\n end\n\n records = client.batch_get(keys, [bin_name])\n\n\n (0...records.length).each do |i|\n key = keys[i]\n record = records[i]\n\n level = :err\n if record\n level = :info\n value = record.bins[bin_name]\n end\n\n log(level, \"Record: ns=#{key.namespace} set=#{key.set_name} key=#{key.user_key} bin=#{bin_name} value=#{value}\")\n end\n\n if records.length != size\n Shared.logger.fatal(\"Record size mismatch. Expected #{size}. Received #{records.length}.\")\n exit\n end\nend",
"def batch\n req = create_batch_request\n if block_given?\n yield req\n req.execute\n else\n req\n end\n end",
"def get_query_tags(batch_urn, \n count = 100000)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/queryTags'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'batchUrn' => batch_urn,\n 'count' => count\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json'\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return QueryTagsResponseModel.from_hash(decoded)\n end",
"def batch_retrieve_inventory_counts(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/inventory/batch-retrieve-counts'\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 get_job_results(batch_job_url)\n @api.utils_reporter.batch_job_utils_used()\n xml_response = AdsCommon::Http.get_response(batch_job_url, @api.config)\n begin\n return sanitize_result(\n get_nori().parse(xml_response.body)[:mutate_response][:rval])\n rescue\n return nil\n end\n end",
"def batch_iterator\n Unipept::BatchIterator.new(batch_size)\n end",
"def find_batchid\n if @version == 'BANK_OF_AMERICA'\n if @new_batch_flag == 1\n InputBatch.get_batchid\n else\n batch = Batch.find(:last,:conditions=>\"client_id = #{client.id} and file_name = '#{@zip_file_name}'\")\n if !batch.blank?\n batch.batchid\n else\n InputBatch.get_batchid\n end\n end\n else\n get_batchid_general\n end\n end",
"def batch_bundle\r\n return @batch_bundle if @batch_bundle\r\n grouping = widest_grouping(\"Output\")\r\n if ['by_batch_date', 'by_cut','by_lockbox_cut','by_cut_and_payerid', \"nextgen_grouping\",\r\n 'by_payer_id_by_batch_date','by_payer_by_batch_date','by_cut_and_extension','by_output_payer_id_by_batch_date'].include? grouping\r\n @batch_bundle = Batch.send(grouping, self)\r\n else\r\n @batch_bundle = [self]\r\n end\r\n end",
"def next_batch!(queue)\n conditions = {:run_at.lte => Time.now.utc}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n batch_entries = all(conditions.merge(:fields => [:id], :limit => queue.batch_size, :order => [:priority.desc, :run_at]))\n queue_entry_ids = batch_entries.collect{|entry| entry.id}\n return [] if queue_entry_ids.empty?\n lock = rand(0x7FFFFFFF)\n all(:id => queue_entry_ids).update!(:run_at => Time.now.utc + queue.retry_interval, :lock => lock, :error => nil)\n all(:id => queue_entry_ids, :lock => lock)\n end",
"def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end",
"def get_bulk_send_jobs(opts={})\n path = '/bulk_send_job/list'\n path += opts[:page] ? \"?page=#{opts[:page]}\" : ''\n path += opts[:page_size] ? \"&page_size=#{opts[:page_size]}\" : ''\n HelloSign::Resource::ResourceArray.new get(path, opts), 'bulk_send_jobs', HelloSign::Resource::BulkSendJob\n end",
"def batch_id\n @batch && @batch.id\n end",
"def process!(config, sub_batch)\n return if sub_batch.empty?\n opts = {}\n opts[:request_items] = {config.table_name => sub_batch}\n begin\n response = config.dynamo_db_client.batch_write_item(opts)\n opts[:request_items] = response[:unprocessed_items]\n end until opts[:request_items].empty?\n end",
"def create_batch(batch_input_blog_author, opts = {})\n data, _status_code, _headers = create_batch_with_http_info(batch_input_blog_author, opts)\n data\n end",
"def find_batchid\r\n method = \"get_batchid\"\r\n if self.methods.include?(\"#{method}_#{@fac_sym}\".to_sym)\r\n method << \"_#{@fac_sym}\"\r\n elsif self.methods.include?(\"#{method}_#{@client_sym}\".to_sym)\r\n method << \"_#{@client_sym}\"\r\n end\r\n batchid = send(method)\r\n return batchid\r\n end",
"def retrieve_label_uris\n uris = []\n i = 0\n total = count\n batchsize = 10_000\n until i > total\n result = client.query(%(\n #{sparql_prefixes}\n SELECT distinct ?label\n WHERE {\n #{where_statements}\n }\n LIMIT #{batchsize}\n OFFSET #{i}\n ))\n uris += result.map { |r| \"<#{r['label'].value}>\" }\n i += batchsize\n end\n uris\n end",
"def read_batch_with_http_info(batch_input_string, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlogPostsApi.read_batch ...'\n end\n # verify the required parameter 'batch_input_string' is set\n if @api_client.config.client_side_validation && batch_input_string.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_string' when calling BlogPostsApi.read_batch\"\n end\n # resource path\n local_var_path = '/cms/v3/blogs/posts/batch/read'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(batch_input_string)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseBlogPost'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"BlogPostsApi.read_batch\",\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: BlogPostsApi#read_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def handle_response(r, session, job, request, data)\n # handle_response will get customers in groups of 100. When this is 0, we're done.\n complete = r['xml_attributes']['iteratorRemainingCount'] == '0'\n\n # if no customer updates occured we skip this.\n if r['invoice_ret']\n\n# We will then loop through each customer and create records.\n r['invoice_ret'].each do |qb_inv|\n invoice_data = {}\n invoice_data[:txn_id] = qb_inv['txn_id']\n invoice_data[:invoice_number] = qb_inv['txn_number']\n invoice_data[:c_edit] = qb_inv['edit_sequence']\n invoice_data[:c_date] = qb_inv['txn_date']\n\n if qb_inv['po_number']\n invoice_data[:c_po] = qb_inv['po_number']\n end\n\n if qb_inv['customer_ref']\n invoice_data[:customer_id] = Customer.find_by(list_id: qb_inv['customer_ref']['list_id']).id\n invoice_data[:c_name] = qb_inv['customer_ref']['full_name']\n end\n \n if qb_inv['ship_address']\n invoice_data[:c_ship1] = qb_inv['ship_address']['addr1']\n invoice_data[:c_ship2] = qb_inv['ship_address']['addr2']\n invoice_data[:c_ship3] = qb_inv['ship_address']['addr3']\n invoice_data[:c_ship4] = qb_inv['ship_address']['addr4']\n invoice_data[:c_ship5] = qb_inv['ship_address']['addr5']\n invoice_data[:c_shipcity] = qb_inv['ship_address']['city']\n invoice_data[:c_shipstate] = qb_inv['ship_address']['state']\n invoice_data[:c_shippostal] = qb_inv['ship_address']['postal_code']\n invoice_data[:c_shipcountry] = qb_inv['ship_address']['country']\n end\n \n if qb_inv['sales_rep_ref']\n invoice_data[:c_rep] = qb_inv['sales_rep_ref']['full_name']\n end\n \n invoice_ref = Order.find_by txn_id: invoice_data[:txn_id]\n if invoice_ref.blank?\n Order.create(invoice_data)\n \n elsif invoice_ref.updated_at < qb_inv['time_modified']\n invoice_ref.update(invoice_data)\n else\n Rails.logger.info(\"Invoice hasn't been changed\")\n end\n \n # This will be for the line item section\n if qb_inv['invoice_line_ret']\n # binding.pry\n \n qb_inv['invoice_line_ret'].each do |li|\n # We need to match the lineitem with order id\n li_data = {}\n\n invoice_ref2 = Order.find_by txn_id: invoice_data[:txn_id]\n li_data[:order_id] = invoice_ref2[:id]\n \n# It's still breaking in here somehwere. Nil Nilclass, \n\n if li != {\"xml_attributes\"=>{}}\n if li['item_ref']\n # binding.pry\n list_id = li['item_ref']['list_id']\n if Item.find_by(list_id: list_id).present?\n li_data[:item_id] = Item.find_by(list_id: list_id).id\n# It doesn't match, or isn't an inventory item, add it to other\n else\n # 87 represents an other item\n li_data[:item_id] = 87\n end \n\n li_data[:product_name] = li['item_ref']['full_name']\n end\n end\n \n if li['description']\n li_data[:description] = li['description']\n end\n # Does the line item have a quantity\n li_data[:qty] = li['quantity'].nil? ? nil : li['quantity'].to_i\n # Does this li have an amount?\n li_data[:amount] = li['amount'].nil? ? nil : li['amount'].to_f\n \n if li['inventory_site_ref']\n site_id = li['inventory_site_ref']['list_id']\n li_data[:site_id] = Site.find_by(list_id: site_id).id\n li_data[:site_name] = li['inventory_site_ref']['full_name']\n end\n\n \n # Now we need to record these line items\n li_ref = LineItem.find_by txn_id: li['txn_line_id']\n if li_ref.blank?\n LineItem.create(li_data)\n \n elsif li_ref.updated_at < qb_inv['time_modified']\n li_ref.update(li_data)\n else\n Rails.logger.info(\"Invoice hasn't been changed\")\n end\n \n\n end\n\n \n end\n end\nend\nend",
"def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end",
"def find_access_token_in_batches(relation, **args, &block)\n relation.find_in_batches(**args, &block)\n end",
"def find(job, batch)\n sql = \"Select * from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}';\"\n job_run_query(sql)\n end",
"def create_batch(batch_input_blog_post, opts = {})\n data, _status_code, _headers = create_batch_with_http_info(batch_input_blog_post, opts)\n data\n end",
"def read_batch_with_http_info(batch_input_string, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.read_batch ...'\n end\n # verify the required parameter 'batch_input_string' is set\n if @api_client.config.client_side_validation && batch_input_string.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_string' when calling BlogAuthorsApi.read_batch\"\n end\n # resource path\n local_var_path = '/cms/v3/blogs/authors/batch/read'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(batch_input_string)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseBlogAuthor'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"BlogAuthorsApi.read_batch\",\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: BlogAuthorsApi#read_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def bulk_oclc_query(oclc_nos)\n string = \"srw.no any \\\"#{oclc_nos.first}\\\"\"\n oclc_nos[1..-1].each do |num|\n string << \" or srw.no any \\\"#{num}\\\"\"\n end\n string\nend",
"def process_batch_with_http_info(batch_id, process_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.process_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.process_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.process_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'process_batch_request_body' is set\n if @api_client.config.client_side_validation && process_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'process_batch_request_body' when calling BatchesApi.process_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/process/labels'.sub('{' + 'batch_id' + '}', CGI.escape(batch_id.to_s))\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'])\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(process_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\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: BatchesApi#process_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def job_discovery_batch_create_jobs project_id:, company_name:\n # [START job_discovery_batch_create_jobs]\n # project_id = \"Id of the project\"\n # company_name = \"The resource name of the company listing the job. The format is \"projects/{project_id}/companies/{company_id}\"\"\n\n require \"google/apis/jobs_v3\"\n\n jobs = Google::Apis::JobsV3\n talent_solution_client = jobs::CloudTalentSolutionService.new\n # @see https://developers.google.com/identity/protocols/application-default-credentials#callingruby\n talent_solution_client.authorization = Google::Auth.get_application_default(\n \"https://www.googleapis.com/auth/jobs\"\n )\n\n jobs_created = []\n job_generated1 = jobs::Job.new requisition_id: \"Job: #{company_name} 1\",\n title: \" Lab Technician\",\n company_name: company_name,\n employment_types: [\"FULL_TIME\"],\n language_code: \"en-US\",\n application_info:\n (jobs::ApplicationInfo.new uris: [\"http://careers.google.com\"]),\n description: \"Design and improve software.\"\n job_generated2 = jobs::Job.new requisition_id: \"Job: #{company_name} 2\",\n title: \"Systems Administrator\",\n company_name: company_name,\n employment_types: [\"FULL_TIME\"],\n language_code: \"en-US\",\n application_info:\n (jobs::ApplicationInfo.new uris: [\"http://careers.google.com\"]),\n description: \"System Administrator for software.\"\n\n create_job_request1 = jobs::CreateJobRequest.new job: job_generated1\n create_job_request2 = jobs::CreateJobRequest.new job: job_generated2\n\n talent_solution_client.batch do |client|\n client.create_job project_id, create_job_request1 do |job, err|\n if err.nil?\n jobs_created.push job\n else\n puts \"Batch job create error message: #{err.message}\"\n end\n end\n client.create_job project_id, create_job_request2 do |job, err|\n if err.nil?\n jobs_created.push job\n else\n puts \"Batch job create error message: #{err.message}\"\n end\n end\n end\n # jobCreated = batchCreate.create_job(project_id, create_job_request1)\n puts \"Batch job created: #{jobs_created.to_json}\"\n jobs_created\n # [END job_discovery_batch_create_jobs]\nend",
"def register_batch_request_with_http_info(batch_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationConfigurationNSXManagersAPIServicesAPIRequestBatchingApi.register_batch_request ...'\n end\n # verify the required parameter 'batch_request' is set\n if @api_client.config.client_side_validation && batch_request.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_request' when calling SystemAdministrationConfigurationNSXManagersAPIServicesAPIRequestBatchingApi.register_batch_request\"\n end\n # resource path\n local_var_path = '/batch'\n\n # query parameters\n query_params = {}\n query_params[:'atomic'] = opts[:'atomic'] if !opts[:'atomic'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(batch_request)\n auth_names = ['BasicAuth']\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 => 'BatchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationConfigurationNSXManagersAPIServicesAPIRequestBatchingApi#register_batch_request\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def register_batch_request(batch_request, opts = {})\n data, _status_code, _headers = register_batch_request_with_http_info(batch_request, opts)\n data\n end",
"def batch_responses\n return [@result] unless @batch_response\n # if batch response, generate array based on the response hash.\n @result.map do |r|\n next r unless r.is_a?(Hash)\n hash = r[SUCCESS] || r[ERROR]\n Parse::Response.new hash\n end\n end",
"def make_batch \n batch = (0...@opts[:batch_size]).to_a.map do |i|\n { :depth=> 0 }\n end\n \n return batch\n end",
"def chimp_batch_subscribe(batch, email_content_type=\"html\", double_optin=true, update_existing=true, replace_interests=false)\n begin\n @client.call(\"listBatchSubscribe\", @api_key, @mailing_list_id, batch, double_optin, update_existing, replace_interests)\n rescue XMLRPC::FaultException => e\n raise MailChimpAPI::CreateError, e.faultString\n end \n end",
"def student_batch_names student_rec, report_hash = nil\n report_hash ||= @report_hash\n batch_ids = student_rec.batch_ids.split(\",\").map(&:to_i)\n batch_ids.inject([]) do |batch_names, b_id|\n batch_names << report_hash[:batches][b_id].try(:last).full_name\n batch_names\n end.join(\",\")\n end",
"def batch_params\n params.require(:batch).permit(:item_id, :user_id, :count)\n end",
"def next_batch()\n @mutex.lock\n begin\n state_check.slice!(0, state_check.length) + pending.slice!(0,pending.length)\n ensure\n @mutex.unlock rescue nil\n end\n end",
"def write(sub_batch)\n sub_batch.inject([]) do |rqst_array, item|\n rqst_array << {:delete_request => {:key => item}}\n rqst_array\n end\n end",
"def serialize_in_batches(collection, serializer)\n collection.find_in_batches(batch_size: 50).each_with_object([]) do |batch, arr|\n arr << batch.map { |resource| serializer.new(resource).serialize.compact }\n end.flatten\n end",
"def batch\n # conditions => in Url item should be available\n # Url generated from Js script function => getbatch() of _form.html.erb file under Views of different controllers\n @batch = Stock.where('item_name = ? and user_id = ?' , params[:name], current_user.id).distinct.pluck(:batch_number )\n # send batch_number in form of json\n render json: @batch\n end",
"def next_batch!(queue)\n conditions = [\"#{connection.quote_column_name('run_at')} <= ?\", Time.now.utc]\n unless queue.class_names.empty?\n conditions.first << \" AND #{connection.quote_column_name('record_class_name')} IN (?)\"\n conditions << queue.class_names\n end\n batch_entries = all(:select => \"id\", :conditions => conditions, :limit => queue.batch_size, :order => 'priority DESC, run_at')\n queue_entry_ids = batch_entries.collect{|entry| entry.id}\n return [] if queue_entry_ids.empty?\n lock = rand(0x7FFFFFFF)\n update_all({:run_at => queue.retry_interval.from_now.utc, :lock => lock, :error => nil}, :id => queue_entry_ids)\n all(:conditions => {:id => queue_entry_ids, :lock => lock})\n end",
"def execute_batch(aggregated_input, batch)\n executor = AsyncTaskExecutor.new(batch, container: container)\n executor.call(aggregated_input)\n end",
"def batch_retrieve_orders(location_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/locations/{location_id}/orders/batch-retrieve'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'location_id' => location_id\n )\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 batch_size_for(value, items = nil)\n batch = batch_option(value) or return\n batch = [batch, MAX_BATCH].min\n batch = [batch, items.size].min if (items &&= extract_items(items))\n batch unless batch < MIN_BATCH\n end",
"def find_all_by_ncbi_id_or_fetch!(ncbi_ids)\n found_locally = where(:ncbi_id.in => ncbi_ids)\n ids_not_found_locally = ncbi_ids.map(&:to_i) - found_locally.map(&:ncbi_id)\n fetch_in_batches!(50, ids_not_found_locally) if ids_not_found_locally.any?\n # found_locally is a Mongoid::Criteria object.\n # Since we are fetch!-ing, the new objects are being stored in the DB.\n # Criteria will query the DB each time it is accessed.\n # So now all should be \"found locally\".\n found_locally\n end",
"def processed_batches(w)\n dir = join(@basedir, DIR_PROCESSED)\n w.sftp.dir[dir, '*'].map do |entry|\n Model::Batch.new(:path => join(dir, entry.name), :state => :processed)\n end\n end",
"def report_bulk_objects(filter = nil, sort = nil)\n res = query(\"report-bulk-objects\", \"filter\" => filter, \"sort\" => sort)\n data = XmlSimple.xml_in(res.body)\n rows = []\n if data[\"report-bulk-objects\"]\n data[\"report-bulk-objects\"].each do |trans|\n rows = trans[\"row\"]\n end\n end\n return AdobeConnectAPI::Result.new(data[\"status\"][0][\"code\"], rows)\n end",
"def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend",
"def get_startups(ids)\n params = { :ids => ids.join(',') }\n get(\"1/startups/batch\", params)\n end",
"def batch\n job && job.batch\n end",
"def initialize_url(batch_job_url)\n headers = DEFAULT_HEADERS\n headers['Content-Length'] = 0\n headers['x-goog-resumable'] = 'start'\n\n response = AdsCommon::Http.post_response(\n batch_job_url, '', @api.config, headers)\n\n return response.headers['Location']\n end",
"def fetch_receipt_config category\n # multi_configs = FinanceTransactionCategory.get_multi_configuration\n multi_configs = category.present? ? category.get_multi_config : {}\n return default_receipt_config if !(multi_configs.present? and multi_configs[:receipt_set].present?)\n return [multi_configs[:receipt_set].try(:sequence_prefix), multi_configs[:receipt_set].try(:starting_number)]\n end",
"def set_batch\n @batch = Batch.find(params[:id]) unless params[:id].to_i.zero?\n @batch = Batch.find(params[:batch_id]) unless params[:batch_id].to_i.zero?\n end",
"def create\n batch = Batch.new(batch_params)\n # Setting reference number\n batch[:reference_batch] = Faker::Code.nric\n\n # Getting all orders for purchase_channel\n orders = Order.where(\"purchase_channel = ?\", batch[:purchase_channel_batch])\n if batch.save\n # Setting batch id in orders\n orders.update(batch_id: batch[:id])\n # Changing orders status\n orders.update(status: Order.statuses['production'])\n\t\t\t\t\trender json: {status: 'SUCCESS', message: 'Saved Batch', number_of_orders_in_batch: orders.size, data: batch}, status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Batch not saved', data:batch.errors}, status: :unprocessable_entity\n\t\t\t\tend\n end",
"def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end",
"def post(batch)\n last_response, exception = retry_with_backoff(@retries) do\n status_code, body, message = send_request(batch)\n\n should_retry = should_retry_request?(status_code, body)\n\n [Response.new(status_code, message), should_retry]\n end\n\n if exception\n logger.error(exception.message)\n exception.backtrace.each { |line| logger.error(line) }\n Response.new(-1, \"Connection error: #{exception}\")\n else\n last_response\n end\n end",
"def requested_records\n num = request_header.fetch(:replacements, {}).fetch(config.requested_records_parameter, nil)\n num.present? ? num.to_i : I18n.t(\"qa.linked_data.search.default_requested_records\")\n end",
"def restFetchBatch(dbName, idListStr, formatName='default', styleName='default')\n printDebugMessage('restFetchBatch', 'Begin', 1)\n url = \"#{baseUrl}/#{dbName}/#{idListStr}/#{formatName}?style=#{styleName}\"\n retVal = restRequest(url)\n printDebugMessage('restFetchBatch', 'End', 1)\n return retVal\n end",
"def send_batch(batch)\n return if batch.empty?\n\n logger.debug(\"#{self.class.name}: sending batch of #{batch.size} to Solr\")\n\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n\n begin\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ?\n Traject::Util.exception_to_log_message(exception) :\n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n\n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def find_empty_batch\n batches.empty_batch\n end",
"def rugged_batch_by_oid(repo, oids)\n oids.map { |oid| rugged_find(repo, oid) }\n .compact\n .map { |commit| decorate(repo, commit) }\n end",
"def batch_iterate_users_with_notifications(params = {})\n per_batch = params.fetch(:batch_size, 1000)\n 0.step(users.count, per_batch) do |offset|\n users_batch = users.where(\"this.notifications && this.notifications.length > 0\").skip(offset).limit(per_batch)\n yield users_batch if block_given?\n end\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = arr_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n set_batch_time batch, arr_time\n if batch.date.blank?\n batch.date = facility.index_file_parser_type.to_s.downcase == 'boa_bank'? @@batch_date : Date.today\n end\n batch.correspondence = true if type == 'CORRESP'\n if !@corresp_flag\n last_batch = Batch.find(:last, :conditions => [\"file_name = ? \", @zip_file_name])\n last_batch_corresp = Batch.find(:last, :conditions => [\"file_name = ? and correspondence = 'true'\", @zip_file_name])\n @index_condition = ((type == 'CORRESP' and (!(last_batch.nil?)) and (last_batch_corresp.nil?)) or (type == 'CORRESP' and (!(last_batch.nil?)) and !(last_batch_corresp.nil?) and (last_batch.id>last_batch_corresp.id)))\n batch.index_batch_number = @index_condition ? (last_batch.index_batch_number.to_i + 1) : 2\n end\n batch.lockbox = batch.lockbox.split('-').last if batch.lockbox\n return batch\n end",
"def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ? \n Traject::Util.exception_to_log_message(exception) : \n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n \n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def update_batch(batch_input_json_node, opts = {})\n data, _status_code, _headers = update_batch_with_http_info(batch_input_json_node, opts)\n data\n end",
"def update_batch(batch_input_json_node, opts = {})\n data, _status_code, _headers = update_batch_with_http_info(batch_input_json_node, opts)\n data\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.list_batches ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/batches'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].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\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] || 'ListBatchesResponseBody' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\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: BatchesApi#list_batches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_batch_request(batch_client, resource_name, method_name, params = {})\n end",
"def batch_size\n if options[:batch]\n options[:batch].to_i\n else\n default_batch_size\n end\n end",
"def get_bulk(oids, options = {})\n each_session do |session|\n @pdu = session.get_bulk(oids)\n @pdu.print\n puts \"ERROR\" if @pdu.error?\n end\n \"GETBULK\"\n end",
"def find_summaries_by_ids(ids)\n @request = setup_request \"#{@@resource_url}s\"\n @request.query = { productLineIds: ids.to_s }\n @request\n end",
"def retrieve_batch_size_value(env)\n retrieve_integer_value('BATCH_SIZE', env)\n end",
"def archive_batch(batch_input_string, opts = {})\n archive_batch_with_http_info(batch_input_string, opts)\n nil\n end",
"def archive_batch(batch_input_string, opts = {})\n archive_batch_with_http_info(batch_input_string, opts)\n nil\n end",
"def batch_get(keys, bin_names = nil, options = nil)\n policy = create_policy(options, BatchPolicy, default_batch_policy)\n results = Array.new(keys.length)\n info_flags = INFO1_READ\n\n case bin_names\n when :all, nil, []\n info_flags |= INFO1_GET_ALL\n bin_names = nil\n when :none\n info_flags |= INFO1_NOBINDATA\n bin_names = nil\n end\n\n if policy.use_batch_direct\n key_map = BatchItem.generate_map(keys)\n execute_batch_direct_commands(policy, keys) do |node, batch|\n BatchDirectCommand.new(node, batch, policy, key_map, bin_names, results, info_flags)\n end\n else\n execute_batch_index_commands(policy, keys) do |node, batch|\n BatchIndexCommand.new(node, batch, policy, bin_names, results, info_flags)\n end\n end\n\n results\n end",
"def execute_batch(batch, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::CONTENT_TYPE => \"multipart/mixed; boundary=#{batch.batch_id}\",\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(options[:accept]),\n \"Accept-Charset\" => \"UTF-8\"\n }\n\n body = batch.to_body(self)\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:post, generate_uri(\"/$batch\", new_query(options), options), body, headers, options, true)\n batch.parse_response(response)\n rescue => e\n raise_with_response(e, response)\n end",
"def get_cancelled_eps(batch_limit, error_ids, conn)\n error_ids = error_ids.map { |s| \"'#{s}'\" }.join(', ')\n\n raw_sql = <<~SQL\n SELECT\n reference_id\n FROM\n end_product_establishments epe\n INNER JOIN\n vbms_ext_claim vec\n ON\n CAST(epe.reference_id AS numeric) = vec.\"CLAIM_ID\"\n WHERE\n vec.\"LEVEL_STATUS_CODE\" = 'CAN'\n AND\n vec.\"LEVEL_STATUS_CODE\" <> epe.synced_status\n AND\n epe.synced_status not in ('CLR', 'CAN')\n AND\n epe.reference_id NOT IN (#{error_ids})\n ORDER BY\n epe.id ASC\n LIMIT\n #{batch_limit}\n SQL\n\n conn.execute(raw_sql)\n end"
] |
[
"0.5252995",
"0.506197",
"0.49939978",
"0.4865306",
"0.47606206",
"0.47280714",
"0.47027403",
"0.47027403",
"0.4661356",
"0.46523502",
"0.4650074",
"0.46288314",
"0.4604309",
"0.4570969",
"0.45338106",
"0.44704163",
"0.4467058",
"0.44465417",
"0.44348732",
"0.44220415",
"0.44179946",
"0.4409145",
"0.4405803",
"0.43923494",
"0.43922347",
"0.43664253",
"0.43530166",
"0.43417186",
"0.4338382",
"0.43366045",
"0.4325753",
"0.4323451",
"0.43191105",
"0.43087518",
"0.4288959",
"0.42507774",
"0.42427742",
"0.42417607",
"0.42396867",
"0.42314598",
"0.42221034",
"0.4210467",
"0.41925964",
"0.41873467",
"0.41816375",
"0.41745058",
"0.4173131",
"0.41711938",
"0.41653934",
"0.41650048",
"0.41595256",
"0.41566613",
"0.4146825",
"0.41455883",
"0.41447133",
"0.4124521",
"0.4119445",
"0.41120118",
"0.41113293",
"0.41090623",
"0.4108809",
"0.41086304",
"0.41064146",
"0.4103922",
"0.40925774",
"0.40850285",
"0.40737826",
"0.4045159",
"0.4036188",
"0.40359506",
"0.40294284",
"0.40275666",
"0.40257388",
"0.4022761",
"0.40224358",
"0.401832",
"0.40152565",
"0.4010184",
"0.4002551",
"0.39942023",
"0.39937684",
"0.39921445",
"0.39919332",
"0.39907762",
"0.39853913",
"0.39833173",
"0.3980639",
"0.39772558",
"0.39751035",
"0.39597887",
"0.39596596",
"0.39540493",
"0.39492542",
"0.39485586",
"0.39460483",
"0.3944462",
"0.39428297",
"0.3940205",
"0.39390823",
"0.39390135"
] |
0.61496884
|
0
|
Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK minimum 1 tag found and result available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized Input HTTP Headers: HTTP Basic Authorization (as specified above) Input parameters tagIds (required, array of string, `E12345678912345678`) ... Array of RFID tag identifiers; max 1000 entries allowed verificationTypes (optional, array of string, `RR`) ... Array of verification types properties (optional, array of string, `plantId,batchId`) ... Array of requested properties Available tag properties Property ID | Data Type | Description | Availability | | | custId | String | Customer ID | available orderId | String | Order ID | available orderDate | Long | Order date | available orderQty | Number | Order quantity | available orderQtyU | String | Order quantity unit | available customerPO | String | Customer purchase order number | available customerName | String | Customer name | available supplPO | String | Supplier purchase order number | available delivId | String | Delivery ID | available delivDate | Long | Delivery date | available delivQty | Number | Delivery quantity | available delivQtyU | String | Delivery quantity unit | available batchId | String | Roll number / batch ID | available yield | Number | Batch yield [%] | available subRoll | String | Sub roll number / sub batch ID | available plantId | String | Manufacturer production side ID | available chipManuf | String | Chip manufacturer | available chipModel | String | Chip model | available inlayType | String | Inlay type | available inlayManufDate | Long | Inlay manufacturer date | available attenuation | Number | Attenuation in dB | available checkState | Number | 0=failed; 1=passed (default) | available Notes: Only available properties can be requested (check `Availability` column above) Same data is not available for all tags/batches There are additional properties planned in the future Output parameters code (Number, `0`) ... Indicates the result code of this call (see `result codes`) tagId according the requested `tagIds` tagCode (Number, `0`) ... Indicates if the result code for this tag (see `result codes for a tag actions`) verificationState according the requested `verificationTypes` properties according the requested `properties`
|
def create_get_tag_metadata(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/properties'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# prepare and execute HttpRequest
_request = @http_client.post _query_url, headers: _headers, parameters: body.to_json
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return GetTagMetadataResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_monkey_multi_enhanced_mip_setting_tags\n # Setup\n image1 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n image2 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n tags1 = {\n 'cover' => true,\n 'profile' => true,\n 'logo' => true,\n 'stock' => true\n }\n tags2 = {\n 'cover' => true,\n 'profile' => [true, false].sample,\n 'logo' => false,\n 'stock' => true\n }\n\n # Step 1\n params = {\n 'api_key' => @api_key,\n 'tags' => tags1\n }\n\n post \"/b_image/#{image1}/int_xxid/#{@int_xxid}\", params\n assert_response(@response, :success)\n\n get_images_from_int_xxids(@int_xxid)\n assert_response(@response, :success)\n assert_equal(2, @parsed_response['relations'].length, @parsed_response)\n\n image1_data = @parsed_response['relations'].find { |rel| rel['id'] == image1 }\n refute_nil(image1_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n image2_data = @parsed_response['relations'].find { |rel| rel['id'] == image2 }\n refute_nil(image2_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n\n tags1.each_key { |k|\n assert_includes(image1_data['tags'], k)\n refute_includes(image2_data['tags'], k)\n }\n\n # Step 2\n params = {\n 'api_key' => @api_key,\n 'tags' => tags2\n }\n\n post \"/b_image/#{image2}/int_xxid/#{@int_xxid}\", params\n assert_response(@response, :success)\n\n get_images_from_int_xxids(@int_xxid)\n assert_response(@response, :success)\n assert_equal(2, @parsed_response['relations'].length, @parsed_response)\n\n image1_data = @parsed_response['relations'].find { |rel| rel['id'] == image1 }\n refute_nil(image1_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n image2_data = @parsed_response['relations'].find { |rel| rel['id'] == image2 }\n refute_nil(image2_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n\n tags2.each do |k, v|\n if v\n if k == 'stock'\n assert_includes(image2_data['tags'], k)\n assert_includes(image1_data['tags'], k)\n else\n assert_includes(image2_data['tags'], k)\n refute_includes(image1_data['tags'], k)\n end\n else\n refute_includes(image2_data['tags'], k)\n assert_includes(image1_data['tags'], k)\n end\n end\n end",
"def remove_tags_with_http_info(identifier, tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.remove_tags ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.remove_tags\"\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling AlertApi.remove_tags\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/tags\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'user'] = opts[:'user'] if !opts[:'user'].nil?\n query_params[:'note'] = opts[:'note'] if !opts[:'note'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].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 = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#remove_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_tags_with_http_info(identifier, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.add_tags ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.add_tags\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AlertApi.add_tags\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/tags\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_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 = @api_client.object_to_http_body(body)\n auth_names = ['GenieKey']\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 => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#add_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_get_keys_used_for_tag_authentication(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/key'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n elsif _context.response.status_code == 404\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetKeysUsedForTagAuthenticationResponseModel.from_hash(decoded)\n end",
"def remove_tags_from_resource(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveTagsFromResource'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def test_uuid_as_optional()\n # Parameters for the API call\n body = UuidAsOptional.from_hash(APIHelper.json_deserialize(\n '{\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.uuid_as_optional(body)\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 test_uuid_as_optional()\n # Parameters for the API call\n body = UuidAsOptional.from_hash(APIHelper.json_deserialize(\n '{\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.uuid_as_optional(body)\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 endpoints_topology_tag_uuid_with_http_info(topotaguuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.endpoints_topology_tag_uuid ...'\n end\n # verify the required parameter 'topotaguuid' is set\n if @api_client.config.client_side_validation && topotaguuid.nil?\n fail ArgumentError, \"Missing the required parameter 'topotaguuid' when calling TopologiesApi.endpoints_topology_tag_uuid\"\n end\n # resource path\n local_var_path = '/eis/1.0.0/endpoints/topology_tag_uuid/{topotaguuid}'.sub('{' + 'topotaguuid' + '}', topotaguuid.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 => 'InlineResponse20014')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#endpoints_topology_tag_uuid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end",
"def api_response\n attrs.merge(@tag_ids_by_type).merge(\n {\n ingredients: @ingredients.reduce({}) { |h, i| h.merge(i.api_response) },\n priorities: @priority_tag_hash_array,\n ratings: @rating_tag_hash_array.select { |h| h[:tag_name].include? 'star' },\n comments: @comment_tag_hash_array\n }\n )\n end",
"def delete_tags(params)\n resources = []\n tags = {}\n\n params.each { |key, value|\n case key\n when /ResourceId\\./\n resources << case value\n when /ami\\-(.+)/\n image = ImageEC2.new(Image.build_xml($1), @client)\n rc = image.info\n if OpenNebula.is_error?(rc) || !image.ec2_ami?\n rc ||= OpenNebula::Error.new()\n rc.ec2_code = \"InvalidAMIID.NotFound\"\n return rc\n else\n image\n end\n when /vol\\-(.+)/\n image = ImageEC2.new(Image.build_xml($1), @client)\n rc = image.info\n if OpenNebula.is_error?(rc) || !image.ebs_volume?\n rc ||= OpenNebula::Error.new()\n rc.ec2_code = \"InvalidVolume.NotFound\"\n return rc\n else\n image\n end\n when /snap\\-(.+)/\n image = ImageEC2.new(Image.build_xml($1), @client)\n rc = image.info\n if OpenNebula.is_error?(rc) || !image.ebs_snapshot?\n rc ||= OpenNebula::Error.new()\n rc.ec2_code = \"InvalidSnapshot.NotFound\"\n return rc\n else\n image\n end\n when /i\\-(.+)/\n vm = VirtualMachine.new(VirtualMachine.build_xml($1), @client)\n rc = vm.info\n if OpenNebula.is_error?(rc)\n rc.ec2_code = \"InvalidInstanceID.NotFound\"\n return rc\n else\n vm\n end\n end\n when /Tag\\.(\\d+)\\.Key/\n tags[value] = params[\"Tag.#{$1}.Value\"] || \"\"\n end\n }\n\n resources.each {|resource|\n if resource.is_a?(VirtualMachine)\n template_key = \"USER_TEMPLATE\"\n elsif resource.is_a?(Image)\n template_key = \"TEMPLATE\"\n end\n\n tags.each { |key,value|\n resource.delete_element(\"#{template_key}/EC2_TAGS/#{key.upcase}\")\n }\n\n rc = resource.update(resource.template_like_str(template_key))\n return rc if OpenNebula::is_error?(rc)\n }\n\n erb_version = params['Version']\n\n response = ERB.new(File.read(@config[:views]+\"/delete_tags.erb\"))\n return response.result(binding), 200\n end",
"def update_tag_values(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/value'\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 = @http_client.put _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n elsif _context.response.status_code == 404\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return UpdateTagValuesResponseModel.from_hash(decoded)\n end",
"def get_v1_related_tags_with_http_info(tag_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_related_tags ...'\n end\n # verify the required parameter 'tag_list' is set\n if @api_client.config.client_side_validation && tag_list.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_list' when calling TagApi.get_v1_related_tags\"\n end\n # resource path\n local_var_path = '/v1/related-tags'\n\n # query parameters\n query_params = {}\n query_params[:'tag_list'] = tag_list\n query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?\n query_params[:'bucket'] = opts[:'bucket'] if !opts[:'bucket'].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 = ['api_key']\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 => 'RelatedTagResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_related_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_verify_tags_for_a_verification_type(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/verification/tags'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return VerifyTagsForAVerificationTypeResponseModel.from_hash(decoded)\n end",
"def get_v1_tags_with_http_info(tag_names_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_tags ...'\n end\n # verify the required parameter 'tag_names_list' is set\n if @api_client.config.client_side_validation && tag_names_list.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_names_list' when calling TagApi.get_v1_tags\"\n end\n # resource path\n local_var_path = '/v1/tags'\n\n # query parameters\n query_params = {}\n query_params[:'tag_names_list'] = tag_names_list\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 = ['api_key']\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 => 'TagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_tags_to_resource(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddTagsToResource'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_tag_with_http_info(project_name, repository_name, reference, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ArtifactApi.create_tag ...'\n end\n # verify the required parameter 'project_name' is set\n if @api_client.config.client_side_validation && project_name.nil?\n fail ArgumentError, \"Missing the required parameter 'project_name' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'repository_name' is set\n if @api_client.config.client_side_validation && repository_name.nil?\n fail ArgumentError, \"Missing the required parameter 'repository_name' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'reference' is set\n if @api_client.config.client_side_validation && reference.nil?\n fail ArgumentError, \"Missing the required parameter 'reference' when calling ArtifactApi.create_tag\"\n end\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling ArtifactApi.create_tag\"\n end\n if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"x_request_id\"]\" when calling ArtifactApi.create_tag, the character length must be great than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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 header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tag)\n auth_names = ['basic']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArtifactApi#create_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def topology_tag_uuid_get_with_http_info(topotaguuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_uuid_get ...'\n end\n # verify the required parameter 'topotaguuid' is set\n if @api_client.config.client_side_validation && topotaguuid.nil?\n fail ArgumentError, \"Missing the required parameter 'topotaguuid' when calling TopologiesApi.topology_tag_uuid_get\"\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag/{topotaguuid}/'.sub('{' + 'topotaguuid' + '}', topotaguuid.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 => 'Topology')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_uuid_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_v1_tags_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.post_v1_tags ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling TagApi.post_v1_tags\"\n end\n # resource path\n local_var_path = '/v1/tags'\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(body)\n auth_names = ['api_key']\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 => 'SetTagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#post_v1_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', '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] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def endpoints_topology_tag_uuid_endpoint_with_http_info(topotaguuid, endpointuuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.endpoints_topology_tag_uuid_endpoint ...'\n end\n # verify the required parameter 'topotaguuid' is set\n if @api_client.config.client_side_validation && topotaguuid.nil?\n fail ArgumentError, \"Missing the required parameter 'topotaguuid' when calling TopologiesApi.endpoints_topology_tag_uuid_endpoint\"\n end\n # verify the required parameter 'endpointuuid' is set\n if @api_client.config.client_side_validation && endpointuuid.nil?\n fail ArgumentError, \"Missing the required parameter 'endpointuuid' when calling TopologiesApi.endpoints_topology_tag_uuid_endpoint\"\n end\n # resource path\n local_var_path = '/eis/1.0.0/endpoints/topology_tag_uuid/{topotaguuid}/endpoint/{endpointuuid}'.sub('{' + 'topotaguuid' + '}', topotaguuid.to_s).sub('{' + 'endpointuuid' + '}', endpointuuid.to_s)\n\n # query parameters\n query_params = {}\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 = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#endpoints_topology_tag_uuid_endpoint\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tag_with_http_info(tag_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagsApi.get_tag ...\"\n end\n # verify the required parameter 'tag_id' is set\n fail ArgumentError, \"Missing the required parameter 'tag_id' when calling TagsApi.get_tag\" if tag_id.nil?\n # resource path\n local_var_path = \"/tags/{tagId}\".sub('{format}','json').sub('{' + 'tagId' + '}', tag_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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 = ['basicAuth']\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 => 'TagEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsApi#get_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_get_single_tag_code_message(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/message'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetSingleTagCodeMessageResponseModel.from_hash(decoded)\n end",
"def create_verify_tags_for_round_rock_compliance(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/verification/tags/RR'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return VerifyTagsForRoundRockComplianceResponseModel.from_hash(decoded)\n end",
"def create_tags_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.create_tags ...\"\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.create_tags\"\n end\n if @api_client.config.client_side_validation && account_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'account_id' when calling AccountsApi.create_tags, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/accounts/{accountId}/tags\".sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tagList'] = opts[:'tag_list'] if !opts[:'tag_list'].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 header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].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(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#create_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_v1_design_tags_with_http_info(design_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_design_tags ...'\n end\n # verify the required parameter 'design_id' is set\n if @api_client.config.client_side_validation && design_id.nil?\n fail ArgumentError, \"Missing the required parameter 'design_id' when calling TagApi.get_v1_design_tags\"\n end\n # resource path\n local_var_path = '/v1/design-tags'\n\n # query parameters\n query_params = {}\n query_params[:'design_id'] = design_id\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 = ['api_key']\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 => 'DesignTagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_design_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_get_application_data_from_tags(body)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/value'\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 = @http_client.post _query_url, headers: _headers, parameters: body.to_json\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n elsif _context.response.status_code == 404\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetApplicationDataFromTagsResponseModel.from_hash(decoded)\n end",
"def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end",
"def get_tags_with_http_info(payment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.get_tags ...\"\n end\n # verify the required parameter 'payment_id' is set\n if @api_client.config.client_side_validation && payment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_id' when calling PaymentsApi.get_tags\"\n end\n if @api_client.config.client_side_validation && payment_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'payment_id' when calling PaymentsApi.get_tags, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/payments/{paymentId}/tags\".sub('{' + 'paymentId' + '}', payment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'audit'] = opts[:'audit'] if !opts[:'audit'].nil?\n query_params[:'includedDeleted'] = opts[:'included_deleted'] if !opts[:'included_deleted'].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 => 'Array<TagJson>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#get_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def handleResponse(tag)\n if \"response\" == tag.name.downcase\n updateRate = tag.attributes[\"updateRate\"]\n syncRate = tag.attributes[\"syncRate\"]\n api.updateRate = updateRate.to_i if updateRate\n api.syncRate = syncRate.to_i if syncRate\n true\n else\n false\n end\n end",
"def get_learner_tags_with_http_info(learner_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LearnerApi.get_learner_tags ...'\n end\n # verify the required parameter 'learner_id' is set\n if learner_id.nil?\n fail ArgumentError, \"Missing the required parameter 'learner_id' when calling LearnerApi.get_learner_tags\"\n end\n # resource path\n local_var_path = '/learner/{learnerId}/tags'.sub('{' + 'learnerId' + '}', learner_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 = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\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 => 'TagListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LearnerApi#get_learner_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def post_v1_design_tags_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.post_v1_design_tags ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling TagApi.post_v1_design_tags\"\n end\n # resource path\n local_var_path = '/v1/design-tags'\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(body)\n auth_names = ['api_key']\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 => 'SetDesignsTagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#post_v1_design_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def show_tag_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagsApi.show_tag ...'\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 TagsApi.show_tag\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling TagsApi.show_tag, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/tags/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\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'])\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] || 'Tag' \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\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: TagsApi#show_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_tag_with_http_info(id, api_tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#add_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_tag\" if id.nil?\n \n # verify the required parameter 'api_tag' is set\n fail \"Missing the required parameter 'api_tag' when calling add_tag\" if api_tag.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/Tags\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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', 'text/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 = @api_client.object_to_http_body(api_tag)\n \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 => 'InlineResponse201')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#add_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def packages_tag_with_http_info(owner, repo, identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackagesApi.packages_tag ...\"\n end\n # verify the required parameter 'owner' is set\n if @api_client.config.client_side_validation && owner.nil?\n fail ArgumentError, \"Missing the required parameter 'owner' when calling PackagesApi.packages_tag\"\n end\n # verify the required parameter 'repo' is set\n if @api_client.config.client_side_validation && repo.nil?\n fail ArgumentError, \"Missing the required parameter 'repo' when calling PackagesApi.packages_tag\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling PackagesApi.packages_tag\"\n end\n # resource path\n local_var_path = \"/packages/{owner}/{repo}/{identifier}/tag/\".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\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(opts[:'data'])\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 => 'Package')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end",
"def create\n text = params[:text]\n lang_code = params[:lang]\n purchase_id = params[:purchase_id]\n\n # optional\n gender = params[:gender]\n auth_token = params[:auth_token]\n hardware_id = params[:hardware_id]\n hardware_type = params[:hardware_type]\n name = params[:name]\n parent_id = params[:parent_id]\n latitude = params[:lat]\n longitude = params[:lon]\n ble_major = params[:major]\n ble_minor = params[:minor]\n\n customer = nil\n\n error = []\n if text.nil?\n error << 'text'\n end\n\n if lang_code.nil?\n error << 'lang'\n end\n\n if purchase_id.nil?\n error << 'purchase_id'\n end\n\n # also require major und minor id by bluetooth beacons\n unless hardware_type.nil?\n if hardware_type == HardwaresHelper::TYPE_BLE\n if ble_major.nil?\n error << 'major'\n end\n\n if ble_minor.nil?\n error << 'minor'\n end\n end\n end\n\n if error.length > 0\n return_error_infos(400, 'Request values are missing', 'InvalidRequest', error)\n return\n end\n\n unless TranslationsHelper.is_valid_language(lang_code)\n return_error_infos(400, 'Wrong language code', 'WrongLanguageCode', nil)\n return\n end\n\n unless auth_token.nil?\n customer_token = params[:auth_token].presence\n customer = customer_token && Customer.find_by_auth_token(customer_token)\n\n if customer && Devise.secure_compare(customer.get_devise_auth_token, customer_token)\n sign_in customer, store: false\n end\n end\n\n status, tag, error_msg, error_code = Tag.create_with_data(text, lang_code, purchase_id, gender, hardware_id, hardware_type, ble_major, ble_minor, name, parent_id, latitude, longitude, customer)\n\n if status.nil?\n return_error_infos(400, 'Error while creating new tag', 'CreationError', nil)\n else\n if status != 200\n return_error_infos(status, error_msg, error_code, nil)\n else\n if lang_code.nil?\n return_tag_infos(tag, nil)\n else\n return_tag_infos(tag, lang_code)\n end\n end\n end\n end",
"def create_tags_with_http_info(payment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.create_tags ...\"\n end\n # verify the required parameter 'payment_id' is set\n if @api_client.config.client_side_validation && payment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_id' when calling PaymentsApi.create_tags\"\n end\n if @api_client.config.client_side_validation && payment_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'payment_id' when calling PaymentsApi.create_tags, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/payments/{paymentId}/tags\".sub('{' + 'paymentId' + '}', payment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tagList'] = opts[:'tag_list'] if !opts[:'tag_list'].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[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].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(: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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#create_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def process_response(public_request_id) \n\n # if data was received then \n unless @active_requests[public_request_id][:arduino_responses].empty? \n public_responses = []\n http_header = \"HTTP/1.1 200 OK\\r\\nContent-Type: application/json\\r\\n\\r\\n\"\n public_response = \"#{http_header}[\\r\\n\"\n\n # create a hash key with device/response pairs\n @active_requests[public_request_id][:arduino_responses].each do | device, response |\n response.match /.*?([\\[\\{].*[\\}\\]]+)/m\n public_responses << \"{\\r\\n#{device}:#{$1}\\r\\n}\"\n end\n\n # convert device/response pairs from hash into a json formatted string\n public_responses.each_with_index do | response, index |\n public_response += response\n if index == public_responses.length - 1 \n public_response += \"\\r\\n]\" \n else \n public_response += \",\\r\\n\" \n end \n end\n\n # respond back to public request with data in json format\n puts \"[Controller:process_response] public response #{public_response}\"\n @active_requests[public_request_id][:public_response] = public_response\n @public_server.respond @active_requests[public_request_id][:public_response], public_request_id\n\n else\n http_header = \"HTTP/1.1 404 Not Found\\r\\nContent-Type: application/json\\r\\n\\r\\n\"\n public_response = \"#{http_header}Resources Not Found\"\n @public_server.respond public_response, public_request_id\n\n end\n \n @active_requests.delete(public_request_id) unless @active_requests[public_request_id][:arduino_responses].empty? \n \n end",
"def create\n @tag = Tag.new tag_params\n @tag.admin = current_user\n if @tag.save\n render :show, status: 200\n elsif @tag.errors.messages[:value].include? 'has already been taken' # there's probably a better way to do this\n render json: { error: '409 conflict with existing record' }, status: 409\n else\n render json: { error: '422 unprocessable entity' }, status: 422\n end\n end",
"def check_tags(tags)\n if tags['Purpose'] == 'Continuous Integration' && tags['Environment'] == 'QA'\n return 'yes'\n else\n return 'no'\n end\nend",
"def expected_service_response(status: :success, deleted: [], original_size: tags.size, before_truncate_size: tags.size - 1, after_truncate_size: tags.size - 1, before_delete_size: tags.size - 1)\n {\n status: status,\n deleted: deleted,\n original_size: original_size,\n before_truncate_size: before_truncate_size,\n after_truncate_size: after_truncate_size,\n before_delete_size: before_delete_size,\n cached_tags_count: 0\n }.compact.merge(deleted_size: deleted&.size)\n end",
"def delete_tags_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.delete_tags ...\"\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.delete_tags\"\n end\n if @api_client.config.client_side_validation && account_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'account_id' when calling AccountsApi.delete_tags, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/accounts/{accountId}/tags\".sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tagList'] = opts[:'tag_list'] if !opts[:'tag_list'].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[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].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(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#delete_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def get_invitation_tags_with_http_info(invitation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.get_invitation_tags ...'\n end\n # verify the required parameter 'invitation_id' is set\n if invitation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'invitation_id' when calling InvitationsApi.get_invitation_tags\"\n end\n # resource path\n local_var_path = '/invitations/{invitationId}/tags'.sub('{' + 'invitationId' + '}', invitation_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 = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\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 => 'TagListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvitationsApi#get_invitation_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def validate_uuids\n unless Material.valid?(param_uuids)\n return render json: { errors: [{ status: '422', title: 'Unprocessable entity', detail: 'Invalid Material UUIDs' }]}, status: :unprocessable_entity\n end\n end",
"def validate_uuids\n unless Material.valid?(param_uuids)\n return render json: { errors: [{ status: '422', title: 'Unprocessable entity', detail: 'Invalid Material UUIDs' }]}, status: :unprocessable_entity\n end\n end",
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def create\n \n # special case for multiple tags\n tags = params[\"_json\"]\n if (tags.class.name == 'Array')\n Tag.delete_all\n puts \"this is an array\"\n success = true\n @tag = nil \n tags.each do |tag_hash|\n puts \"params are going from #{tag_hash} to #{tag_in_array_params(tag_hash)}\"\n @tag = Tag.new(tag_in_array_params(tag_hash))\n success &= @tag.save \n break unless success\n end\n respond_to do |format|\n if success\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n return \n else \n puts \"class is #{tags.class}\"\n end\n \n @tag = Tag.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.html { render action: 'new' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_tag_with_http_info(project_name, repository_name, reference, tag_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ArtifactApi.delete_tag ...'\n end\n # verify the required parameter 'project_name' is set\n if @api_client.config.client_side_validation && project_name.nil?\n fail ArgumentError, \"Missing the required parameter 'project_name' when calling ArtifactApi.delete_tag\"\n end\n # verify the required parameter 'repository_name' is set\n if @api_client.config.client_side_validation && repository_name.nil?\n fail ArgumentError, \"Missing the required parameter 'repository_name' when calling ArtifactApi.delete_tag\"\n end\n # verify the required parameter 'reference' is set\n if @api_client.config.client_side_validation && reference.nil?\n fail ArgumentError, \"Missing the required parameter 'reference' when calling ArtifactApi.delete_tag\"\n end\n # verify the required parameter 'tag_name' is set\n if @api_client.config.client_side_validation && tag_name.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_name' when calling ArtifactApi.delete_tag\"\n end\n if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"x_request_id\"]\" when calling ArtifactApi.delete_tag, the character length must be great than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'tag_name' + '}', tag_name.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 header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basic']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArtifactApi#delete_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_uuid_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/uuidInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\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 BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithUUIDException.new(\r\n 'uuid in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def endpoints_assign_topology_tag_with_http_info(endpointuuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.endpoints_assign_topology_tag ...'\n end\n # verify the required parameter 'endpointuuid' is set\n if @api_client.config.client_side_validation && endpointuuid.nil?\n fail ArgumentError, \"Missing the required parameter 'endpointuuid' when calling TopologiesApi.endpoints_assign_topology_tag\"\n end\n # resource path\n local_var_path = '/eis/1.0.0/endpoints/{endpointuuid}/assign_topology_tag'.sub('{' + 'endpointuuid' + '}', endpointuuid.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(opts[:'assigntopotagrequest'])\n auth_names = ['oAuth2']\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 => 'SuccessFragment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#endpoints_assign_topology_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def authenticate_resource_request options = {}\n verifications = {\n client_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Client credential key\",\n \"Client credential secret\")\n end\n }\n\n unless options[:two_legged] == true\n verifications.update(\n token_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Token credential key\",\n \"Token credential secret\")\n end\n )\n end\n # Make sure all required state is set\n verifications.each do |(key, _value)|\n raise ArgumentError, \"#{key} was not set.\" unless send key\n end\n\n request_components = if options[:request]\n verify_request_components(\n request: options[:request],\n adapter: options[:adapter]\n )\n else\n verify_request_components(\n method: options[:method],\n uri: options[:uri],\n headers: options[:headers],\n body: options[:body]\n )\n end\n method = request_components[:method]\n uri = request_components[:uri]\n headers = request_components[:headers]\n body = request_components[:body]\n\n\n if !body.is_a?(String) && body.respond_to?(:each)\n # Just in case we get a chunked body\n merged_body = StringIO.new\n body.each do |chunk|\n merged_body.write chunk\n end\n body = merged_body.string\n end\n raise TypeError, \"Expected String, got #{body.class}.\" unless body.is_a? String\n\n media_type = nil\n headers.each do |(header, value)|\n media_type = value.gsub(/^([^;]+)(;.*?)?$/, '\\1') if header.casecmp(\"Content-Type\").zero?\n end\n\n auth_hash = verify_auth_header_components headers\n\n auth_token = auth_hash[\"oauth_token\"]\n\n\n unless options[:two_legged]\n return nil if auth_token.nil?\n return nil unless (token_credential = find_token_credential auth_token)\n token_credential_secret = token_credential.secret if token_credential\n end\n\n return nil unless (client_credential =\n find_client_credential auth_hash[\"oauth_consumer_key\"])\n\n return nil unless validate_nonce_timestamp(auth_hash[\"oauth_nonce\"],\n auth_hash[\"oauth_timestamp\"])\n\n if method == (\"POST\" || \"PUT\") &&\n media_type == \"application/x-www-form-urlencoded\"\n request_components[:body] = body\n post_parameters = Addressable::URI.form_unencode body\n post_parameters.each { |param| param[1] = \"\" if param[1].nil? }\n # If the auth header doesn't have the same params as the body, it\n # can't have been signed correctly(5849#3.4.1.3)\n unless post_parameters.sort == auth_hash.reject { |k, _v| k.index \"oauth_\" }.to_a.sort\n raise MalformedAuthorizationError, \"Request is of type application/x-www-form-urlencoded \" \\\n \"but Authentication header did not include form values\"\n end\n end\n\n client_credential_secret = client_credential.secret if client_credential\n\n computed_signature = ::Signet::OAuth1.sign_parameters(\n method,\n uri,\n # Realm isn't used, and will throw the signature off.\n auth_hash.reject { |k, _v| k == \"realm\" }.to_a,\n client_credential_secret,\n token_credential_secret\n )\n\n return nil unless safe_equals? computed_signature, auth_hash[\"oauth_signature\"]\n { client_credential: client_credential,\n token_credential: token_credential,\n realm: auth_hash[\"realm\"] }\n end",
"def add_tag_with_http_info(id, api_tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#add_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_tag\" if id.nil?\n \n # verify the required parameter 'api_tag' is set\n fail \"Missing the required parameter 'api_tag' when calling add_tag\" if api_tag.nil?\n \n # resource path\n path = \"/Leads/{id}/Tags\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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', 'text/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 = @api_client.object_to_http_body(api_tag)\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 => 'APITag')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#add_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag_service_offering_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceOfferingApi.tag_service_offering ...'\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 ServiceOfferingApi.tag_service_offering\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling ServiceOfferingApi.tag_service_offering, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling ServiceOfferingApi.tag_service_offering\"\n end\n # resource path\n local_var_path = '/service_offerings/{id}/tag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\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'])\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(tag) \n\n # return_type\n return_type = opts[:return_type] || 'Array<Tag>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\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: ServiceOfferingApi#tag_service_offering\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tag\n params.require(:tag).permit(:example_id, :tag)\n end",
"def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end",
"def create_aws_tag_filter_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.create_aws_tag_filter ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AWSIntegrationAPI.create_aws_tag_filter\"\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/filtering'\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'])\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(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_aws_tag_filter,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AWSIntegrationAPI#create_aws_tag_filter\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_hardware_id_to_tag\n tag = Tag.find_by_tag_identifier(params[:id])\n hardware_id = params[:hardware_id]\n hardware_type = params[:hardware_type]\n\n #optional\n latitude = params[:lat]\n longitude = params[:lon]\n ble_major = params[:major]\n ble_minor = params[:minor]\n\n if hardware_id.nil?\n return_error_infos(400, 'Hardware ID is missing', 'HardwareIDMissing', nil)\n return\n end\n\n error = []\n\n if hardware_type.nil?\n error << 'hardware_type'\n end\n\n # also require major und minor id by bluetooth beacons\n unless hardware_type.nil?\n if hardware_type == HardwaresHelper::TYPE_BLE\n if ble_major.nil?\n error << 'major'\n end\n\n if ble_minor.nil?\n error << 'minor'\n end\n end\n end\n\n if error.length > 0\n return_error_infos(400, 'Request values are missing', 'InvalidRequest', error)\n return\n end\n\n if tag.nil?\n return_error_infos(400, 'Tag not found', 'TagNotFound', nil)\n else\n status, tag, error_msg, error_code = tag.add_hardware_id_to_tag(hardware_id, hardware_type, ble_major, ble_minor, latitude, longitude)\n\n if status.nil?\n return_error_infos(400, 'Error while updating tag', 'InvalidRequest', nil)\n else\n\n if status != 200\n return_error_infos(status, error_msg, error_code, nil)\n else\n return_tag_infos(tag, nil)\n end\n end\n end\n end",
"def tag\n\t\t@tag = @identity = Identity.find(params[:id]).decorate\n\tend",
"def list_tags_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagsApi.list_tags ...\"\n end\n if !opts[:'skip_count'].nil? && opts[:'skip_count'] < 0.0\n fail ArgumentError, 'invalid value for \"opts[:\"skip_count\"]\" when calling TagsApi.list_tags, must be greater than or equal to 0.0.'\n end\n\n if !opts[:'max_items'].nil? && opts[:'max_items'] < 1.0\n fail ArgumentError, 'invalid value for \"opts[:\"max_items\"]\" when calling TagsApi.list_tags, must be greater than or equal to 1.0.'\n end\n\n # resource path\n local_var_path = \"/tags\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil?\n query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].nil?\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\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']\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 = ['basicAuth']\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 => 'TagPaging')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsApi#list_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def id3v1_tag\n end",
"def remove_portfolio_item_tags_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioItemApi.remove_portfolio_item_tags ...'\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 PortfolioItemApi.remove_portfolio_item_tags\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioItemApi.remove_portfolio_item_tags, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioItemApi.remove_portfolio_item_tags\"\n end\n # resource path\n local_var_path = '/portfolio_items/{id}/untag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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(tag) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioItemApi#remove_portfolio_item_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def push(tag_key, tag_value, user_id = nil)\n @logger.set_api_name(ApiMethods::PUSH)\n return {} if opted_out?(ApiMethods::PUSH)\n\n unless @is_instance_valid\n @logger.log(\n LogLevelEnum::ERROR,\n 'CONFIG_CORRUPTED',\n {\n '{file}' => FILE,\n '{api}' => ApiMethods::PUSH\n }\n )\n return {}\n end\n\n # Argument reshuffling.\n custom_dimension_map = {}\n if user_id.nil? || tag_key.is_a?(Hash)\n custom_dimension_map = convert_to_symbol_hash(tag_key)\n user_id = tag_value\n else\n custom_dimension_map[tag_key.to_sym] = tag_value\n end\n\n unless (valid_string?(tag_key) || valid_hash?(tag_key)) && valid_string?(user_id)\n @logger.log(\n LogLevelEnum::ERROR,\n 'API_BAD_PARAMETERS',\n {\n '{file}' => FILE,\n '{api}' => ApiMethods::PUSH\n }\n )\n return {}\n end\n\n result = {}\n custom_dimension_map.each do |tagkey, tagvalue|\n if !tagkey.is_a?(Symbol) || !tagvalue.is_a?(String)\n custom_dimension_map.delete(tagkey)\n result[tagkey] = false\n next\n end\n\n if tagkey.length > PushApi::TAG_KEY_LENGTH || tagkey.length == 0\n @logger.log(\n LogLevelEnum::ERROR,\n 'TAG_KEY_LENGTH_EXCEEDED',\n {\n '{file}' => FILE,\n '{userId}' => user_id,\n '{tagKey}' => tagkey\n }\n )\n custom_dimension_map.delete(tagkey)\n result[tagkey] = false\n next\n end\n\n next unless tagvalue.length > PushApi::TAG_VALUE_LENGTH || tagvalue.length == 0\n\n @logger.log(\n LogLevelEnum::ERROR,\n 'TAG_VALUE_LENGTH_EXCEEDED',\n {\n '{file}' => FILE,\n '{userId}' => user_id,\n '{tagKey}' => tagkey,\n '{tagValue}' => tagvalue\n }\n )\n custom_dimension_map.delete(tagkey)\n result[tagkey] = false\n end\n\n if custom_dimension_map.count == 0\n @logger.log(\n LogLevelEnum::ERROR,\n 'API_BAD_PARAMETERS',\n {\n '{file}' => FILE,\n '{api}' => ApiMethods::PUSH\n }\n )\n return result\n end\n\n if defined?(@batch_events)\n custom_dimension_map.each do |tagkey, tagvalue|\n impression = get_batch_event_url_params(@settings_file, tagkey, tagvalue, user_id)\n @batch_events_queue.enqueue(impression)\n end\n resp = true\n elsif event_arch_enabled?\n properties = get_events_base_properties(@settings_file, EventEnum::VWO_SYNC_VISITOR_PROP)\n payload = get_push_payload_data(@settings_file, user_id, EventEnum::VWO_SYNC_VISITOR_PROP, custom_dimension_map)\n resp = @event_dispatcher.dispatch_event_arch_post(properties, payload)\n elsif custom_dimension_map.count == 1\n custom_dimension_map.each do |tagkey, tagvalue|\n impression = get_url_params(@settings_file, tagkey, tagvalue, user_id, @sdk_key)\n main_keys = { 'tags' => impression['tags'] }\n result[tagkey] = @event_dispatcher.dispatch(impression, main_keys, EVENTS::PUSH)\n end\n resp = true\n else\n batch_event_data = { 'ev' => [] }\n custom_dimension_map.each do |tagkey, tagvalue|\n batch_event_data['ev'] << get_batch_event_url_params(@settings_file, tagkey, tagvalue, user_id)\n end\n paramters = get_batch_event_query_params(@settings_file['accountId'], @sdk_key, @usage_stats.usage_stats)\n batch_events_dispatcher = VWO::Services::BatchEventsDispatcher.new(@is_development_mode)\n resp = batch_events_dispatcher.dispatch(batch_event_data, nil, paramters)\n end\n\n prepare_push_response(custom_dimension_map, resp, result)\n rescue StandardError => e\n @logger.log(\n LogLevelEnum::ERROR,\n \"({file}): push API error: #{e.message}\",\n { '{file}' => FILE }\n )\n false\n end",
"def verify_remote_image_tag(registry, image, tag)\n uri = URI(\"http://#{registry}/v2/#{image}/tags/list\")\n begin\n res = Net::HTTP.get_response(uri)\n if res.code == \"200\"\n json = JSON.parse(res.body)\n if json.has_key?(\"tags\")\n if json[\"tags\"].include?(tag)\n status = true\n message = \"remote image and tag exist\"\n else\n status = false\n message = \"remote image exists but new tag missing\"\n end\n else\n status = false\n message = \"remote image does not list any tags\"\n end\n else\n status = false\n message = \"remote image does not exist\"\n end\n rescue SocketError\n status = false\n message = \"error connecting to #{registry}\"\n end\n \n return status, message\n end",
"def purge_tag_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PurgeApi.purge_tag ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n surrogate_key = opts[:'surrogate_key']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PurgeApi.purge_tag\"\n end\n # verify the required parameter 'surrogate_key' is set\n if @api_client.config.client_side_validation && surrogate_key.nil?\n fail ArgumentError, \"Missing the required parameter 'surrogate_key' when calling PurgeApi.purge_tag\"\n end\n # resource path\n local_var_path = '/service/{service_id}/purge/{surrogate_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'surrogate_key' + '}', surrogate_key.to_s)\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'])\n header_params[:'fastly-soft-purge'] = opts[:'fastly_soft_purge'] if !opts[:'fastly_soft_purge'].nil?\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] || 'PurgeResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PurgeApi.purge_tag\",\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: PurgeApi#purge_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def do_query(query_tags, options = {})\n query_tags = [query_tags] if query_tags.is_a?(String)\n Chef::Log.info \"Tagged query_tags: #{query_tags}\"\n match_all = options.fetch(:match_all, false)\n resources = api_client.tags.by_tag(resource_type: 'instances', tags: query_tags, match_all: match_all)\n Chef::Log.info \"Tagged resources: #{resources}\"\n\n tags_hash = {}\n if resources.first\n links = resources.first.links\n if links\n links.each do |link|\n Chef::Log.info \"Tagged Resource Cloud:#{link['href'].split('/')[0..3].join('/')}\"\n next unless api_client.get_instance.show.cloud.href == link['href'].split('/')[0..3].join('/')\n next unless api_client.resource(link['href']).state == 'operational'\n resource_tags = api_client.tags.by_resource(resource_hrefs: [link['href']]) # .first.tags\n tags_hash[link['href']] = {\n 'tags' => resource_tags.first.tags.map { |tag| tag['name'] },\n }\n end\n end\n end\n tags_set_array = []\n tags_hash.values.each do |value|\n tags_set_array << ::MachineTag::Set.new(value['tags'])\n end\n tags_set_array\n end",
"def get_tags\n get_state.map do |get_state_payload|\n get_state_payload.dig(:data, :identity_state, :tags)\n end\n end",
"def search_tags\n\t\t# Searching for patients as per user entered term\n\t\tquestion_tags = Question.all_tags.select{|p| p=~/^#{params[:term]}/i }.uniq\n\t\tif question_tags.present?\n\t \trender :json=> {success: true, \"Tags\" => question_tags.as_json }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Tags are not present\" },:status=> 203\n\t end\n\tend",
"def signed_scan(template_body)\n audit_result = audit(cloudformation_string: template_body)\n\n signed_response(audit_result, template_body)\n end",
"def get_host_tags_with_http_info(host_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagsAPI.get_host_tags ...'\n end\n # verify the required parameter 'host_name' is set\n if @api_client.config.client_side_validation && host_name.nil?\n fail ArgumentError, \"Missing the required parameter 'host_name' when calling TagsAPI.get_host_tags\"\n end\n # resource path\n local_var_path = '/api/v1/tags/hosts/{host_name}'.sub('{host_name}', CGI.escape(host_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].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] || 'HostTags'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_host_tags,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsAPI#get_host_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tag request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_tag_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ArtifactRegistry::V1beta2::Tag.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"def tag\n raise NotImplementedError\n end",
"def tag\n raise NotImplementedError\n end",
"def get_tag_information\n unless file_size >= id3.length + 64 \n @has_tag = false\n @tag_start = file_size - id3.length\n return\n end\n file.seek(-32-id3.length, IO::SEEK_END)\n tag_footer = file.read(32)\n unless tag_footer[0...12] == PREAMBLE \n @has_tag = false\n @tag_start = file_size - id3.length\n return\n end\n raise ApeTagError, \"Tag has bad footer flags\" unless tag_footer[21...24] == FOOTER_FLAGS && (tag_footer[20...21] == \"\\x00\" || tag_footer[20...21] == \"\\x01\")\n @tag_footer = tag_footer\n @tag_size, @tag_item_count = tag_footer[12...20].unpack('VV')\n @tag_size += 32\n raise ApeTagError, \"Tag size (#{tag_size}) smaller than minimum size\" if tag_size < 64 \n raise ApeTagError, \"Tag size (#{tag_size}) larger than possible\" if tag_size + id3.length > file_size\n raise ApeTagError, \"Tag size (#{tag_size}) is larger than #{MAX_SIZE}\" if tag_size > MAX_SIZE\n raise ApeTagError, \"Item count (#{tag_item_count}) is larger than #{MAX_ITEM_COUNT}\" if tag_item_count > MAX_ITEM_COUNT\n raise ApeTagError, \"Item count (#{tag_item_count}) is larger than possible\" if tag_item_count > (tag_size-64)/ApeItem::MIN_SIZE\n file.seek(-tag_size-id3.length, IO::SEEK_END)\n @tag_start=file.pos\n @tag_header=file.read(32)\n @tag_data=file.read(tag_size-64)\n raise ApeTagError, \"Missing header\" unless tag_header[0...12] == PREAMBLE && tag_header[21...24] == HEADER_FLAGS && (tag_header[20...21] == \"\\x00\" || tag_header[20...21] == \"\\x01\")\n raise ApeTagError, \"Header and footer size does not match\" unless tag_size == tag_header[12...16].unpack('V')[0] + 32\n raise ApeTagError, \"Header and footer item count does not match\" unless tag_item_count == tag_header[16...20].unpack('V')[0]\n @has_tag = true\n end",
"def build_provision_request(tags_hash, options_hash)\n log(:info, \"Processing build_provision_request...\", true)\n\n # arg1 = version\n args = ['1.1']\n\n # arg2 = templateFields\n template_args = options_hash.select { |k, v| @valid_provisioning_templateFields.include? k }.to_a.collect { |v| v.join('=') }.join('|')\n #Remove any hash keys there were used in the template_args\n @valid_provisioning_templateFields.each { |k| options_hash.delete(k) }\n args << template_args\n\n # arg3 = vmFields\n vm_args = options_hash.select { |k, v| @valid_provisioning_vmFields.include? k }.to_a.collect { |v| v.join('=') }.join('|')\n #Remove any hash keys there were used in the vm_args\n @valid_provisioning_vmFields.each { |k| options_hash.delete(k) }\n args << vm_args\n\n # arg4 = requester\n requester_args = options_hash.select { |k, v| @valid_provisioning_requester.include? k }.to_a.collect { |v| v.join('=') }.join('|')\n #Remove any hash keys there were used in the vm_args\n @valid_provisioning_requester.each { |k| options_hash.delete(k) }\n args << requester_args\n\n # arg5 = tags\n args << tags_hash.collect { |k, v| \"#{k.to_s}=#{v}\" }.join('|')\n\n # arg6 = WS Values | put all remaining dialog_options in ws_values hash for later use in the state machine\n args << options_hash.collect { |k, v| \"#{k.to_s}=#{v}\" }.join('|') + tags_hash.collect { |k, v| \"#{k.to_s}=#{v}\" }.join('|')\n\n # arg7 = emsCustomAttributes\n args << nil\n\n # arg8 = miqCustomAttributes\n args << nil\n\n log(:info, \"Building provision request with the following arguments: #{args.inspect}\")\n request_id = $evm.execute('create_provision_request', *args)\n log(:info, \"Processing build_provision_request...Complete\", true)\n return request_id\n end",
"def get_tag_definition_with_http_info(tag_definition_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagDefinitionsApi.get_tag_definition ...\"\n end\n # verify the required parameter 'tag_definition_id' is set\n if @api_client.config.client_side_validation && tag_definition_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_definition_id' when calling TagDefinitionsApi.get_tag_definition\"\n end\n if @api_client.config.client_side_validation && tag_definition_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'tag_definition_id' when calling TagDefinitionsApi.get_tag_definition, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/tagDefinitions/{tagDefinitionId}\".sub('{' + 'tagDefinitionId' + '}', tag_definition_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'audit'] = opts[:'audit'] if !opts[:'audit'].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 => 'TagDefinitionJson')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagDefinitionsApi#get_tag_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tags\n @tags ||= ApiFactory.new 'GitData::Tags'\n end",
"def create(deal_title, person_id, org_id, one_m_users_flag_str, mobile_app_flag_str)\n \n validation_errors = []\n \n validation_errors.push('invalid_deal_title') unless Util::CommonValidator.is_string?(deal_title)\n validation_errors.push('invalid_person_id') unless Util::CommonValidator.is_integer?(person_id)\n validation_errors.push('invalid_org_id') unless Util::CommonValidator.is_integer?(org_id)\n validation_errors.push('invalid_one_m_users_flag_str') unless Util::CommonValidator.is_string?(one_m_users_flag_str)\n validation_errors.push('invalid_mobile_app_flag_str') unless Util::CommonValidator.is_string?(mobile_app_flag_str)\n \n return validation_error(\n 'l_t_pd_d_1',\n 'something_went_wrong',\n validation_errors,\n GlobalConstant::ErrorAction.default\n ) if validation_errors.present?\n \n enterprise_custom_field_key = GlobalConstant::PipeDrive.pipedrive_deal_enterprise_custom_field_key\n mobile_app_custom_field_key = GlobalConstant::PipeDrive.pipedrive_deal_mobile_app_custom_field_key\n\n url_path = create_request_path(@deals_endpoint)\n\n is_enterprise = one_m_users_flag_str == 'Enterprise'\n \n # stage_id = is_enterprise ?\n # GlobalConstant::PipeDrive.ost_platform_enterprise_stage_id :\n # GlobalConstant::PipeDrive.ost_platform_business_stage_id\n\n stage_id = GlobalConstant::PipeDrive.ost_platform_business_stage_id\n\n user_id = is_enterprise ?\n GlobalConstant::PipeDrive.ost_pipedrive_enterprise_user_id :\n GlobalConstant::PipeDrive.ost_pipedrive_business_user_id\n \n custom_params = {\n title: deal_title,\n user_id: user_id,\n person_id: person_id,\n org_id: org_id,\n stage_id: stage_id # ID of the stage where this deal will be placed in a pipeline\n }\n custom_params[enterprise_custom_field_key.to_sym] = one_m_users_flag_str\n custom_params[mobile_app_custom_field_key.to_sym] = mobile_app_flag_str\n \n r = send_request_of_type('post', url_path, custom_params)\n return r unless r.success?\n\n success_with_data(\n {\n deal_id: r[:data]['id']\n })\n end",
"def tag_service(dialogs_tags_hash)\n log_and_update_message(:info, \"Processing tag_service...\", true)\n\n # Look for tags with a sequence_id of 0 to tag the service\n dialogs_tags_hash.fetch(0, {}).each do |key, value|\n log_and_update_message(:info, \"Processing tag: #{key.inspect} value: #{value.inspect}\")\n tag_category = key.downcase\n Array.wrap(value).each do |tag_entry|\n process_tag(tag_category, tag_entry.downcase)\n end\n end\n log_and_update_message(:info, \"Processing tag_service...Complete\", true)\nend",
"def action_attach_tag_with_http_info(list_id, attach_tag_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_attach_tag ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_attach_tag\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_attach_tag, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'attach_tag_request' is set\n if @api_client.config.client_side_validation && attach_tag_request.nil?\n fail ArgumentError, \"Missing the required parameter 'attach_tag_request' when calling ContactsApi.action_attach_tag\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/attach-tag'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\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'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(attach_tag_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_attach_tag\",\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: ContactsApi#action_attach_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def action_detach_tag_with_http_info(list_id, detach_tag_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_detach_tag ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_detach_tag\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_detach_tag, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'detach_tag_request' is set\n if @api_client.config.client_side_validation && detach_tag_request.nil?\n fail ArgumentError, \"Missing the required parameter 'detach_tag_request' when calling ContactsApi.action_detach_tag\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/detach-tag'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\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'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(detach_tag_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_detach_tag\",\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: ContactsApi#action_detach_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end",
"def test_reject_invalid_tags_with_require_valid_tags_true\n setup_gce_metadata_stubs\n INVALID_TAGS.each_key do |tag|\n setup_logging_stubs do\n @logs_sent = []\n d = create_driver(REQUIRE_VALID_TAGS_CONFIG, tag)\n d.emit('msg' => log_entry(0))\n d.run\n end\n verify_log_entries(0, COMPUTE_PARAMS, 'jsonPayload')\n end\n end",
"def strong_etag?; end",
"def describe_tags(filters = {})\n params = AWS.indexed_filters(filters)\n request({\n 'Action' => 'DescribeTags',\n :idempotent => true,\n :parser => Fog::Parsers::AWS::Compute::DescribeTags.new\n }.merge!(params))\n end",
"def delete_tags_with_http_info(payment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.delete_tags ...\"\n end\n # verify the required parameter 'payment_id' is set\n if @api_client.config.client_side_validation && payment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_id' when calling PaymentsApi.delete_tags\"\n end\n if @api_client.config.client_side_validation && payment_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'payment_id' when calling PaymentsApi.delete_tags, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/payments/{paymentId}/tags\".sub('{' + 'paymentId' + '}', payment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'tagList'] = opts[:'tag_list'] if !opts[:'tag_list'].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[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].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(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#delete_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def put_learner_tags_with_http_info(learner_id, tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LearnerApi.put_learner_tags ...'\n end\n # verify the required parameter 'learner_id' is set\n if learner_id.nil?\n fail ArgumentError, \"Missing the required parameter 'learner_id' when calling LearnerApi.put_learner_tags\"\n end\n # verify the required parameter 'tags' is set\n if tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling LearnerApi.put_learner_tags\"\n end\n # resource path\n local_var_path = '/learner/{learnerId}/tags'.sub('{' + 'learnerId' + '}', learner_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(tags)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:PUT, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LearnerApi#put_learner_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tags\n get.tagGuids\n end",
"def delete_tag_with_http_info(id, tag_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#delete_tag ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling delete_tag\" if id.nil?\n \n # verify the required parameter 'tag_name' is set\n fail \"Missing the required parameter 'tag_name' when calling delete_tag\" if tag_name.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/Tags/{tagName}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s).sub('{' + 'tagName' + '}', tag_name.to_s)\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', 'text/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(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#delete_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def remove_portfolio_tags_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PortfolioApi.remove_portfolio_tags ...'\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 PortfolioApi.remove_portfolio_tags\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling PortfolioApi.remove_portfolio_tags, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling PortfolioApi.remove_portfolio_tags\"\n end\n # resource path\n local_var_path = '/portfolios/{id}/untag'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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(tag) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\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: PortfolioApi#remove_portfolio_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def single_tag_questions\n\t# Listing the all the questions related to the tag\n\t\tquestions = Question.with_all_tags(params[:tag])\n\t\t#checking questions is present or not.\n\t\tif questions.present?\n \trender :json=> {success: true, \"question\" => questions.as_json(\"question_data\") }\n\t else\n\t render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n\t end\n\tend",
"def create_tag request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_tag_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ArtifactRegistry::V1beta2::Tag.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def delete_invitation_tags_with_http_info(invitation_id, tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.delete_invitation_tags ...'\n end\n # verify the required parameter 'invitation_id' is set\n if invitation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'invitation_id' when calling InvitationsApi.delete_invitation_tags\"\n end\n # verify the required parameter 'tags' is set\n if tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling InvitationsApi.delete_invitation_tags\"\n end\n # resource path\n local_var_path = '/invitations/{invitationId}/tags'.sub('{' + 'invitationId' + '}', invitation_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(tags)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvitationsApi#delete_invitation_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def id3v2_tag\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def lookup(batch)\n req = Vacuum.new key: 'AKIAJA2IADZPBGHJTZRQ',\n secret: '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',\n tag: @tag,\n locale: 'us'\n \n \n params = { 'Operation' => 'ItemLookup',\n 'SearchIndex' => 'Books',\n 'ItemLookup.Shared.IdType' => 'ISBN',\n 'ItemLookup.Shared.Condition' => 'All',\n 'ItemLookup.Shared.MerchantId' => 'All',\n 'ItemLookup.Shared.ResponseGroup' => 'OfferFull'}\n \n batch.each_with_index do |item,index|\n params['ItemLookup.'+(index+1).to_s+'.ItemId'] = item\n end\n req.build params\n \n res = req.get\n items = []\n if res.valid?\n res.to_hash['Items'].each do |item|\n prod = {}\n prod['ASIN'] = item['Item']['ASIN']\n prod['New Price'] = item['Item']['OfferSummary']['LowestNewPrice']['FormattedPrice']\n prod['Used Price'] = item['Item']['OfferSummary']['LowestUsedPrice']['FormattedPrice']\n prod['url'] = \"http://www.amazon.com/dp/\"+prod['ASIN']+'/?tag='+@tag\n items << prod\n end\n end\n #puts res.to_hash.to_json\n items\nend"
] |
[
"0.56413084",
"0.55885226",
"0.5511644",
"0.54882455",
"0.5234055",
"0.5233752",
"0.5233752",
"0.5230774",
"0.5216666",
"0.5214635",
"0.5196251",
"0.51062655",
"0.5085874",
"0.5028116",
"0.5018077",
"0.5008001",
"0.49817613",
"0.49708486",
"0.49469638",
"0.49455932",
"0.4943244",
"0.4915648",
"0.48902678",
"0.48888513",
"0.4869634",
"0.48680004",
"0.48391318",
"0.48366448",
"0.48213792",
"0.48188353",
"0.48108095",
"0.4783306",
"0.47719884",
"0.47675908",
"0.47596192",
"0.47415298",
"0.47149518",
"0.46963787",
"0.46883026",
"0.46866778",
"0.46857926",
"0.46834823",
"0.4673705",
"0.46723384",
"0.4650436",
"0.46439868",
"0.4641292",
"0.4641109",
"0.4641109",
"0.46408924",
"0.46382728",
"0.46326077",
"0.4619396",
"0.46132773",
"0.4613208",
"0.46049413",
"0.46003658",
"0.45976812",
"0.4595561",
"0.45910016",
"0.45903125",
"0.45698726",
"0.4557268",
"0.4553201",
"0.45510468",
"0.45449892",
"0.45399842",
"0.45289943",
"0.45254275",
"0.4515782",
"0.45046034",
"0.44956928",
"0.44932342",
"0.4493116",
"0.44893065",
"0.44887283",
"0.44887283",
"0.44876575",
"0.44868532",
"0.44831178",
"0.44771746",
"0.44771057",
"0.44753915",
"0.4474577",
"0.4467189",
"0.44648615",
"0.4464174",
"0.44612896",
"0.4457581",
"0.44571468",
"0.4449273",
"0.44479394",
"0.44466782",
"0.44441858",
"0.44408613",
"0.4440335",
"0.44388914",
"0.44385332",
"0.44353852",
"0.44320837"
] |
0.5111493
|
11
|
Get authentication keys for encoded tags, which can be used to access the tag memory. The key names, content and access rules need to be defined when ordering the tags. It is possible to have several applications with their corresponding keys on a tag. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK tags found and result available (also returned if only a subset of tags have this keys) 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized 404 NOT_FOUND no matching tags found or none the tags found does have keys with given name Input HTTP Headers: HTTP Basic Authorization (as specified above) Accept language (as specified above) Input parameters: tagIds (required, string, `0EEEE100000001`) ... Identifier for each tag to be queried appId (required, string, `SC Public Transport`) ... Application ID which references the key Output parameters: code (Number, `0`) ... Indicates the result code of this call (see `result codes`) tagId (string, `0EEEE100000001`) ... Tag ID tagCode (Number, `0`) ... Indicates if the result code for this tag (see `Possible result codes for a tag actions`) key (string, `0102030405060708090A0B0C`) ... Key blob (AsciiHex encoded key)
|
def create_get_keys_used_for_tag_authentication(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/key'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# prepare and execute HttpRequest
_request = @http_client.post _query_url, headers: _headers, parameters: body.to_json
BasicAuth.apply(_request)
_context = execute_request(_request)
# validate response against endpoint and global error codes
if _context.response.status_code == 400
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
elsif _context.response.status_code == 401
raise APIException.new '', _context
elsif _context.response.status_code == 404
raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context
end
validate_response(_context)
# return appropriate response type
decoded = APIHelper.json_deserialize(_context.response.raw_body)
return GetKeysUsedForTagAuthenticationResponseModel.from_hash(decoded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def keys\n @tags.nil? ? [] : @tags.keys\n end",
"def fetch_signing_keys\n response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))\n response['keys']\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch AzureAD signing keys.'\n end",
"def get_user_tags username, password\n do_request 'get_user_tags', username: username, password: password\n end",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def keys\n Hash === tags.last ? tags.last : {}\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def list_keys request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_keys_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApiKeys::V2::ListKeysResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def keys_for(username)\n @api.client.users.keys.list(user: username).body\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def keys\n doc = JSON.parse get('/api/v1/ssh_keys')\n doc[\"ssh_keys\"]\n end",
"def keys(options={})\n get(\"/user/keys\", options, 3)\n end",
"def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end",
"def link_key(tags)\n raise TypeError.new t('invalid_tag') unless tags.is_a?(Hash) or tags.is_a?(Array)\n\n tags.each do |tag, link|\n case link\n when Array\n newlink = Riakpb::RpbLink.new\n newlink[:bucket] = link[0]\n newlink[:key] = link[1]\n raise ArgumentError.new t('invalid_tag') if link[0].nil? or link[1].nil?\n\n @links[tag.to_s] << newlink\n\n when Riakpb::Key\n @links[tag.to_s] << link\n\n else\n raise TypeError.new t('invalid_tag')\n end\n end # tags.each do |tag, link|\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def parse_auth_keys\n tuples = config.scan(AUTH_KEY_REGEXP)\n hsh = {}\n tuples.map do |(key, algorithm, mode, password)|\n hsh[key] = {\n algorithm: algorithm,\n mode: mode,\n password: password\n }\n hsh[key]\n end\n\n { auth_keys: hsh }\n end",
"def list_keys(iam, user_name)\n begin\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\n\n if list_access_keys_response.access_key_metadata.count == 0\n puts \"No access keys.\"\n else\n puts \"Access keys:\"\n list_access_keys_response.access_key_metadata.each do |key_metadata|\n puts \" Access key ID: #{key_metadata.access_key_id}\"\n end\n end\n\n rescue Aws::IAM::Errors::NoSuchEntity\n puts \"Cannot find user '#{user_name}'.\"\n exit(false)\n end\nend",
"def authentication_keys\n @authentication_keys ||= User.authentication_keys\n end",
"def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end",
"def get_key_list\n read(Common::KEY) || Hash.new\n end",
"def tags\n get.tagGuids\n end",
"def keys\n deprecate # 07/31/2012\n doc = xml get('/user/keys').to_s\n doc.elements.to_a('//keys/key').map do |key|\n key.elements['contents'].text\n end\n end",
"def list_keys(iam, user_name)\r\n begin \r\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\r\n\r\n if list_access_keys_response.access_key_metadata.count == 0\r\n puts \"No access keys.\"\r\n else\r\n puts \"Access keys:\"\r\n list_access_keys_response.access_key_metadata.each do |key_metadata|\r\n puts \" Access key ID: #{key_metadata.access_key_id}\"\r\n end\r\n end\r\n \r\n rescue Aws::IAM::Errors::NoSuchEntity\r\n puts \"Cannot find user '#{user_name}'.\"\r\n exit(false)\r\n end \r\nend",
"def keys\n # Lock for thread safety\n # Only one thread can write to the hash at a time and prevent partial keys from being returned.\n @thread_lock.synchronize do\n if @keys.nil?\n @keys = {}\n @user_keys.each_pair do |name, rsa_keys|\n # Use the sha256 of the user name as the internal name\n # This is to both avoid naming problems when uploading and to obfuscate the key name\n keys_key = BackupEngine::Checksums::Engines::SHA256.new.block(name.to_s)\n raise('Key name sha collission') if @keys.key?(keys_key)\n\n @keys[keys_key] = rsa_keys.merge(name: name)\n end\n end\n end\n\n raise('No encryption keys') if @keys.empty?\n\n return @keys\n end",
"def list_access_keys(iam, user_name)\n response = iam.list_access_keys(user_name: user_name)\n\n if response.access_key_metadata.count.positive?\n puts \"Access key IDs:\"\n response.access_key_metadata.each do |key_metadata|\n puts \" #{key_metadata.access_key_id}\"\n end\n else\n puts \"No access keys found for user '#{user_name}'.\"\n end\nrescue Aws::IAM::Errors::NoSuchEntity\n puts \"Error listing access keys: cannot find user '#{user_name}'.\"\n exit 1\nrescue StandardError => e\n puts \"Error listing access keys: #{e.message}\"\nend",
"def tags\n @result.keys\n end",
"def key_info\n authenticated_post(\"key_info\").body\n end",
"def key_ids\n @keys.keys\n end",
"def account_api_keys_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IdentityApi.account_api_keys_get ...\"\n end\n # resource path\n local_var_path = \"/account/apiKeys\"\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 = nil\n auth_names = ['basicAuth']\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 => 'ApiKeysResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#account_api_keys_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_key request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_key_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApiKeys::V2::Key.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_keys(opts = {})\n data, _status_code, _headers = get_keys_with_http_info(opts)\n data\n end",
"def get_device_keys\n begin\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n if decoded_access_token\n @device_keys = User.pluck(:device_key)\n render json: {device_keys: @device_keys}\n end\n\n rescue => exception\n render json: {status: \"Invalid Token\"}\n end\n\n end",
"def validation_keys_hash(client_id = nil, client_secret = nil)\n hdrs = client_id && client_secret ?\n { \"authorization\" => Http.basic_auth(client_id, client_secret)} : {}\n response = json_get(target, \"/token_keys\", key_style, hdrs)\n\n keys_map = {}\n\n response['keys'].each do |key|\n keys_map[key['kid']] = key\n end\n\n keys_map\n end",
"def list_api_keys(request_options = {})\n client.get(Protocol.index_keys_uri(name), :read, request_options)\n end",
"def keys\n jiak.client.keys(jiak.bucket)\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def list\n @keychain.keys\n end",
"def credential_keys\n %w(seal certificate) & valid_keys\n end",
"def tag_authentication_endpoints\n TagAuthenticationEndpointsController.instance\n end",
"def getKeys(data_keys)\r\n data_keys[0].keys\r\n end",
"def list_account_key_objects(account_name, group = configuration.resource_group, skip_accessors_definition = false)\n validate_resource_group(group)\n\n unless recent_api_version?\n raise ArgumentError, \"unsupported api-version string '#{api_version}'\"\n end\n\n url = build_url(group, account_name, 'listKeys')\n response = rest_post(url)\n JSON.parse(response.body)['keys'].map { |hash| StorageAccountKey.new(hash, skip_accessors_definition) }\n end",
"def authentication_requests(key_handles)\n key_handles = [key_handles] unless key_handles.is_a? Array\n key_handles.map do |key_handle|\n SignRequest.new(key_handle)\n end\n end",
"def keys\n authorized_keys = []\n if team.present?\n log \"Got Github Team '#{team.name}' for Org '#{@org}'\"\n\n members = team_members(team.id)\n\n members.each do |member|\n log(\"Getting Member...#{member.login}\")\n\n keys = keys_for(member.login)\n\n # Can't get the real email address without logging in as that user\n email = \"#{member.login}@github.com\"\n\n keys.each do |key|\n authorized_keys << [key[:key], email]\n end\n end\n else\n log(\"No '#{@team_name}' team for '#{@org}' found\")\n log(teams.inspect)\n end\n authorized_keys\n end",
"def api_keys\n rest_query(:api_key)\n end",
"def list_key_credentials_for_application(app_id, options = {})\n get(\"/apps/#{app_id}/credentials/keys\", options)\n end",
"def list_signing_keys_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SigningKeysApi.list_signing_keys ...'\n end\n # resource path\n local_var_path = '/system/v1/signing-keys'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].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] || 'ListSigningKeysResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SigningKeysApi.list_signing_keys\",\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: SigningKeysApi#list_signing_keys\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tags\n get('tags')\n end",
"def list_account_keys(account_name, group = configuration.resource_group)\n validate_resource_group(group)\n\n url = build_url(group, account_name, 'listKeys')\n response = rest_post(url)\n hash = JSON.parse(response.body)\n\n parse_account_keys_from_hash(hash)\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def list_keys\n @keydict.keys\n end",
"def get_v1_tags_with_http_info(tag_names_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.get_v1_tags ...'\n end\n # verify the required parameter 'tag_names_list' is set\n if @api_client.config.client_side_validation && tag_names_list.nil?\n fail ArgumentError, \"Missing the required parameter 'tag_names_list' when calling TagApi.get_v1_tags\"\n end\n # resource path\n local_var_path = '/v1/tags'\n\n # query parameters\n query_params = {}\n query_params[:'tag_names_list'] = tag_names_list\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 = ['api_key']\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 => 'TagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#get_v1_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tags\n response[\"tags\"]\n end",
"def get_labels_for_keys(conn, cgguid, key_arr)\n req = mk_request(TRP::Message::Command::KEY_LOOKUP_REQUEST,\n :counter_group => cgguid, \n :keys => key_arr.uniq )\n\n h = key_arr.inject({}) { |m,i| m.store(i,make_readable(i)); m }\n get_response(conn,req) do |resp|\n resp.key_details.each { |d| h.store(d.key,d.label) }\n end\n return h\n end",
"def list_keys()\n # TODO\n end",
"def do_getdomainkeys(args)\n if args[\"name\"] == \"example.com\"\n @result = [ \n {\n \"id\" => 1,\n \"flags\" => 257,\n \"active\" => true,\n \"content\" => \"Private-key-format: v1.2\nAlgorithm: 8 (RSASHA256)\nModulus: ovvzf1fHdptdXsBrBLSqmGqdEKwR2B9st/KBgh8xQKoQzTGUG00CsPjF/J59IBU+EU/IIInMn0MxLLTyUKa2DJUkR6i7UKif5jKX1c7yvWzrFKLGOHjugUX2++r+o789biUte1qpWp3Kc2RYL18oPco4zpo6JcsPmhOK3aUCDJXmuWgHl1KudCQIiPkISArXVn4oOp+skQq+mUBl1Pysc4D+6sl77ERR2fW6xJ4ZRPOIKr445RJJmKgoMG8yRrR3it1RmV49hZlvMosQjBUoNcqhqOI0n4l8HOLyna7KIzoNKG62GtUCZh8uy8IjdUiWPYGEtkZ9zE0bnnF+R7HGvQ==\nPublicExponent: AQAB\nPrivateExponent: Lp/c3IUD7o4re7uX4dS9KLT3EZnn0OfMdiLNoafCszjzbX/NWrIBHxdLrCS6rr7k7pbgLU6+VqEmJB/vYdsPITJZGpbOXxieBYBbpzJ4hm/uIA0gn28Y66pUKWTkS3ud2zCPfkZFREL3c2M1Rvf1zxdWgOPl1oHsiKsmgpl9qJOSKHMWFC+m/pUMJ7iOMgyDRV+PNeb/8P1jVOAYyQMEnu+enw2ro2NiWXNikbnaWrIv3IxVZAyZG4/H8+1vfQFPDWztosOy7OhV3WyMJkfwcXrlGoyLlxyAgkh/jeCnmPllxlJZGTgCtoVYd/n8osMXCDKxpAhsfdfCPeNOcjocgQ==\nPrime1: +T+s7wv+zVqONJqkAKw4OCVzxBc5FWrmDPcjPCUeKIK/K/3+XjmIqTlbvBKf+7rm+AGVnXAbqk90+jzE3mKI8HMG/rM2cx01986xNQsIqwi2VAt25huPhEyrtNzos6lmrCYaioaQnNpMvMLun3DvcaygkDUXxH7Dg+6BTHeUfnk=\nPrime2: p2YbBveBK3XyGMuVrDH9CvvpgKEoko+mPwLoKNpBoHrGxeOdCQmlPbnr0GrtZpy4sBNc5+shz2c6c1J3GlgPndT7zi2+MFGfWIGV48SAknVLfOU4iUpaGllnxcbjZeytG6WHdy2RaR3ReeGvdWxmxeuv084c2zC/7/vkcmgOqWU=\nExponent1: EdVFeUEBdQ3imM7rpwSrbRD47HHA6tBgL1NLWRVKyBk6tloQ5gr1xS3Oa3FlsuwXdG0gmEgaIqBWvUS1zTd9lr6UJIsL/UZ8wwMt2J62ew4/hVngouwb45pcuq8HkzsulmiPg5PHKwHPdb34tr2s1BRG1KqHzc5IDNt2stLnc/k=\nExponent2: oT+Iv1BAu7WUa/AHj+RjJGZ+iaozo+H9uOq66Uc8OjKqMErNpLwG0Qu7rHqjjdlfSjSMpNXpLpj4Q8fm9JhpCpbzq6qCbpbhUGcbFFjfpLSZ74f5yr21R3ZhsLChsTenlF8Bu3pIfKH9e1M7KXgvE22xY+xB/Z3a9XeFmfLEVMU=\nCoefficient: vG8tLZBE4s3bftN5INv2/o3knEcaoUAPfakSsjM2uLwQCGiUbBOOlp3QSdTU4MiLjDsza3fKIptdwYP9PvSkhGhtLPjBpKjRk1J1+sct3dfT66JPClJc1A8bLQPj4ZpO/BkJe6ji4HYfOp7Rjn9z8rTqwEfbP64CZV3/frUzIkQ=\"\n },\n {\n \"id\" => 2,\n \"flags\" => 256,\n \"active\" => true,\n \"content\" => \"Private-key-format: v1.2\nAlgorithm: 8 (RSASHA256)\nModulus: wKPNcDwkCd2DKxfdkMqTFOV2ITdgxIDaOd4vQ2QtphMBY9yYwmEkNsVdVFz7VVuQHdls20JUe+brFUhs1zEMMbokulFP/qVAItAeEWcqtkPULT+mmX5HsexpFVAZ5+UXuerObk/HMiIMt1CvkIWhmjSIkAI6dFRlf/93zTjy0+vwrNWZPXSzLccK5TfJmxdYdGPcsHkg6UmqEFPQuyZpmlmpg3IwjL5YddTDobAoABz/BrH7WsW0q/PyVubITo8JuFiBI5Fmw+3ef3PVUt1jtUCGASvtqNXW4wtWrgqvQKg/odthpceQ4QagV9XSlOdml527thnf9cMpm0Gh4Ox5HQ==\nPublicExponent: AQAB\nPrivateExponent: f+M+26fRdQstrUomuZ0Cj/jVt69/+nRga9JpJiA3fe1YGue0MjczR3k3QG6KHFyxDF/vuJAMbkUbBAIU37ecFNcy0s5wgOlL7tCjZYJMBLx6+58qBvSivCfqi0+mIyEf4zlS2kD0SP/52SkjpJpScoE1uAUCsX/l8lezPPb1nmH3RDwJwX1NVhsErHCAmxGDoj4nPCEhKgHkdbR0i8geXGdWR4slyq1EhuGJal4p5sNvzDQTYRy6r49rpbNHw9F7ojomIhTUCUjOXAX0X1HB5UTXRMpgpCNEjRG1a+aqxp/ZSMHSEGCv67fua5Qrd/qX1Ppns/oqZfCfTpTD3v/sMQ==\nPrime1: +0zQuFi7rZDTMGMIKiF6UOG5+pKwGxHmgKPOGF6fk3tIuSomgiVD3DLz5Y6kYk0kKls6IiA6X2esYwNXAaLe0dyMzpAnU4URXhFW7fUnHP0zA7NmaFRYPHstPeU59/JS+zmVlj4Ok1oeGocSGAFYGxXa+Sot0fyCXpAjZboDWg8=\nPrime2: xD4hprQmcn5gmLqYO9+nEEJTNyNccbAciiKjRJxIE7w6muuKESx0uUn5XdnzSxhbVkK16kkEqW3s+Y+VoLxwRj2fuvoPfx8nTQXY1esgcIZCG8ubvHW5T0bzee5gyX3cMvaxkoeM7euYgvh0UwR/FG910SwAlmMZjSwXay2YlhM=\nExponent1: 6vcWzNcCnDWmkT53WtU0hb2Y4+YVzSm+iRcf039d20rRY3g6y0NGoPPvQftOTi9smkH0KAZULfJEp8tupbQAfN6ntVfpvVjVNUwnKJUo/hzsfxBVt0Ttv5c4ZQAYZHHqDsX3zKO3gyUmso0KaPGQzLpxpLlAYG+mAf7paeszyRc=\nExponent2: ouvWMjk0Bi/ncETRqDuYzkXSIl+oGvaT6xawp4B70m6d1QohWPqoeT/x2Dne44R4J9hAgR5X0XXinJnZJlXrfFUi7C84eFhb33UwPQD0sJa2Aa97Pu4Zh7im4J7IGd/01Ra7+6Ovm8LRnkI5CMcd3dBfZuX6IuBpUSu+0YtMN6M=\nCoefficient: 5lP9IFknvFgaXKCs8MproehHSFhFTWac4557HIn03KrnlGOKDcY6DC/vgu1e42bEZ4J0RU0EELp5u4tAEYcumIaIVhfzRsajYRGln2mHe6o6nTO+FbANKuhyVmBEvTVczPOcYLrFXKVTglKAs+8W96dYIMDhiAwxi9zijLKKQ1k=\"\n }\n ]\n end\n end",
"def hkeys(key); end",
"def hkeys(key); end",
"def get_keys_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KvStoreItemApi.get_keys ...'\n end\n # unbox the parameters from the hash\n store_id = opts[:'store_id']\n # verify the required parameter 'store_id' is set\n if @api_client.config.client_side_validation && store_id.nil?\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling KvStoreItemApi.get_keys\"\n end\n # resource path\n local_var_path = '/resources/stores/kv/{store_id}/keys'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].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] || 'InlineResponse2004'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"KvStoreItemApi.get_keys\",\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: KvStoreItemApi#get_keys\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def authorized_keys\n get \"/setup/api/settings/authorized-keys\", password_hash\n end",
"def keys\n @keys||= [:token, :message, :title, :device, :priority]\n end",
"def api_key\n request.headers['HTTP_AUTHORIZATION']\n end",
"def keys\n @key\n end",
"def account_api_keys_get(opts = {})\n data, _status_code, _headers = account_api_keys_get_with_http_info(opts)\n return data\n end",
"def tags\n request_libraries.collect(&:tag_id)\n end",
"def key_credentials\n return @key_credentials\n end",
"def _ssh_keys\n Chef::Log.info \"Getting keys for user #{ username } from https://github.com/#{ github_username }.keys.\"\n keys = Array(ssh_keys)\n if github_username\n @github_keys = begin\n Chef::HTTP.new('https://github.com').get(\"#{ github_username }.keys\")\n # Use a really big hammer, github being down shouldn't break things.\n # The downside is that if github is down, it will yank your key, possibly\n # leaving login unavailable. Not sure what to do about this right now.\n rescue\n Chef::Log.fatal \"There was an issue getting keys for user #{ username } from https://github.com/#{ github_username }.keys.\"\n end\n Chef::Log.debug \"Got from request: #{@github_keys}\"\n keys += @github_keys.split(\"\\n\")\n end\n Chef::Log.debug \"found some keys! #{keys}\"\n keys\n end",
"def list_access_keys(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListAccessKeys'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def get_storage_account_keys(name)\n if get_storage_account name\n path = \"/services/storageservices/#{name}/keys\"\n request = client.management_request(:get, path)\n response = request.call\n Serialization.storage_account_keys_from_xml(response)\n else\n Azure::Loggerx.warn \"Storage Account '#{name}' does not exist.\"\n end\n end",
"def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end",
"def tags\n send_tags('tags', @handle, @security)\n end",
"def get_keys(user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.all(:account_id => user.id, :project_id => self.id)\n\tend",
"def list_keys\n @keys.keys\n end",
"def key(key_id)\n from_resource :key,\n connection.get(api_uri(\"keys/#{key_id}\"))\n end",
"def auth_by_key(auth_key_id, auth_key, endpoint)\n endpoint = API_BASE_URL if endpoint.nil?\n res = RestClient.post endpoint + '/auth',\n { authKeyId: auth_key_id, authKey: auth_key },\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n result = JSON.parse(res.body)\n fail result['message'] if res.code != '200'\n Hash[JSON.parse(res.body).map { |k, v| [k.to_sym, v] }]\n end",
"def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"def tags\n @tags ||= begin\n resp = @client.access_token.get('/reader/api/0/tag/list?output=json')\n raise \"unable to retrieve the list of tags for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['tags'].collect do |hash|\n Google::Reader::Tag.new(hash.merge({:client => @client}))\n end\n end\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def authorized_keys\n hash = {}\n keys = Dir.glob(Path.named_path([:user_ssh, '*']))\n keys.sort.each do |keyfile|\n ssh_type, ssh_key = File.read(keyfile, :encoding => 'UTF-8').strip.split(\" \")\n name = File.basename(File.dirname(keyfile))\n hash[name] = {\n \"type\" => ssh_type,\n \"key\" => ssh_key\n }\n end\n ssh_type, ssh_key = File.read(Path.named_path(:monitor_pub_key), :encoding => 'UTF-8').strip.split(\" \")\n hash[Leap::Platform.monitor_username] = {\n \"type\" => ssh_type,\n \"key\" => ssh_key\n }\n hash\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end",
"def keys\n @params.keys\n end",
"def ssh_keys(env, ids_only = false)\n account = env[:sl_client][\"SoftLayer_Account\"]\n acc_keys = sl_warden { account.object_mask(\"mask[id,label]\").getSshKeys }\n key_ids = []\n Array(env[:machine].provider_config.ssh_key).each do |key|\n pattern = key.is_a?(String) ? \"label\" : \"id\"\n key_hash = acc_keys.find { |acc_key| acc_key[pattern] == key }\n raise Errors::SLSshKeyNotFound, :key => key unless key_hash\n key_ids << key_hash[\"id\"]\n end\n return (ids_only ? key_ids : key_ids.map { |key_id| { :id => key_id } })\n end",
"def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend",
"def keys(*args)\n @params.keys(*args)\n end",
"def keys(*args)\n @params.keys(*args)\n end",
"def key(key_id, options = {})\n get \"/user/keys/#{key_id}\", options\n end",
"def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end",
"def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end",
"def hmac_authorization\n Proofing::LexisNexis::RequestSigner.new(\n config: config,\n message_body: body,\n path: path,\n ).hmac_authorization\n end",
"def decryption_keys(encrypted_message)\n if encrypted_message.headers.encrypted_data_key_id\n keys_grouped_by_id[encrypted_message.headers.encrypted_data_key_id]\n else\n @keys\n end\n end",
"def key_files; end",
"def list_signing_keys(opts = {})\n data, _status_code, _headers = list_signing_keys_with_http_info(opts)\n data\n end",
"def get_keys\t\t\n\t\t\tbegin\t\t\t\t\t\t\t\n\t\t\t\tgetkeys = Datastore.new\t\t\t\n\t\t\t\trender :status => 200,\n\t \t\t:json => { :response => \"success\",\n\t \t :status => 200,\n\t \t :info => \"Successfully retrieved all keys\", \n\t \t :data => getkeys.getallkeys }\n\t\t\trescue Exception => e\n\t\t\t\trender :status => :unprocessable_entity,\n\t \t :json => { :response => \"fail\",\n\t \t :status => 401,\n\t :info => e.message }\n\t\t\tend\n\t\tend"
] |
[
"0.58994526",
"0.57494795",
"0.566004",
"0.5653021",
"0.5609994",
"0.560411",
"0.5559515",
"0.5545213",
"0.54951394",
"0.5490269",
"0.54600674",
"0.54600674",
"0.54400295",
"0.53958005",
"0.5394449",
"0.53844446",
"0.53773034",
"0.53699875",
"0.53424716",
"0.531775",
"0.5315415",
"0.53122234",
"0.53088033",
"0.5292771",
"0.52896523",
"0.5276327",
"0.5197802",
"0.5186898",
"0.5171044",
"0.5168487",
"0.5167966",
"0.5163286",
"0.514014",
"0.5126878",
"0.5118364",
"0.5115317",
"0.5111653",
"0.5103839",
"0.5103839",
"0.5083109",
"0.5058938",
"0.5056459",
"0.50539386",
"0.50222886",
"0.49904177",
"0.49898508",
"0.49882066",
"0.49806663",
"0.49718267",
"0.49692973",
"0.4956865",
"0.4950176",
"0.49499273",
"0.494152",
"0.49315044",
"0.49228832",
"0.49128932",
"0.49090284",
"0.49046886",
"0.49046886",
"0.4899282",
"0.48844954",
"0.4880019",
"0.48750824",
"0.48742306",
"0.48622605",
"0.4859562",
"0.48588857",
"0.4857825",
"0.4855083",
"0.48465857",
"0.48434877",
"0.4838174",
"0.48380208",
"0.48146957",
"0.48114526",
"0.48058414",
"0.47946146",
"0.47875038",
"0.4787248",
"0.47780252",
"0.4771874",
"0.4771874",
"0.4771874",
"0.4771874",
"0.4771874",
"0.4757771",
"0.47570604",
"0.47556645",
"0.47553787",
"0.4739423",
"0.4739423",
"0.47299233",
"0.47278705",
"0.47278705",
"0.47220352",
"0.47064465",
"0.47030678",
"0.4693817",
"0.46897703"
] |
0.71602386
|
0
|
Return a string representation of the point
|
def to_s
to_a.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n @points.join(' ')\n end",
"def to_s\n \"#{self.point.x},#{self.point.y},#{self.width},#{self.height}\"\n end",
"def to_s\n \"Point3: x #{x} y #{y} z #{z}\"\n end",
"def to_s\n \"#{@x}x#{@y}\"\n end",
"def to_s\n\t\tres = @x + \" \" + @p + \" \" + @o\n\t\tres\n\tend",
"def to_s\n\t\treturn \"x: #{x} y: #{y} value: #{value} \\n\"\n\tend",
"def to_s\n if points.empty?\n 'empty'\n elsif !valid?\n 'invalid ' + points.collect { |p| p.to_s }.join(\" \\u{2192} \")\n else\n points.collect { |p| p.to_s }.join(\" \\u{2192} \")\n end\n end",
"def to_s; \"#{@x}x#{@y}\"; end",
"def to_s\n \"#{@text} (#{@points} #{Sklonyator.sklonenie(@points, 'point', 'points', 'points')})\"\n end",
"def to_s\n format \"#{self.class.name} [%3.3f, %3.3f]\", x, y\n end",
"def to_s\n \"#{@x} #{@y} #{@orientation}\"\n end",
"def to_s\n \"#{identity} (#{latitude}; #{longitude})\"\n end",
"def to_s\n \"(#{@x}, #{@y}, #{@z})\" \n end",
"def to_s\n\t\t\"#{@x}, #{@y}, #{@direction}\"\n\tend",
"def to_s\n \"[#{@pos_x}, #{@pos_y}, #{@angle}]\"\n end",
"def\n\t\tprint_point\n\t\tp \"(#{x}, #{y})\"\t\n\tend",
"def to_s\n result = \"Polygon, Nr. of Points: #{@polygon_points.length}\"\n # @points.each { |point| result = result + point.to_s + ', '}\n\n return result\n end",
"def to_s\n result = \"Polygon, Nr. of Points: #{@polygon_points.length}\"\n # @points.each { |point| result = result + point.to_s + ', '}\n\n return result\n end",
"def to_s\n if @latitude >= 0\n latitude = @latitude.to_s + \" N\"\n else\n latitude = @latitude.abs.to_s + \" S\"\n end\n if @longitude >= 0\n longitude = @longitude.to_s + \" E\"\n else\n longitude = @longitude.abs.to_s + \" W\"\n end\n \"( \" + latitude + \", \" + longitude + \" )\"\n end",
"def to_s\n \"p(#{x}, #{y})\"\n end",
"def to_s\n \"n<#{@x}, #{@y}, #{@z}>\"\n end",
"def to_s\n \"v<#{@x}, #{@y}>\"\n end",
"def pp_points(points)\n \"[%s]\" % points.map { |point| \"%d: %d,%d\" % point }.join(\" \")\n end",
"def to_p\n Point2.new(@x, @y)\n end",
"def to_s\n \"#{@x}\"\n end",
"def point(x, y)\n primitive 'point ' + sprintf('%g,%g', x, y)\n end",
"def to_s\n \"X: #{value_or_not_available(@x)}, Y: #{value_or_not_available(@y)}, F: #{value_or_not_available(@f)}\"\n end",
"def to_s\n \"(#@x, #@y)\"\n end",
"def to_s\n\t\t\"(#{@x},#{@y})\"\n\tend",
"def to_s\n \"√(#{@x})\"\n end",
"def to_s\n \"p: #{p}, d: #{d}\"\n end",
"def to_s\n \"(#{x}, #{y})\"\n end",
"def to_s # :nodoc:\n \"#{ self.lattitude },#{ self.longitude } #{ self.radius }\"\n end",
"def to_s\n \"[#{@x},#{@y}]\"\n end",
"def to_s\n \"[#{@x},#{@y}]\"\n end",
"def to_s\n \"#{self.latitude},#{self.longitude}\"\n end",
"def to_s\n \"(#{@x},#{@y})\"\n end",
"def to_s\n \"(#{@x},#{@y})\"\n end",
"def to_s\n @vertices.to_s\n end",
"def to_s\n \"(%5.4f, %5.4f)\" % [x, y]\n end",
"def human_x_pos\n '%.2f' % points_to_human(x_pos) unless x_pos.nil?\n end",
"def to_s\n \"#@x, #@y\"\n end",
"def to_s\n \"#{@x}/#{@y}\"\n end",
"def to_s\n \"(#{@x}) / (#{@y})\"\n end",
"def to_s\n \"(#{x},#{y})\"\n end",
"def to_str\n \"#{@name} - #{@type}: @(#{@xPos},#{@yPos}), HP: #{@hp}, CP: #{@cp}, #{@life_cyc}\"\n end",
"def to_s\n \"#{south_latitude} #{west_longitude} #{north_latitude} #{east_longitude}\"\n end",
"def to_s\n \"#{lat},#{lng}\"\n end",
"def as_line_string\n GeoRuby::SimpleFeatures::LineString.from_points(@points)\n end",
"def to_s\n \"-#{@x}\"\n end",
"def as_s\n\t\"(#{x}, #{y})\"\n end",
"def to_s\n \"(#{latitude},#{longitude})\"\n end",
"def to_s\n \"(\" + x.to_s + \",\" + y.to_s + \",\" + z.to_s + \")\"\n end",
"def kml_representation(options = {}) #:nodoc:\n out = \"<Point#{options[:id_attr]}>\\n\"\n out += options[:geom_data] if options[:geom_data]\n out += \"<coordinates>#{x},#{y}\"\n out += \",#{options[:fixed_z] || z || 0}\" if options[:allow_z]\n out += \"</coordinates>\\n\"\n out + \"</Point>\\n\"\n end",
"def to_s\n \"(#{@x},#{@y},#{@z})\"\n end",
"def to_geojson_point\n if self.longitude && self.latitude\n \"{ 'type': 'Point', 'coordinates': [#{self.longitude}, #{self.latitude}]}\"\n else\n nil\n end\n end",
"def geom_coords\n# self.geom.geometry_n(0).y.to_s + \" \" + self.geom.geometry_n(0).x.to_s\n \"\" + self.latitude.to_s + \" \" + self.longitude.to_s\n end",
"def to_s\n circle.to_s\n end",
"def to_s\n @position.to_s\n end",
"def to_s\n \"(#{ x }, #{ y })\"\n end",
"def to_s\n \"|#{@x}|\"\n end",
"def text_representation(allow_z=true,allow_m=true) #:nodoc:\r\n \"(\" + @geometries.collect{|point| point.text_representation(allow_z,allow_m)}.join(\"),(\") + \")\"\r\n end",
"def point_x\n self.coord.split(\"_\")[0]\n end",
"def kml_representation(options = {}) #:nodoc: \r\n result = \"<Point#{options[:id_attr]}>\\n\"\r\n result += options[:geom_data] if options[:geom_data]\r\n result += \"<coordinates>#{x},#{y}\"\r\n result += \",#{options[:fixed_z] || z ||0}\" if options[:allow_z]\r\n result += \"</coordinates>\\n\"\r\n result += \"</Point>\\n\"\r\n end",
"def to_s\n result = \"Waypoint \\n\"\n result << \"\\tName: #{name}\\n\"\n result << \"\\tLatitude: #{lat} \\n\"\n result << \"\\tLongitude: #{lon} \\n\"\n result << \"\\tElevation: #{elevation}\\n \"\n result << \"\\tTime: #{time}\\n\"\n SUB_ELEMENTS.each do |sub_element_attribute|\n val = send(sub_element_attribute)\n result << \"\\t#{sub_element_attribute}: #{val}\\n\" unless val.nil?\n end\n result\n end",
"def to_s\n \"#{codepoint} (#{name})\"\n end",
"def to_p\n Point3.new(@x, @y, @z)\n end",
"def to_s\n #@value\n \"P\"\n end",
"def pan_string()\n pan_body().join(',') + \".\"\n end",
"def to_s\n\t\t\"Road: #{@loc1} <--> #{@loc2}, distance = #{@distance}\"\n\tend",
"def to_s\n @g.to_s\n end",
"def to_s\n \"Position <#{@row}, #{@col}>\"\n end",
"def to_s\n puts \"Your Mars rover is at #{@x_axis}, #{@y_axis}, #{@direction}\"\n end",
"def to_gpos\n Point[ self.x, self.y ]\n end",
"def to_s\n \"#{position[0]} #{position[1]} #{@direction}\"\n end",
"def to_s\n \"#{@color}, #{@fillType}, #{@shapeType}, #{@numberOfSymbols}\"\n end",
"def print_location\n\t\t@location.print_point\t\n\tend",
"def to_s\n \"#{@name} - #{@sign}\"\n end",
"def to_s\n return canvas.to_s\n end",
"def display #or name it to_s #puts searches for this when you call method\n\t\t\"(#{@x}, #{@y})\" #makes it look nicer when setting it to string when calling initialize method\n\tend",
"def coordinates\n \"Xmin:%s Ymin:%s Xmax:%s Ymax:%s\" % [x_min, y_min, x_max, y_max]\n end",
"def toString\n\t\t\t\"#{@degrees.round(2)} #{@scale}\"\n\t\tend",
"def x\n @point[0]\n end",
"def to_str\n\t\t'Player %d\\n\\nScore: %.2f\\n' % [self.idNum, self.points]\n\tend",
"def to_s()\n puts \"#{@name} has #{@hitpoint} hitpoints and #{@attack_damage} attack damage\"\n end",
"def to_s\n str = String.new\n if @width > 0\n fmt = @width.truncate == @width ? '%d' : '%.2f'\n str << sprintf(fmt, @width)\n str << '%' if @flag == PercentGeometry\n end\n\n str << 'x' if (@width > 0 && @flag != PercentGeometry) || (@height > 0)\n\n if @height > 0\n fmt = @height.truncate == @height ? '%d' : '%.2f'\n str << sprintf(fmt, @height)\n str << '%' if @flag == PercentGeometry\n end\n str << sprintf('%+d%+d', @x, @y) if @x != 0 || @y != 0\n str << FLAGS[@flag.to_i] if @flag != PercentGeometry\n str\n end",
"def to_s\n \n \"#{@n}/#{@d}\" \n end",
"def toString()\n return \"Vecteur: (\" + @length.to_s + \" : \" + @direction.to_s + \")\" \n end",
"def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates.last\n else\n append_list coordinates, x, y\n end\n lon = x.reduce(&:+) / x.size\n lat = y.reduce(&:+) / y.size\n [lon.round(7), lat.round(7)]\n end",
"def to_s\n \"#{@name}(#{@x.map(&:to_s).join(\", \")})\"\n end",
"def to_s\n @location\n end",
"def to_s\n @location\n end",
"def position\n\t\treturn \"#{@x} #{@y} #{PlanetModel::ORIENTATIONS.invert[@angle.abs % 360].to_s}#{if @lost == true then ' LOST' end}\"\t\n\tend",
"def to_openscad\n \"[#{points.collect { |p| p.to_openscad }.join(', ')}]\"\n end",
"def points_segno_to_str(points_info)\r\n str = \"tot = #{points_info[:tot]}, scope = #{points_info[:scopa]}, 7d = #{points_info[:setbel]}, car = #{points_info[:carte ]}, den = #{points_info[:denari]}, prim = #{points_info[:primiera]}\"\r\n if @game_opt[:vale_napola]\r\n str.concat(\", nap = #{points_info[:napola]}\")\r\n end\r\n return str\r\n end",
"def to_point\n size = attribute :size\n point = attribute :position\n point.x += size.width / 2\n point.y += size.height / 2\n point\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end"
] |
[
"0.8156014",
"0.77980584",
"0.74595326",
"0.74361134",
"0.7407275",
"0.73738533",
"0.73225415",
"0.7311288",
"0.72720766",
"0.72513616",
"0.72445565",
"0.7189561",
"0.71260697",
"0.7121916",
"0.7109155",
"0.70897114",
"0.70413196",
"0.70413196",
"0.7039846",
"0.6978337",
"0.69546384",
"0.6946094",
"0.6861296",
"0.68574095",
"0.6855593",
"0.6852973",
"0.68339777",
"0.6814328",
"0.6781594",
"0.67774963",
"0.6732387",
"0.6730578",
"0.67021376",
"0.6695914",
"0.6695914",
"0.66806775",
"0.6664557",
"0.6664557",
"0.6656146",
"0.66355586",
"0.6597948",
"0.6587345",
"0.65755767",
"0.6514744",
"0.64863175",
"0.64834917",
"0.6474982",
"0.6471916",
"0.64687735",
"0.64586383",
"0.64299756",
"0.6426261",
"0.6425759",
"0.641763",
"0.64154845",
"0.6412022",
"0.64030075",
"0.6398355",
"0.6355033",
"0.63343674",
"0.6298141",
"0.6296227",
"0.62957734",
"0.6295026",
"0.628656",
"0.6257369",
"0.6229631",
"0.62217766",
"0.6197279",
"0.61924964",
"0.6182075",
"0.61816114",
"0.617966",
"0.61648726",
"0.616479",
"0.61598456",
"0.61552674",
"0.61534256",
"0.61486095",
"0.6139039",
"0.6123886",
"0.6110453",
"0.61053884",
"0.6067086",
"0.6066843",
"0.6044793",
"0.6039249",
"0.6033142",
"0.60253525",
"0.6016529",
"0.6014486",
"0.6014486",
"0.6013285",
"0.60131466",
"0.60088444",
"0.6001785",
"0.59999955",
"0.59999955",
"0.59999955",
"0.59999955",
"0.59999955"
] |
0.0
|
-1
|
Stash the setting directive and its value into the configuration file using the default settings group.
|
def set key_name, key_value
raise ArgumentError, "Cannot set a Nil (section)" if @section.nil?
raise ArgumentError, "Cannot set a Nil key name." if key_name.nil?
raise ArgumentError, "Cannot set a Nil key value" if key_value.nil?
create_entry( @section, key_name, key_value )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def settings=(value)\n @settings = value\n end",
"def settings=(value)\n @settings = value\n end",
"def set_defaultsettings\n AppSettings.item.to_hash.each do |setting, value|\n s = RailsSettings::Settings.new \n s.var = setting.to_s\n s.value = value[:default]\n s.thing_id = self.id\n s.thing_type = \"Group\" \n s.save\n end\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def app_settings=(value)\n @children['app-settings'][:value] = value\n end",
"def set_setting\n end",
"def call\n setting_item = build_setting_item(name, type, default)\n register_setting setting_item\n define_setting setting_item\n setting_item\n end",
"def setting=(value)\n @setting = value\n end",
"def setting(setting_name, setting_value)\n setting_specs << {:name => setting_name.to_s, :value => setting_value.to_s, :config_line => get_config_line(caller)}\n end",
"def write_config\n # Allow disabling the local settings.\n return unless new_resource.local_settings_path\n file new_resource.local_settings_path do\n content new_resource.local_settings_content\n mode '640'\n owner new_resource.parent.owner\n group new_resource.parent.group\n end\n end",
"def config=(value); end",
"def setting; end",
"def settings=(_arg0); end",
"def settings=(_arg0); end",
"def configure_setting(name, value)\n configure do |settings|\n settings.unset!(name)\n settings[name] = parse_setting(settings.setting(name), value)\n end\n end",
"def dump_settings\n File.open(SETTINGS_FILE, 'w') do |out|\n YAML.dump( { :targets => @targets, :src => @src }, out)\n end\n end",
"def setting_params\n params.require(:setting).permit(:namespace, :value)\n end",
"def settings\n @settings ||= {}\n end",
"def call(value)\n Datadog.logger.debug { \"Reconfigured tracer option `#{@setting_key}` with value `#{value}`\" }\n\n if value.nil?\n # Restore the local configuration value\n configuration_object.unset_option(\n @setting_key,\n precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION\n )\n else\n configuration_object.set_option(\n @setting_key,\n value,\n precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION\n )\n end\n end",
"def process_setting_specs\n setting_specs.each do |setting_spec|\n RFlow.logger.debug \"Found config file setting '#{setting_spec[:name]}' = (#{Dir.getwd}) '#{setting_spec[:value]}'\"\n RFlow::Configuration::Setting.create! :name => setting_spec[:name], :value => setting_spec[:value]\n end\n end",
"def config_set_app_setting(document, settingName, settingValue)\n\t config_set_attribute(document, '//configuration/appSettings/add', 'key', settingName, 'value', settingValue)\n\tend",
"def set_setting\n ap @setting = Setting.first\n end",
"def settings\n @settings ||= {}\n end",
"def config_file_settings\n Chef::Config[:knife].save(false) # this is like \"dup\" to a (real) Hash, and does not include default values (just user set values)\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def set_general_settings_value(index, value)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if value.handle.ptr == nil\n raise \"value is disposed\"\n end\n Native.LayoutEditor_set_general_settings_value(@handle.ptr, index, value.handle.ptr)\n value.handle.ptr = nil\n end",
"def settings=(setting_options = [])\n # for arrays, set in raw form \n @settings = if setting_options.is_a?(Array)\n setting_options\n # set optional shortcuts for settings\n # :keyword_match_setting => { :opt_in => false } # =>\n # { :xsi_type => 'KeywordMatchSetting', :opt_in => false }\n elsif setting_options.is_a?(Hash)\n setting_options.map do |key, values|\n { :xsi_type => key.to_s.camelcase }.merge(values).symbolize_keys\n end\n end\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def enforced_settings=(value)\n @enforced_settings = value\n end",
"def set_defaultsettings\r\n AppSettings.item.to_hash.each do |setting, value|\r\n s = RailsSettings::Settings.new \r\n s.var = setting.to_s\r\n s.value = value[:default]\r\n s.thing_id = self.id\r\n s.thing_type = \"Item\" \r\n s.save\r\n end\r\n end",
"def e_set_setting(key, value)\n set_option(key, value, '_setting_ecommerce')\n end",
"def set_setting\n @setting = Setting.first\n end",
"def update_yaml_setting(yaml, key, setting, default)\n unless yaml[key][setting]\n yaml[key][setting] = default\n File.open(yaml_path, 'w') {|f|\n f.write(yaml.to_yaml)\n }\n @formatter.config_updated(yaml_path)\n end\n end",
"def set(k, v)\n settings[k.to_sym] = v\n end",
"def update_setting!(setting: nil)\n existing = find_setting(setting_key: setting.key)\n existing.value = setting.value\n self.settings = settings\n end",
"def add_setting(header, name, value)\n raise DuplicateSetting if setting_exists?(header, name)\n\n new_setting = %Q{[#{ header }]\\n#{ name } = #{ value }\\n}\n write do\n if contents.nil?\n new_setting\n elsif contents.scan(header_regexp(header)).empty?\n contents << \"\\n\\n#{ new_setting }\"\n else\n contents.gsub(header_regexp(header), new_setting)\n end\n end\n end",
"def set(setting, value)\n setting = setting.to_sym\n if setting == :estream\n self.estream = value\n elsif setting == :ostream\n self.ostream = value\n else\n @settings[setting.to_sym] = value\n end\n end",
"def save_settings settings\n File.open(@settings_file, 'w') {|file| file << YAML::dump(settings)}\n end",
"def settings\n @settings ||= self.class.settings.dup\n end",
"def settings; end",
"def settings; end",
"def settings=(new_settings)\n settings.merge!(new_settings)\n end",
"def settings\n {}\n end",
"def settings\n {}\n end",
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def settings_write(settings_hash = active_values, name: nil)\n File.open settings_path(name), 'w' do |f|\n f.write settings_hash.to_yaml\n end\n end",
"def settings\n end",
"def settings\n # TODO\n {}\n end",
"def load_settings(other_settings)\n other_settings.each do |setting|\n new_setting = define_setting(setting.key, setting.default, setting.description, setting.options)\n new_setting.value = setting.value if setting.value_set?\n end\n end",
"def store_in_buffer_setting(key, value)\n if key == \"OPTIONS\"\n\n # Options are stored in a hash. Special-case.\n value.scan(/([^ ]*):((((\\(.*\\))))|([^ ])*)/) do |o, v|\n @options[o] = v\n end\n elsif key =~ /^(TODO|SEQ_TODO|TYP_TODO)$/\n # Handle todo keywords specially.\n value.split.each do |keyword|\n keyword.gsub!(/\\(.*\\)/, \"\") # Get rid of any parenthetical notes\n keyword = Regexp.escape(keyword)\n next if keyword == \"\\\\|\" # Special character in the todo format, not really a keyword\n @custom_keywords << keyword\n end\n else\n @in_buffer_settings[key] = value\n end\n end",
"def set(k, v)\n settings[k.to_sym] = v\n end",
"def firewall_merge_keying_module_settings=(value)\n @firewall_merge_keying_module_settings = value\n end",
"def setting(nested_key, value)\n settings.set(nested_key, value)\n save_settings!\n end",
"def []=(namespace = :default, index, value)\n obj = get_setting(namespace, index)\n if obj\n obj.instance_eval do\n write_attribute(setting_value_field, value)\n end\n obj.save\n write_cache(obj)\n else\n obj = write_cache(self.create(setting_name_field => index, setting_namespace_field => namespace, setting_value_field => value))\n end\n end",
"def []=(key, value)\n @settings[@key] << \"#{key}=#{value}\"\n end",
"def register_settings(settings)\n settings.each do |key, default_value|\n register_setting(key, default_value)\n end\n end",
"def setting_params\n params.require(:setting).permit(:var, :value)\n end",
"def save_settings(filename, settings)\n require 'yaml'\n\n File.open(filename, 'w') do |file|\n file.write(settings.to_yaml)\n Log.instance.info(\"Settings written to [ #{filename} ]\")\n end\n end",
"def setting_name=(value)\n @setting_name = value\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def edit_config(key, _options = {})\n setting = setting_for(key)\n domkey = key.gsub(/\\W/, '_')\n name = \"trusty_config[#{key}]\"\n title = t(\"trusty_config.#{key}\").titlecase\n title << content_tag(:span, \" (#{t(\"units.#{setting.units}\")})\", class: 'units') if setting.units\n value = params[key.to_sym].nil? ? setting.value : params[key.to_sym]\n html = ''\n if setting.boolean?\n html << hidden_field_tag(name, 0)\n html << check_box_tag(name, 1, value, class: 'setting', id: domkey)\n html << content_tag(:label, title.html_safe, class: 'checkbox', for: domkey)\n elsif setting.selector?\n html << content_tag(:label, title.html_safe, for: domkey)\n html << select_tag(name, options_for_select(setting.definition.selection, value), class: 'setting', id: domkey)\n else\n html << content_tag(:label, title.html_safe, for: domkey)\n html << text_field_tag(name, value, class: 'textbox', id: domkey)\n end\n if setting.errors[:value].present?\n html << content_tag(:span, [setting.errors[:value]].flatten.first, class: 'error')\n html = content_tag(:span, html.html_safe, class: 'error-with-field')\n end\n html.html_safe\n end",
"def settings\n {}\n end",
"def set(setting, value = nil)\n if value\n command \"set #{setting}=#{value}\"\n else\n command \"set #{setting}\"\n end\n self\n end",
"def add_setting(setting_key, setting_val)\n @settings[setting_key.to_sym] = setting_val\n end",
"def save_settings(settings)\n %x{ mkdir #{ENV[\"HOME\"]}/.wts-reader } unless File.directory?(\"#{ENV[\"HOME\"]}/.wts-reader\")\n File.open(ENV[\"HOME\"] + \"/.wts-reader/settings.txt\", 'w') do |file| \n file.write(\"Rate:#{settings[:rate]}\\nVoice:#{settings[:voice]}\\nPath:#{settings[:path] || '/tmp/'}\\n\")\n end\n end",
"def settings(&block)\n @settings ||= setup\n\n settings = instance_variable_defined?(:@namespace) ? @settings.get_value(@namespace) : @settings\n\n if block_given?\n block.arity == 0 ? settings.instance_eval(&block) : block.call(settings)\n end\n\n settings\n end",
"def set(key, value)\n settings.send :\"#{key}=\", value\n end",
"def setting_params\n params.permit(:setting, :key, :value, :location) #, :key, :value, :location, #:system_node_id )\n end",
"def settings\n @settings ||= Settings.new(DEFAULT_SETTINGS_PATH)\n end",
"def set_settings\r\n @settings[\"deck_name\"] = @curr_deck_key if @curr_deck_key\r\n end",
"def putGlobal(key, value)\n if !@@INITIALIZED\n init(false)\n end\n @@SETTINGS[key] = value\n end",
"def settings_string(name, prop_name, conf_name, owner_id = 0, html_options = {})\n settings_group_line(name, html_options[:tip]) {\n text_field_tag(prop_name.to_s, Confline.get_value(conf_name.to_s, owner_id).to_s,\n {\"class\" => \"input\", :size => \"35\", :maxlength => \"50\"}.merge(html_options))\n }\n end",
"def package_settings=(opts)\n reinstall(opts)\n end",
"def package_settings=(opts)\n reinstall(opts)\n end",
"def write()\n open(CurrentFilename, 'w'){|fp|\n Marshal.dump(@current_setting, fp)\n }\n end",
"def setter(section, setting, value)\n method = \"#{setting}=\"\n section.send(method, value) if section.respond_to?(method)\n end",
"def setting_params\n params.require(:setting).permit(:name, :value)\n end",
"def set(domain, key, value, type = nil)\n command = ['defaults', 'write', domain, key]\n command << \"-#{type}\" unless type.nil?\n command << value.to_s\n log command.join(' ')\n shell!(*command)\n end",
"def set_default(key, value)\n settings.send :\"#{key}=\", value unless settings.send(:\"#{key}?\")\n end",
"def setting(name)\n @_settings = {} unless @_settings\n\n unless @_settings.include? name.to_sym\n begin\n @_settings[name.to_sym] = Setting.find_by(name: name.to_s).value\n rescue\n @_settings[name.to_sym] = nil\n end\n end\n\n @_settings[name.to_sym]\n end",
"def set_system_setting\n @system_setting = System.settings\n end",
"def setting_params\n params.fetch(:setting, {}).permit(:key, :value)\n end",
"def passed_settings\n customized_setting = setting.attributes\n ['id', 'user_id', 'updated_at', 'created_at'].each do |attr|\n customized_setting.delete(attr)\n end\n customized_setting\n end",
"def settings(key)\n ENV[key.to_s.upcase] || monk_settings(key)\nend",
"def settings\n @settings ||= settings_class&.new(self)\n end",
"def save\n save_status = true\n original_setting_ids = @manager.configurable.active_configuration_settings.with_key(@key).collect(&:id)\n replaced_setting_ids = []\n\n [value].flatten.each do |value_with_modifier|\n if (setting = @manager.configurable.active_configuration_settings.create(:key => @key, :modifier => value_with_modifier[:modifier], :value => value_with_modifier[:value])).new_record?\n save_status = false && break\n else\n replaced_setting_ids << setting.id\n end\n end\n\n @manager.configurable.active_configuration_settings.reload\n @manager.configurable.active_configuration_settings.with_key(@key).where(:id => (save_status ? original_setting_ids : replaced_setting_ids)).destroy_all\n\n @manager.settings.delete(@key)\n\n return save_status\n end",
"def configure(settings = {})\n defaults.merge(settings).each do |key, value|\n set key, value\n end\n end",
"def setting(name)\n @settings[normalize_key(name)]\n end",
"def settings\n @settings ||= OpenStruct.new(opts[:dm_config].first)\n # dm_js_location, dm_css_location\n # dm_js_location: javascripts\n # dm_css_location: stylesheets\n end",
"def settings_groups\n @settings_groups ||= {}\n end",
"def capture_and_excise_settings( tool_proxy, tool )\n settings = tool_proxy['custom']\n if settings.present?\n Lti2Tc::ToolSetting.where( :scopeable_type => 'Tool', :tool_id => tool.id ).delete_all\n\n settings.each_pair do |k,v|\n ts = Lti2Tc::ToolSetting.create(\n :scopeable_type => 'Tool',\n :tool_id => tool.id,\n :scopeable_id => tool.id,\n :name => k,\n :value => v\n )\n ts.save\n end\n\n tool_proxy.delete( 'custom' )\n\n end\n end",
"def set(setting, value=setting)\n case setting.class.to_s\n when 'Hash'\n settings.merge!(value)\n when 'String', 'Symbol'\n settings[setting.to_sym] = value\n else\n raise ArgumentError, \"setting must be a symbol, string or hash\"\n end\n end",
"def to_config\n require_relative '../../puppet/util/docs'\n # Scrub any funky indentation; comment out description.\n str = Puppet::Util::Docs.scrub(@desc).gsub(/^/, \"# \") + \"\\n\"\n\n # Add in a statement about the default.\n str << \"# The default value is '#{default(true)}'.\\n\" if default(true)\n\n # If the value has not been overridden, then print it out commented\n # and unconverted, so it's clear that that's the default and how it\n # works.\n value = @settings.value(self.name)\n\n if value != @default\n line = \"#{@name} = #{value}\"\n else\n line = \"# #{@name} = #{@default}\"\n end\n\n str << (line + \"\\n\")\n\n # Indent\n str.gsub(/^/, \" \")\n end",
"def set_user_settings\n @settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)\n end",
"def replace_cmd\n sprintf 'sed -i \"s/%s.*/%s%s/\" %s', key_set_string, key_set_string, @config[:value], @file\n end",
"def delete_setting!(header, name)\n write do \n contents.gsub(find_setting(header, name), '')\n end\n end",
"def default_settings=(hash)\n @default_settings = hash\n end",
"def save_settings\n File.open( @settings_filename, 'w' ) do |out|\n YAML.dump( @app_settings, out )\n end\n @log.debug \"Settings saved into #{@settings_filename}\"\n end",
"def settings\n attributes.fetch(:settings)\n end"
] |
[
"0.61635673",
"0.61635673",
"0.611656",
"0.60383666",
"0.60383666",
"0.60204613",
"0.6017294",
"0.59521437",
"0.59242684",
"0.59076154",
"0.5905986",
"0.58562183",
"0.581113",
"0.581113",
"0.5778953",
"0.5773501",
"0.57558894",
"0.5753522",
"0.57330954",
"0.5728939",
"0.5726926",
"0.5723114",
"0.57013667",
"0.569287",
"0.56698334",
"0.56698334",
"0.56680024",
"0.565016",
"0.5635979",
"0.5630322",
"0.5627751",
"0.5620757",
"0.55809426",
"0.556981",
"0.55611145",
"0.55398166",
"0.5539319",
"0.5524651",
"0.55114603",
"0.5504754",
"0.5503224",
"0.54996663",
"0.54996663",
"0.5495645",
"0.5489919",
"0.5489919",
"0.54870766",
"0.5484963",
"0.548158",
"0.5466617",
"0.54664034",
"0.54635316",
"0.5463483",
"0.546171",
"0.54552096",
"0.54543835",
"0.5454153",
"0.54520315",
"0.54518974",
"0.5414841",
"0.54066545",
"0.5405196",
"0.5391189",
"0.5388565",
"0.5376216",
"0.5366613",
"0.5359877",
"0.53502446",
"0.53433603",
"0.534128",
"0.53393424",
"0.5332776",
"0.53234994",
"0.53231233",
"0.5318668",
"0.5318668",
"0.53128695",
"0.53103393",
"0.52978253",
"0.5295929",
"0.52816343",
"0.52749497",
"0.52577305",
"0.5254918",
"0.52537197",
"0.52533054",
"0.5246612",
"0.52338225",
"0.5230255",
"0.5230004",
"0.522407",
"0.52237654",
"0.52164114",
"0.5212746",
"0.52084655",
"0.52066225",
"0.5204557",
"0.52045137",
"0.520332",
"0.5202094",
"0.51997066"
] |
0.0
|
-1
|
Create a new key value entry inside a dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one more entry than it need even if it did not previously exist.
|
def create_entry( dictionary_name, key_name, value )
KeyError.not_new( dictionary_name, self )
KeyError.not_new( key_name, self )
KeyError.not_new( value, self )
self[ dictionary_name ] = {} unless self.has_key?( dictionary_name )
self[ dictionary_name ][ key_name ] = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add(name, key)\n issueKey_test(key)\n fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})\n end",
"def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend",
"def add_a_key_value_pair\n new_hash = create_olympics_hash\n new_hash[:Atlanta] = \"1996\"\n new_hash\nend",
"def add(aName,aDataArray,aValue,reply)\n i = searchKey(aName,aDataArray[1])\n if i != '' then\n returnStorage(reply,false)\n else\n insertKey(aName,aDataArray,aValue)\n returnStorage(reply,true)\n end\n end",
"def create(k, v)\n # just anal about logging sql, so heres this\n logger.debug settings.db[:cfg_map].insert_sql(map_key: k, map_val: v)\n\n # actually create the row. returns the id of the new record\n settings.db[:cfg_map].insert(map_key: k, map_val: v)\n end",
"def create_if_not_exists(hash, key, val, name: key.to_sym)\n return if hash.key?(key)\n\n self.class.send(:attr_accessor, name)\n send(\"#{name}=\", val)\n end",
"def create_if_exists(hash, *args, name:)\n exists = false\n args.each do |key|\n exists = false\n break unless hash.is_a?(Hash)\n\n exists = hash.key?(key)\n break unless exists\n\n hash = hash[key]\n end\n return unless exists\n return if respond_to?(name) && !send(name).nil?\n\n self.class.send(:attr_accessor, name)\n send(\"#{name}=\", hash)\n end",
"def add(r)\n db[r.name] = r\n end",
"def insertMapping(name, id)\n row = DatabaseManager.row('SYMPLECTIC_COLL_MAP')\n row.setColumn('key_text', name)\n row.setColumn('collection_id', id)\n DatabaseManager.insert(DSpace.context, row)\nend",
"def new_entry(key, key_hash, value)\n if key.kind_of?(String) and !key.frozen?\n key = key.dup\n key.freeze\n end\n\n @size += 1\n Entry.new key, key_hash, value\n end",
"def set key_name, key_value\n raise ArgumentError, \"Cannot set a Nil (section)\" if @section.nil?\n raise ArgumentError, \"Cannot set a Nil key name.\" if key_name.nil?\n raise ArgumentError, \"Cannot set a Nil key value\" if key_value.nil?\n create_entry( @section, key_name, key_value )\n end",
"def add_entry(database,first_key,second_key,value)#add an entry to database.\n \t\tif database.has_key? first_key #nested dict\n\t\t\t\tdatabase[first_key][second_key]=value\n\t\t\telse\n\t\t\t\tdatabase[first_key]={second_key=>value} #build new dict to hold movie:rate_score\n\t\t\tend\n end",
"def put(namespace, key, entry); end",
"def addFood(newFood)\n name = newFood.name\n if @base.has_key?(name.downcase)\n puts(\"Database already contains this food\")\n else\n @base[name.downcase] = newFood\n end\n end",
"def find_or_create(name)\n storage.fetch(name) do\n Vedeu.log(\"Entity (#{entity}) not found, registering: '#{name}'\")\n\n storage.store(name, entity.new({ name: name }))\n end\n end",
"def find_or_create(name)\n raise unless name.is_a?(String)\n @cache[name] ||= @name_generator.next\n end",
"def testResults(a_hash, name)\r\n\ta_hash[name] = Hash.new\r\n\ta_hash[name] = {\r\n\t\tmood: \"good\",\r\n\t\tloves: \"Mother\",\r\n\t\tage: \"24\",\r\n\t\tsmart: \"y\",\r\n\t\tmichael: \"y\",\r\n\t\tintrovert: \"extrovert\",\r\n\t\tcolor: \"green\",\r\n\t\tcandy: \"skittles\",\r\n\t\twants_candy: \"y\",\r\n\t\thappy: \"y\"\r\n\t}\r\nend",
"def new_top_level(school, key, value)\n school[key.to_sym] = value\nend",
"def set(aName,aDataArray,aValue,reply)\n i = searchKey(aName,aDataArray[1])\n if i != '' then\n updateKey(aName,aDataArray,aValue,i)\n returnStorage(reply,true)\n else\n insertKey(aName,aDataArray,aValue)\n returnStorage(reply,true)\n end\n end",
"def add(name, &block)\n new_node = self.children.create!(:name => name.to_s)\n yield(new_node) if block_given?\n end",
"def create_db name\n \n req = Net::HTTP::Put.new \"/#{name}\"\n ret = @http.request req\n \n puts \"Creating Database #{name} => #{ret.msg} (#{ret.code})\\n\"\n \n end",
"def add(name, focus = false)\n if registered?(name)\n return storage unless focus\n\n by_name(name)\n storage\n\n else\n Vedeu.log(type: :store, message: \"Storing focus entry: '#{name}'\")\n\n if focus\n storage.unshift(name)\n\n else\n storage.push(name)\n\n end\n end\n end",
"def store_new_local(name)\n @parent.store_new_local(name)\n end",
"def store_new_local(name)\n @parent.store_new_local(name)\n end",
"def add_to_index(name, key, node); end",
"def write_entry(key, entry, options)\n if options && options[:unless_exist]\n @hash.add(key, entry)\n else\n @hash[key] = entry\n end\n end",
"def create_change\n @change_depth += 1\n save\n save_key(1, @change_depth, derive_key(1, @change_depth))\n end",
"def add_entry(name)\n Library.create(name: name)\n end",
"def write(key, value, options = {})\n entry = ::Elephas::Entry.ensure(value, key, options)\n entry.refresh\n @data[key] = entry\n entry\n end",
"def add_entry(name, *options)\r\n option_list = SymMap.spec.select(options)\r\n error \"Symbol entry for #{name} already exists\" if has_entry?(name)\r\n\r\n SymMap.sync.synchronize do\r\n symbol = (SymMap.incrementer.succ!).to_sym\r\n entry = SymEntry.new(name,\r\n symbol,\r\n option_list.sym_type,\r\n option_list.immediate?,\r\n &option_list.block)\r\n @fwd_map[name] = entry\r\n @rev_map[symbol] = entry\r\n end\r\n end",
"def put_hash(name, hash)\n file_name = File.join(@db_dir, name + '.json')\n begin\n RobustFile.write(file_name, hash.to_json)\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write hash file '#{file_name}': #{e.message}\"\n end\n end",
"def store(keyname, value)\n @keystore.store(key: keyname, value: value)\n end",
"def insert(key, child)\n\t\t\t\tif key\n\t\t\t\t\t@keyed[key] = Keyed.new(key, child)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tstate = {}\n\t\t\t\t\n\t\t\t\t@state[child] = state\n\t\t\t\t\n\t\t\t\treturn state\n\t\t\tend",
"def add(name, focus = false)\n if registered?(name)\n return storage unless focus\n\n by_name(name)\n\n else\n Vedeu.log(type: :store,\n message: \"Storing focus entry: '#{name}'\")\n\n focus ? storage.unshift(name) : storage.push(name)\n end\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n if !@root \n @root = new_node\n return \n end\n add_node(new_node, @root)\n\n end",
"def add(key, value)\n current_and_parent_pair = find_current_and_parent_nodes(key)\n if current_and_parent_pair[:current]\n # update new value if key exists\n current_and_parent_pair[:current].value = value\n else\n new_node = TreeNode.new(key,value)\n parent = current_and_parent_pair[:parent]\n link_node_to_parent(parent, new_node)\n end\n end",
"def add(key, value)\n new_nodelet = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_nodelet \n else \n @root = add_helper(@root, new_nodelet)\n end \n end",
"def add(key, value)\n index = key_index(key)\n\n # Only happens if we didn't check the presence before calling this method\n return nil if index == -1\n\n rehash_step if rehashing?\n\n hash_table = rehashing? ? rehashing_table : main_table\n entry = hash_table.table[index]\n\n entry = entry.next while entry && entry.key != key\n\n if entry.nil?\n entry = DictEntry.new(key, value)\n entry.next = hash_table.table[index]\n hash_table.table[index] = entry\n hash_table.used += 1\n else\n raise \"Unexpectedly found an entry with same key when trying to add #{ key } / #{ value }\"\n end\n end",
"def add_recipe(name, foods)\n # Check if any items in foods don't exist in DB\n foods.each do |food|\n if not @basic_foods.has_key? food and not @recipes.has_key? food\n puts \"Food doesn't exist in DB\"\n return\n end\n end\n # Check if name already exists in hash tables\n if @basic_foods.has_key? name or @recipes.has_key? name\n puts \"Food already exists in DB\"\n else\n @recipes[name] = Recipe.new(name, foods)\n end\n end",
"def makeEntry(hash, e)\n hash[e.id] = {\n name: e.public_name,\n createTimestamp: e.createTimestamp,\n }\n if e.banned?\n hash[e.id][:noLogin] = true\n else\n # Don't publish urls for banned logins\n unless e.urls.empty?\n # need to sort to avoid random changes which seem to occur for urls\n hash[e.id][:urls] = e.urls.sort\n end\n # only add entry if there is a fingerprint\n unless e.pgp_key_fingerprints.empty?\n # need to sort to avoid random changes which seem to occur for fingerprints\n hash[e.id][:key_fingerprints] = e.pgp_key_fingerprints.sort\n end\n end\nend",
"def enterGlobal(name)\n path = findGlobalPath\n if path.empty?\n path.addName(name)\n return self[name] = SymTabGen.generateEntry(name,path,@level + 1)\n elsif path.hasChild?\n root = path.getRoot\n raise RunTimeError, \"Unexisting symbol table path '#{path.to_s}'\" unless @root == root\n return self[root].sendEnterLocal(path.getChild,name)\n else\n root = path.getRoot\n raise RunTimeError, \"Unexisting symbol table path '#{path.to_s}'\" unless @root == root\n return self[root].enterLocal(name)\n end\n end",
"def put(key,value)\n open\n db[key] = value\n close \n end",
"def put(key, value)\n @root = put_rec(@root, key, value, 0)\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root == nil\n @root = new_node\n else\n add_node(@root, new_node)\n end\n end",
"def insert key, value\n begin\n db.putnr(key, value)\n rescue StandardError => e ; handle_error(\"Insert #{[key, value].inspect}\", e); end\n end",
"def add_key(key, value, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#di. create method to add keys & values\n\tschool[key] = value\nend",
"def new(name)\n self[name]\n end",
"def newkey(key, value, schoolvar)\n\tschoolvar[key] = value \nend",
"def add(key, value)\n new_node = TreeNode.new(key,value)\n \n if @root.nil?\n @root = new_node\n else \n add_helper(@root, key, value)\n end\n end",
"def create!\n @etcd_node = etcd.set(etcd_key, value: to_json, prevExist: false).node\n end",
"def rename(entry, new_name, &continue_on_exists_proc)\n found_entry = get_entry(entry)\n check_entry_exists(new_name, continue_on_exists_proc, 'rename')\n @entry_set.delete(found_entry)\n found_entry.name = new_name\n @entry_set << found_entry\n end",
"def create(name)\n url = prefix + \"create\" + \"&name=#{name}\"\n return response(url)\n end",
"def create(pvt)\n key(pvt).addr\n end",
"def enterLocal(name)\n unless @currentPath.empty?\n if @currentPath.hasChild?\n toReturn = self[@root].sendEnterLocal(@currentPath.getChild,name)\n else\n toReturn = self[@root].enterLocal(name)\n end\n addNameToPath(name)\n else\n addNameToPath(name)\n toReturn = self[name] = SymTabGen.generateEntry(name,@currentPath,@level + 1)\n end\n toReturn\n end",
"def create_or_update(entry)\n EntryRepository.create(entry)\n rescue Hanami::Model::UniqueConstraintViolationError\n entry = read(entry.key)\n database.update(entry)\n rescue Hanami::Model::Error => err\n database.create(entry)\n end",
"def add_new_child(name)\n\tnew_child = Child.new(name)\n\tnew_hash = {}\n\tnew_child.instance_variables.each {|item| new_hash[item.to_s.delete('@')] = new_child.instance_variable_get(item)}\n\tChildren[\"children\"].push(new_hash)\n\tupdate_file('children.yaml', Children)\nend",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node \n else \n @root = add_helper(@root, new_node)\n end\n\n end",
"def create_new_entry()\n\tputs \"You are adding a new entry.\"\n\tentry = {}\n\tputs \"First name:\"\n\tentry[:first_name] = gets().chomp\n\tputs \"Last name:\"\n\tentry[:last_name] = gets().chomp\n\tputs \"Phone number:\"\n\tentry[:phone_number] = gets().chomp\n\tputs \"Email:\"\n\tentry[:email] = gets().chomp\n\t# entry.each do |entry_field, value|\n\t# \tputs \"Enter the person's #{entry_field}:\"\n\t# \tvalue = gets.chomp\n\t# \tputs entry.inspect\n\t# \tputs \"---\"\n\t# end\n\tentry_name = entry[:last_name] + \", \" + entry[:first_name]\n\tAddr_book[entry_name] = entry\n\tputs Addr_book.inspect\n\t# Exit workflow and return to main menu.\nend",
"def get_hash(name)\n file_name = File.join(@db_dir, name + '.json')\n return ::Hash.new unless File.exist?(file_name)\n\n begin\n json = File.read(file_name)\n rescue => e\n PEROBS.log.fatal \"Cannot read hash file '#{file_name}': #{e.message}\"\n end\n JSON.parse(json, :create_additions => true)\n end",
"def find_or_create_by_name(name)\n if self.find_by_name(name) == nil\n self.create(name)\n else\n self.find_by_name(name)\n end\n end",
"def new_key(school,key,value)\n school[key.to_sym] = value\nend",
"def add(name, value)\n @j_map.add(name, value)\n self\n end",
"def entry(name)\n root.entry(\"#{@path}#{name}\")\n end",
"def add_item(hash, new_key, new_value)\n hash[new_key] = new_value\n p hash\nend",
"def add_a_key_value_pair\nsummer_olympics = {\n \"Sydney\" => \"2000\",\n \"athens\" => \"2004\",\n \"beijing\" => \"2008\",\n \"London\" => \"2012\"}\n \n summer_olympics[\"atlanta\"] = 1996\n puts summer_olympics\n puts \"\"\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node\n else\n add_helper(@root, new_node)\n end\n end",
"def create(name)\n @name=name\n @vserver_hash=Map.new.set(:properties, :basic, :pool)\n end",
"def add(table_name)\n if table_exists?(table_name)\n @primary_keys[table_name]\n @columns[table_name]\n @columns_hash[table_name]\n end\n end",
"def find_or_create_by_name(name)\n obj = self.find_by_name(name)\n if obj == nil\n obj = self.create(name)\n end\n obj\n end",
"def create\n create_entry\n end",
"def add_basic_food(name, calories)\n # Check if name already exists in hash tables\n if @basic_foods.has_key? name or @recipes.has_key? name\n puts \"Food already exists in DB\"\n else\n @basic_foods[name] = BasicFood.new(name, calories)\n end\n end",
"def store!(key, value)\n if @nested && Hash === value # value.respond_to?(:to_hash)\n value = OpenStruct2.new(value)\n end\n\n #new_ostruct_member(key) # this is here only for speed bump\n\n @table[key.to_sym] = value\n end",
"def create(name)\n url = prefix + \"create\" + \"&name=#{name}\"\n return response(url)\n end",
"def new_entity( name, parent_context = nil )\n @last_unique_id += 1\n entity = V3::EntityDAO.new( @last_unique_id, name.to_s, parent_context )\n parent_context.entity_list[ name.to_s ] = entity if parent_context.instance_of?( V3::ContextDAO )\n # Cache the key for this new entity:\n @entity_names[ get_entity_unique_name(name, parent_context) ] = @last_unique_id\n @entity_list[ @last_unique_id ] = entity\n end",
"def entry\n {name => values}\n end",
"def add(key, value)\n @root = add_helper(@root, key, value)\n end",
"def add(key, value)\n @root = add_helper(@root, key, value)\n end",
"def add(key, value)\n @root = add_helper(@root, key, value)\n end",
"def add(key, value)\n @root = add_helper(@root, key, value)\n end",
"def save\n raise \"Unhashed entry during save\" unless @hash\n raise \"Entry without mime type during save\" unless @mimetype\n @data[:mimetype] = @mimetype\n @data[:ctime] = @ctime.utc.to_i\n @data[:mtime] = @mtime.utc.to_i\n @data[:name] = @name\n @data[:size] = @size\n @data[:tags] = @tags\n @data[:locations] ||= Array.new\n unless @data[:locations].include? @location\n @data[:locations] << @location\n end\n if ::Ordnung.database.read @hash\n ::Ordnung.database.update @hash, @data\n else\n ::Ordnung.database.create @hash, @data\n end\n @hash\n end",
"def addkey(key, value, school)\n school[key] = value\nend",
"def build(key_name, value={})\n kv = KeyValue.new(self, key_name)\n kv.value = value\n kv\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n \n if @root.nil?\n @root = new_node\n return\n end\n\n return add_helper(@root, new_node)\n end",
"def add(key, value)\n @root = add_helper(@root, key, value)\n end",
"def add_stored(entry, src_path, &continue_on_exists_proc); end",
"def add_entry(product_name, date, price, latest)\n new_entry = ProductData.new(price, date)\n\n new_entry.price /= DENOMINATION_RATE if date.year < DENOMINATION_YEAR\n\n product_name = product_name.to_s.squeeze(' ')\n reg_exp = /^[\\dA-Z_]+$/\n product_name = product_name.gsub(reg_exp, '')\n @dictionary[product_name] = [] unless @dictionary.key?(product_name)\n @dictionary[product_name] << new_entry\n @latest_dictionary[product_name] = new_entry if latest\n end",
"def create_key(value = nil)\n db_key = storage_key(:keys)\n invalidate_cache([:smembers, :scard], db_key)\n value ||= SecureRandom.hex(16)\n storage.sadd(db_key, value)\n value\n end",
"def add(name)\n self.class.add(name, @jira_key)\n end",
"def add_new_key(school, ranking, value)\n\tschool[ranking] = value\nend",
"def add_student(school,new_student)\n new_student_hash = {}\n new_student_hash[:name] = new_student\n school[:students] << new_student_hash\nend",
"def create_key_pair(name, sshkey)\n payload = {\"name\" => name, \"sshkey\" => sshkey}\n post(\"tenants/#{tenant}/sshkeys\", payload.to_json)\n end",
"def create_key_pair(key_pair_name)\n unless fog_compute.key_pairs.get(key_pair_name)\n say \"creating key pair #{key_pair_name}...\"\n kp = provider.create_key_pair(key_pair_name)\n settings[:bosh_key_pair] = {}\n settings[:bosh_key_pair][:name] = key_pair_name\n settings[:bosh_key_pair][:private_key] = kp.private_key\n settings[:bosh_key_pair][:fingerprint] = kp.fingerprint\n if aws?\n settings[\"bosh_cloud_properties\"][\"aws\"][\"default_key_name\"] = key_pair_name\n settings[\"bosh_cloud_properties\"][\"aws\"][\"ec2_private_key\"] = \"/home/vcap/.ssh/#{key_pair_name}.pem\"\n elsif openstack?\n settings[\"bosh_cloud_properties\"][\"openstack\"][\"default_key_name\"] = key_pair_name\n settings[\"bosh_cloud_properties\"][\"openstack\"][\"private_key\"] = \"/home/vcap/.ssh/#{key_pair_name}.pem\"\n end\n save_settings!\n else\n error \"Key pair '#{key_pair_name}' already exists. Rename BOSH or delete old key pair manually and re-run CLI.\"\n end\n end",
"def get_or_new(resource_type, name)\n data = get_data(resource_type, name)\n new_entry(resource_type, name, data)\n end",
"def create_by_name(name)\n self.new.tap do |o|\n o.name = name # ambos sirven\n end\n end",
"def [](name)\r\n get_or_create_node(name.to_s, false)\r\n end",
"def find_or_create_by_name(name)\n self.find_by_name(name) || self.create(name)\n end",
"def add_keyspace(name, value)\n @keyspaces[name.to_s] = value\n end",
"def add(key, value)\n new_node = TreeNode.new(key, value)\n if @root == nil\n @root = new_node\n return new_node\n else\n add_helper(@root, new_node)\n end\n end",
"def add(key, value)\n @root.add(key.to_s.upcase.split(\"\"), value)\n return self\n end",
"def create(name)\n self.new(name)\n end"
] |
[
"0.62424123",
"0.62326896",
"0.6038395",
"0.6015353",
"0.58742636",
"0.58257085",
"0.5825289",
"0.57322586",
"0.57258356",
"0.57099384",
"0.5690248",
"0.5648871",
"0.56229466",
"0.5587205",
"0.55508864",
"0.5550361",
"0.54747695",
"0.5461193",
"0.544079",
"0.5432273",
"0.5416214",
"0.5404358",
"0.539716",
"0.5384121",
"0.53793776",
"0.53531086",
"0.53517497",
"0.5337477",
"0.5335141",
"0.5334012",
"0.53284115",
"0.5300215",
"0.5298162",
"0.5294446",
"0.5278226",
"0.52705353",
"0.5269804",
"0.5269563",
"0.5269521",
"0.5249588",
"0.5239735",
"0.5231205",
"0.5225407",
"0.5219273",
"0.521866",
"0.5214861",
"0.52081597",
"0.5208086",
"0.5205931",
"0.5203514",
"0.5188832",
"0.517932",
"0.51759094",
"0.5173574",
"0.5164027",
"0.5163773",
"0.5163337",
"0.51617193",
"0.51550645",
"0.5154551",
"0.5153649",
"0.5137134",
"0.51371294",
"0.51360714",
"0.5133068",
"0.5129723",
"0.51246184",
"0.512272",
"0.5119149",
"0.511854",
"0.51184165",
"0.51142913",
"0.5112669",
"0.5111045",
"0.51103574",
"0.5102555",
"0.5102555",
"0.5102555",
"0.5102555",
"0.510047",
"0.51001996",
"0.50969285",
"0.50966215",
"0.50847864",
"0.50839704",
"0.5079591",
"0.5078972",
"0.50755453",
"0.50750524",
"0.50721675",
"0.5067041",
"0.5065159",
"0.5061978",
"0.5059618",
"0.5059167",
"0.50589603",
"0.50538576",
"0.5051362",
"0.5050333",
"0.5034454"
] |
0.7587017
|
0
|
Does this database have an entry in the root dictionary named with the key_name parameter?
|
def has_entry?( dictionary_name, key_name )
KeyError.not_new( dictionary_name, self )
KeyError.not_new( key_name, self )
return false unless self.has_key?( dictionary_name )
return self[ dictionary_name ].has_key?( key_name )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end",
"def contains(name)\n database.has_key? name\n end",
"def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end",
"def dictionary_exist?(dic_name)\n\t\t@db::Dictionary.where(:title => dic_name).present?\n\tend",
"def knows_key?( name )\n return true if has_key?( name )\n return parent.knows_key?( name ) if parent\n false\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def has_key?(p0) end",
"def key?(key)\n table.key?(key)\n end",
"def has_key?(key)\n @table.get(key) != nil\n end",
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def has_key? key; key? key; end",
"def cdb_has_key?(name)\n Chef::CouchDB.new.has_key?(\"webui_user\", name)\n end",
"def exist?(key)\n store.key?(key)\n end",
"def key?(key)\n @table.key?(key.to_sym)\n end",
"def key?(key)\n in_transaction\n @table.key? key\n end",
"def key?(name)\n @data.key?(name.to_s)\n end",
"def exist?(key)\n\n end",
"def key?(name)\n raw.key?(name.to_s)\n end",
"def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end",
"def keg_exists?\n !database.get(keg_name).nil?\n end",
"def child_collection_exist?(name)\r\n return @db_interface.hash_value_exist?(@certain_coll_key, name)\r\n end",
"def persisted?( *args )\n\n has_key = false\n no_key = false\n key = nil\n case args.count\n when 1\n key = args[0]\n when 0\n no_key = true\n end\n\n # if we have no args we are asking whether any keys exist\n if no_key\n \n has_key = true unless ( @parent_index || @parent_bucket ).count == 0\n \n else\n \n serialized_key = nil\n if @parent_index\n serialized_key = @parent_bucket.parent_adapter.class::SerializationClass.__send__( @parent_bucket.parent_adapter.class::SerializationMethod, key )\n else\n serialized_key = key\n end\n\n has_key = @cursor_instance.jump( serialized_key )\n\n end\n \n return has_key\n\n end",
"def key?(name)\n matches = select(name)\n matches.any?\n end",
"def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end",
"def exists?(key)\n key.present? && manager.key?(key)\n end",
"def key?(name)\n @ledger.key?(name.to_s)\n end",
"def primary?\n return true if @data.fetch(:Key_name) == \"PRIMARY\"\n false\n end",
"def has_key?(key)\n local?(key) || (!@parent.nil? && @parent.key?(key))\n end",
"def key_set?\n !attributes['key'].nil?\n end",
"def has_root_name?(root_name, mode = SCAN_DB)\n return true if @read_cache.key?(root_name)\n return false if mode == SCAN_CACHE_ONLY\n @db.has_key?(root_name)\n end",
"def is_key_entry(aliaz)\n\n end",
"def key?(name)\n name_key_map.key?(name)\n end",
"def has_key?(key)\n !find_node(key).nil?\n end",
"def key?\n @key\n end",
"def key?\n @key\n end",
"def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end",
"def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end",
"def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end",
"def has_key?(name)\n hashed.has_key? name\n end",
"def key?\n return true if @key; false\n end",
"def key?(key)\n !self[key].nil?\n end",
"def has_key?(field_name); end",
"def key?(key)\n configuration.key?(key)\n end",
"def has?(key)\n node = _get(@root, key)\n !node.nil? && !node.undefined?\n end",
"def has_key?(key)\n any? {|mod| mod.name == key}\n end",
"def hstore_has_key(column, key)\n where(\"#{connection.quote_column_name(column)} ? :key\", :key => key) \n end",
"def contains?(key)\n @key_data.has_key?(key)\n end",
"def key?(key)\n config.resolver.key?(_container, key)\n end",
"def key?(key)\n @configuration.key?(key)\n end",
"def has_key?(attr_name)\n keys.include?(attr_name.to_s)\n end",
"def include_key?(key)\n\t\t\ttrue\n\t\tend",
"def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end",
"def exists?(key)\n unimplemented\n end",
"def include? key\n\t\t@data_base.has_key? key\n\tend",
"def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def has_key?(key)\n !get(key).nil?\n end",
"def key?(name)\n ! attributes.detect { |attr| attr.name == name }.nil?\n end",
"def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend",
"def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end",
"def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end",
"def key?(key, options = {})\n load(key, options) != nil\n end",
"def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end",
"def registered?(key)\n data.key?(key)\n end",
"def has_key?(key)\n keys.include?(key)\n end",
"def has_key? name\n name_str = name.to_s\n name_sym = name.to_sym\n\n @config.each do |configfile|\n if configfile[:config][name_str] or configfile[:config][name_sym]\n return true\n end\n end\n return false\n end",
"def has_key?(key)\n return to_h().has_key?(key)\n end",
"def key?(key)\n self.reload if @should_reload\n return @data.key?(key.to_sym)\n end",
"def has_primary_key(db, table, key)\n return db.primary_key(table) == key.to_s if db.respond_to?(:primary_key)\n\n pk_column_info = db.schema(table).find { |column_info| column_info[0] == key }\n return false if pk_column_info.nil?\n\n pk_column_info[1][:primary_key] == true\nend",
"def document_exists?(key)\n return nil unless key\n CouchbaseDocStore.document_exists?(key)\n end",
"def in_table?(key)\n (@subroutine.key?(key) || @class.key?(key))\n end",
"def exists_by_primary_key?(primary_key)\n qry = \"SELECT COUNT(*) AS `c` FROM `#{@table_name}` WHERE \"+build_where({@primary_key => primary_key})\n res = cached_query(qry,[@table_name])\n res[0]['c'] != 0\n end",
"def non_query_nested_key_name?(key)\n (key.in?(NonQueryNestedKeyNames) || is_selection_type(key))\n end",
"def key?(key)\n super(convert_key(key))\n end",
"def exist?(key)\n !find(key).nil?\n end",
"def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end",
"def db_exist?(db_name)\n list_schemas.include?(db_name)\n end",
"def entry_exists?(model, name)\n\t\tbool = false\n\t\tmodel.each do |hash|\n\t\t\thash.each do |k, v|\n\t\t\t\tif v == name\n\t\t\t\t\tbool = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tbool\n\tend",
"def include?(key)\n @dao.count(selector(key)) > 0\n end",
"def key?(key)\n configuration.key?(key.to_sym) || config_contexts.key?(key.to_sym)\n end",
"def dictionary_exists? dictionary\r\n synonym_dictionaries.key?(dictionary.capitalize)\r\n end",
"def key?(key)\n @items.key?(key)\n end",
"def key?(key)\n @attr.key?(key)\n end",
"def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end",
"def exist?(key)\n raise \"subclass responsibility\"\n end",
"def key?(container, key)\n container.key?(key.to_s)\n end",
"def key?(key)\n super(convert_key(key))\n end",
"def key?(key)\n super(convert_key(key))\n end",
"def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end",
"def has_key?(key)\n @hash.has_key?(key)\n end",
"def exists?(namespace, key)\n exists = File.exist?(make_path(namespace, key))\n settings.logger.info(\"Queried #{make_key(namespace, key)}, found: #{exists}\")\n exists\n end",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def exist?(id)\n db_root.join(id).exist?\n end"
] |
[
"0.7601805",
"0.76012224",
"0.75092226",
"0.7088865",
"0.70441115",
"0.70197386",
"0.70197386",
"0.70006055",
"0.6958498",
"0.69516647",
"0.69493943",
"0.6919207",
"0.6919207",
"0.6919207",
"0.6919207",
"0.6919207",
"0.6919207",
"0.68896073",
"0.68807375",
"0.68740773",
"0.6826354",
"0.68077576",
"0.6794292",
"0.67784643",
"0.674682",
"0.6713523",
"0.6708486",
"0.67045873",
"0.66849744",
"0.6681561",
"0.6678502",
"0.6667098",
"0.66606987",
"0.6649702",
"0.66420156",
"0.6638132",
"0.6617948",
"0.6608329",
"0.65912473",
"0.65795225",
"0.6578443",
"0.6578443",
"0.6575086",
"0.65729934",
"0.65729934",
"0.6564272",
"0.6550522",
"0.6531831",
"0.6530595",
"0.6528049",
"0.65200824",
"0.64903295",
"0.6480009",
"0.64570856",
"0.6454186",
"0.6422353",
"0.64210755",
"0.6399527",
"0.6386656",
"0.6380641",
"0.6379279",
"0.6374955",
"0.63715225",
"0.63715225",
"0.63425136",
"0.6340843",
"0.6292867",
"0.6285796",
"0.6267568",
"0.62476385",
"0.6236948",
"0.62309265",
"0.6230677",
"0.62210107",
"0.62137884",
"0.6210722",
"0.62065774",
"0.61902934",
"0.6182331",
"0.6175582",
"0.61754704",
"0.61739606",
"0.6171473",
"0.61689997",
"0.6163752",
"0.615746",
"0.6156726",
"0.6150433",
"0.6149957",
"0.61328137",
"0.61307544",
"0.61270946",
"0.6117973",
"0.61023194",
"0.61023194",
"0.6099283",
"0.60901934",
"0.6088619",
"0.60856986",
"0.6084146"
] |
0.68269765
|
20
|
Delete an existing key value entry inside the dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one less entry if that key existed.
|
def delete_entry( dictionary_name, key_name )
KeyError.not_new( dictionary_name, self )
KeyError.not_new( key_name, self )
self[ dictionary_name ].delete( key_name )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete(name)\r\n key = convert_key(name)\r\n return false unless has(key)\r\n @p.delete(key)\r\n true\r\n end",
"def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end",
"def delete_key_pair(key_name)\n return if key_name.nil? || !configured?\n\n @client.delete_key_pair(key_name: key_name)\n end",
"def delete_entry(key, options)\n @hash.delete(key)\n end",
"def delete(name, options = nil)\n options ||= {}\n name = expanded_key name\n\n instrument(:delete, name) do\n delete_entry(name, options)\n end\n end",
"def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end",
"def delete(key_name)\n perform(:delete, key_name)\n true\n end",
"def delete_key_pair(name)\n link = generate_request(\"DeleteKeyPair\", \n 'KeyName' => name.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end",
"def delete_key_pair(name)\n link = generate_request(\"DeleteKeyPair\", \n 'KeyName' => name.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end",
"def del(name)\n data.delete(name)\n end",
"def delete(name, options = nil)\n options = merged_options(options)\n\n instrument(:delete, name) do\n delete_entry(normalize_key(name, options), **options)\n end\n end",
"def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end",
"def delete(key)\n dummy = Pair.new(key,nil)\n pair = @tree.remove(dummy)\n return nil unless pair\n return pair.value\n end",
"def remove(name, key)\n issueKey_test(key)\n fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})\n end",
"def delete_key_pair(name)\n delete(\"tenants/#{tenant}/sshkeys/#{name}\")\n end",
"def delete(key)\n if find(key)\n @root = delete_helper(@root, key)\n else\n return nil\n end \n end",
"def delete(name = nil)\n if name\n store.delete_value(field_key(name.to_s))\n else\n self.class.fields.each do |field|\n store.delete_value(field_key(field[:name]))\n end\n end\n end",
"def delete\n NamedMap.stats_aggregator.timing('named-map.delete') do\n response = self.class.http_client.delete( url + '?api_key=' + @parent.api_key,\n {\n headers: @parent.headers,\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n raise HTTPResponseError, \"DELETE:#{response.code} #{response.request.url} #{response.body}\" unless response.code == 204\n end\n end",
"def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end",
"def delete(key)\n return nil if @root.nil?\n deleted = nil\n splay(key)\n if (key <=> @root.key) == 0 # The key exists\n deleted = @root.value\n if @root.left.nil?\n @root = @root.right\n else\n x = @root.right\n @root = @root.left\n splay(key)\n @root.right = x\n end\n end\n deleted\n end",
"def delete_entry(key, **options); end",
"def delete(value)\n @hash.delete(value) && @hash.send(:convert_key, value)\n end",
"def delete(name)\n @by_name.delete(name)\n true\n end",
"def delete_entry(key, options) # :nodoc:\n @data.where(key: key).delete\n rescue Sequel::Error => e\n logger.error(\"Sequel::Error (#{e}): #{e.message}\") if logger\n false\n end",
"def delete(key)\n position = search(key)\n return if (key <=> @keys[position]) != 0\n @keys.delete_at(position)\n @values.delete_at(position)\n end",
"def delete(key)\n return self unless @hash.key?(key)\n\n h = Hash[@hash]\n h.delete(key)\n self.class.create(h)\n end",
"def delete(hashName)\n system \"clear\"\n puts \"Qual aluno voce quer remover?\"\n nome = gets.chomp\n if hashName[nome.to_sym].nil?\n puts \"Aluno #{nome} nao encontrado.\"\n else\n hashName.delete(nome.to_sym)\n puts \"Aluno #{nome} deletado.\"\n end\n voltar\nend",
"def delete(key)\n @hash.delete(key.to_s)\n end",
"def delete(key)\n @root.delete(key.to_s.upcase.split(\"\"))\n return self\n end",
"def delete key\n @internal_hash[key].clear\n end",
"def remove key, name = nil\n if name\n h = @var_map[key]\n r = h.delete name\n @var_map.delete key if h.empty?\n r\n else\n @var_map.delete key\n end\n end",
"def erase(cartridge_name, version, cartridge_version)\n unless exist?(cartridge_name, cartridge_version, version)\n raise KeyError.new(\"key not found: (#{cartridge_name}, #{version}, #{cartridge_version})\")\n end\n\n entry = nil\n @semaphore.synchronize do\n # find a \"template\" entry\n entry = select(cartridge_name, version, cartridge_version)\n\n # Now go back and find all occurrences of the \"template\"\n @index[cartridge_name].each_key do |k2|\n @index[cartridge_name][k2].each_pair do |k3, v3|\n if v3.eql?(entry)\n remove(cartridge_name, k2, k3)\n end\n end\n end\n\n FileUtils.rm_r(entry.repository_path)\n parent = Pathname.new(entry.repository_path).parent\n FileUtils.rm_r(parent) if 0 == parent.children.count\n end\n\n entry\n end",
"def delete(name)\n @ctx.delete(@path + name)\n end",
"def delete_key_value?( key )\n hash = load_hash\n return false if hash.delete(key).nil?\n store_hash hash\n true\n end",
"def delete(key)\n key = lookup_key(key)\n if @info.has_key?(key) || !@pages\n @new_info[key] = nil\n else\n @new_info.delete(key)\n end\n end",
"def delete(value)\n #get hashed value\n hash_value = hash_function(value)\n\n # check if value exists\n result = search(value)\n\n # if value exists\n if result\n # set value to nil\n @@collection[hash_value] = nil\n # return confirmation\n \"value deleted\"\n else\n # return error message\n \"value not found\"\n end\n\n\n end",
"def delete(name); end",
"def delete(name); end",
"def delete_entry(key, options) # :nodoc:\n @data.remove(key)\n rescue => e\n logger.error(\"KyotoTycoonError (#{e}): #{e.message}\") if logger\n false\n end",
"def delete_entry(key, **options)\n rescue_error_with(false) { @data.with { |c| c.delete(key) } }\n end",
"def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend",
"def delete(key)\n if value = @hash[key]\n @reverse[value].delete(key)\n @reverse.delete value if @reverse[value].empty?\n @hash.delete key\n end\n end",
"def delete(key, options = nil)\n @hash.delete(key)\n end",
"def delete(key)\n result = nil\n if @root\n @root, result = delete_recursive(@root, key)\n @root.color = :black if @root\n end\n result\n end",
"def delete_entry(key, **options)\n failsafe(:delete_entry, returning: false) do\n with { |c| c.del key }\n end\n end",
"def delete(key, options = {})\n old_key_present = key_exists?(key)\n value = @data[key]\n @data.delete(key)\n @key_access_store.delete(key)\n @cache_size -= compute_value_size(value) if @cache_size > 0 && old_key_present\n end",
"def drop(name)\n tuples = primary.lookup_vals(name)\n return delete(tuples).size > 0\n end",
"def delete(key)\n if key.empty?\n if !@value.nil? and @children.empty?\n @value = nil\n return true\n else\n @value = nil\n return false\n end\n end\n letter = key.shift\n if @children[letter].delete(key)\n @children.delete(letter)\n if @children.empty?\n return true\n end\n end\n return false\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete_entry(key, options) # :nodoc:\n @data.delete(key, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n false\n end",
"def delete key\n rv = self[key]\n self.removeField key\n return rv\n end",
"def delete(key)\n @db.delete(key.to_s.downcase)\n end",
"def delete(key)\n db.delete(key)\n end",
"def delete(key)\n return unless in?(key)\n\n hash_index = hasher(key, @keys.size)\n\n if @keys[hash_index] == key\n @keys[hash_index] = nil\n @values[hash_index] = nil\n else\n next_key_index = rehash(hash_index, @keys.size)\n\n while @keys[next_key_index] != nil and @keys[next_key_index] != key\n next_key_index = rehash(next_key_index, @keys.size)\n end\n\n @keys[next_key_index] = nil\n @values[next_key_index] = nil\n end\n end",
"def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end",
"def delete_key(key)\n end",
"def delete(name)\n fail AliasNotFoundException, \"No alias with name #{name} exists\" unless @redis.hexists(STORE_KEY, name)\n\n command = @redis.hget(STORE_KEY, name)\n @redis.hdel(STORE_KEY, name)\n AliasedCommand.new(name, command).freeze\n end",
"def delete(key)\n @hash.delete key\n @key_hash.delete key\n end",
"def delete(key)\n @internal_hash.delete(key)\n end",
"def meterpreter_registry_deleteval(key, valname, view)\n begin\n root_key, base_key = session.sys.registry.splitkey(key)\n perms = meterpreter_registry_perms(KEY_WRITE, view)\n open_key = session.sys.registry.open_key(root_key, base_key, perms)\n open_key.delete_value(valname)\n open_key.close\n return true\n rescue Rex::Post::Meterpreter::RequestError => e\n return nil\n end\n end",
"def delete_entry(key, **_options)\n failsafe(:delete_entry, returning: false) do\n res = collection.remove(key)\n @last_mutation_token = res.mutation_token\n true\n end\n end",
"def delete_metadata(key_name)\n requires :id\n service.delete_snapshot_metadata(id, key_name)\n true\n end",
"def delete(key, child)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.delete(key)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@state.delete(child)\n\t\t\tend",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end",
"def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end",
"def remove(name)\n @j_map.remove(name)\n self\n end",
"def delete_entry(key, options)\n dataset.delete Google::Cloud::Datastore::Key.new @datastore_kind_name, key\n end",
"def delete(key, args={})\n data = request_data(:delete, key_uri(key), args)\n return nil unless data\n data[S_PREV_NODE][S_VALUE]\n end",
"def delete_key_value?( key )\n @store.transaction { return false if @store.delete(key).nil? }\n true\n end",
"def delete(key, options = {})\n namespaced = namespaced_key(key, merged_options(options))\n\n invoke(:delete, key) do |store|\n store.del(namespaced) > 0\n end\n end",
"def delete(name = nil)\n if name\n redis.del field_key(name.to_s)\n else\n self.class.fields.each do |field|\n redis.del field_key(field[:name])\n end\n redis.srem \"sequence:#{prefix}:all\", self.id\n end\n end",
"def delete(name)\n connect { |connection| connection.delete dn(name) }\n end",
"def del\n connection.del(key_label)\n end",
"def delete(name)\n name = Field.name_canonicalize(name.to_str)\n delete_if { |n, v|\n n.downcase == name\n }\n self\n end",
"def destroy\n @dict.destroy\n end",
"def delete_entry( c, dn ) # :yields: connection_info, distinguished_name\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n @ldap.delete dn: dn\n raise \"Unable to remove record: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n end",
"def pdelete_data(key, options = {} )\n store = options[:name].blank? ? PStore.new(@@default_pstore_name) : PStore.new(options[:name])\n store.transaction do \n return store.delete(key.to_sym) || Exception.new(\"#{key} does not exist in PStore cache\")\n end\n end",
"def delete(key)\n pop if change_key(key, nil, true)\n end",
"def delete\n validate_presence_of :name\n wrapper.delete_tag(@name) || raise(OperationFailed)\n end",
"def delete(name)\n handle = system.run!(:search, \"user\", name, nil, @keyring)\n system.run!(:unlink, handle, @keyring)\n end",
"def delete(key)\n rv = @data.has_key?(key)\n @data.delete(key)\n rv\n end",
"def removeNamedItem(name)\n getNamedItem(name).remove\n end",
"def delete_child_collection(name)\r\n #Delete collection = delete all documents in it and than delete field in envId:collections key\r\n coll_id = nil\r\n begin\r\n coll_id = get_child_collection_id(name)\r\n rescue Transformer::MappingException => ex\r\n ex.message\r\n return\r\n end\r\n collection = RedXmlApi::Collection.new(@env_id, coll_id)\r\n collection.delete_all_documents\r\n collection.delete_all_child_collections\r\n @db_interface.delete_from_hash @certain_coll_key, [name]\r\n #We have to delete all keys of collection, e.g. <info, <documents, <collections\r\n del_keys = [Transformer::KeyBuilder.collection_info(@env_id, coll_id), Transformer::KeyBuilder.documents_key(@env_id, coll_id), Transformer::KeyBuilder.child_collections_key(@env_id, coll_id)]\r\n @db_interface.delete_keys del_keys\r\n end",
"def remove name\n delete(name)\n end",
"def remove *k\n\t\t\t# todo combine queries in a transaction\n\t\t\tActiveOrient::Base.logger.debug { \"delete: #{@name} --< #{k.map(&:to_or).join( ' :: ' )}\"}\n\t\t k.map{|l|\t@orient.update( {remove: { @name => l} } ) }\n\t#\t\t@orient.reload!\n\t#\t\t@orient.send @name \n\t\tend",
"def delete_keypair(keypair_name)\n raise OpenStack::Exception::NotImplemented.new(\"os-keypairs not implemented by #{@connection.http.keys.first}\", 501, \"NOT IMPLEMENTED\") unless api_extensions[:\"os-keypairs\"]\n @connection.req(\"DELETE\", \"/os-keypairs/#{keypair_name}\")\n true\n end",
"def delete(key)\n configuration.hpath_delete.tap do |result|\n save if sync_down\n end\n end",
"def delete(key)\n return Nvmkv::kv_delete(@kv_id, @pool_id, key)\n end",
"def delete_snapshot(name)\n result = get_snapshot(name)\n response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)\n @client.response_handler(response)\n true\n end",
"def shell_registry_deleteval(key, valname, view)\n key = normalize_key(key)\n # REG DELETE KeyName [/v ValueName | /ve | /va] [/f]\n shell_registry_cmd_result(\"delete \\\"#{key}\\\" /v \\\"#{valname}\\\" /f\", view)\n end",
"def delete(key)\r\n if record = touch(key)\r\n @store.delete(key)\r\n @head = @tail = nil if @store.length.zero?\r\n record[:value]\r\n end\r\n end",
"def delete(key)\n doozer_pool.with_connection do |doozer|\n doozer.delete(full_key(key))\n end\n end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def delete key\n\t\tdata = @data_base.delete key\n\t\tupdate_database\n\t\tdata\n\tend"
] |
[
"0.69060516",
"0.66039443",
"0.63256794",
"0.6323323",
"0.62871385",
"0.6269157",
"0.6244237",
"0.6190668",
"0.6190668",
"0.6121008",
"0.6113571",
"0.6081636",
"0.6077545",
"0.6021239",
"0.59702116",
"0.59452933",
"0.59302396",
"0.5922024",
"0.58857733",
"0.5864068",
"0.5859227",
"0.58590287",
"0.57988465",
"0.5790929",
"0.57887864",
"0.5784487",
"0.57668924",
"0.57607293",
"0.57533616",
"0.5731133",
"0.57187617",
"0.5706743",
"0.5704719",
"0.569918",
"0.5689241",
"0.5688435",
"0.5679819",
"0.5679819",
"0.56372094",
"0.5635148",
"0.56330615",
"0.56326604",
"0.56297624",
"0.562785",
"0.5620805",
"0.56206965",
"0.5616948",
"0.5597384",
"0.5585696",
"0.55834633",
"0.5579194",
"0.5579078",
"0.55695134",
"0.556125",
"0.55543435",
"0.5523621",
"0.5514772",
"0.55140376",
"0.54996514",
"0.5488528",
"0.548548",
"0.5465788",
"0.54506236",
"0.54466",
"0.54466",
"0.54466",
"0.54466",
"0.54466",
"0.5434045",
"0.5434045",
"0.54261625",
"0.5424663",
"0.542398",
"0.54196614",
"0.5409598",
"0.5405013",
"0.53962964",
"0.5393741",
"0.53914624",
"0.5386986",
"0.5382469",
"0.5367496",
"0.5365766",
"0.5365095",
"0.53401345",
"0.53384894",
"0.5333707",
"0.5326772",
"0.53244936",
"0.53200746",
"0.5319159",
"0.5317937",
"0.5317468",
"0.53115547",
"0.53106964",
"0.5303716",
"0.52943516",
"0.5283742",
"0.5283742",
"0.5277592"
] |
0.7690513
|
0
|
get first state of all models in the database
|
def initialize(database_file)
@database_file = database_file
@data = get_all()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first\n self.all.first\n end",
"def first\n @model_class.first\n end",
"def first\n @model_class.first\n end",
"def first\n self.all.first\n end",
"def first\n all.first\n end",
"def first; self.objects.first end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n\n wi(fetch_all({}).first)\n end",
"def first\n result ? all.first : limit(1).all.first\n end",
"def state\n @state.first\n end",
"def state\n states.first\n end",
"def single_record!\n if use_eager_all?\n obj = clone(:all_called=>true).all.first\n\n if opts[:eager_graph]\n obj = clone(:all_called=>true).where(obj.qualified_pk_hash).unlimited.all.first\n end\n\n obj\n else\n super\n end\n end",
"def first!\n first || raise_record_not_found_exception!\n end",
"def first!\n first or raise RecordNotFound\n end",
"def first\n model[key.call(\"LINDEX\", 0)]\n end",
"def first\r\n\t\t@set.first\r\n\tend",
"def get_all_from_database\n model.all\n end",
"def first\n\t\trow = connection.get_first_row <<-SQL\n\t\t\tSELECT #{columns.join \",\"} FROM #{table}\n\t\t\tORDER BY id ASC LIMIT 1;\n\t\tSQL\n\t\tinit_object_from_row(row)\n\tend",
"def first() end",
"def h_set_single_model(&block)\n Backup::SpecLive.load_models = false\n Backup::Utilities.send(:reset!)\n Backup::Logger.clear!\n Backup::Model.all.clear\n Backup::Config.load_config!\n block.call\n model = Backup::Model.all.first\n model\n end",
"def first_model\n yield(authorized_models.first) if block_given?\n authorized_models.first\n end",
"def all( model )\n model( model ).all\n end",
"def first_record\n reset\n next_record\nend",
"def find_first(conditions = nil, orderings = nil)\n sql = \"SELECT * FROM #{table_name} \"\n add_conditions!(sql, conditions)\n sql << \"ORDER BY #{orderings} \" unless orderings.nil?\n sql << \"LIMIT 1\"\n \n record = connection.select_one(sql, \"#{name} Load First\")\n instantiate(record) unless record.nil?\n end",
"def all\n db.transaction(true) do\n ids = extract_model_ids(db)\n ids.map { |key| db[key] }\n end\n end",
"def preload_models \n ActiveRecord::Base.connection.tables.each do |model| \n begin \n \"#{model.classify}\".constantize \n rescue Exception \n end \n end \n end",
"def first?; end",
"def first\n lock {\n first_id = resolve_steps(:first)\n first_id.nil? ? nil : _load(first_id)\n }\n end",
"def first\n all[0]\n end",
"def current \n find_by_active(true)\n end",
"def index\n @modelstates = Modelstate.all\n end",
"def first\n results.first\n end",
"def first\n return sync { @first }\n end",
"def first(n=1)\n return values[0] if self.class == BaseRelation && loaded && n == 1\n result = limit(n).load\n result.length == 1 ? result[0] : result\n end",
"def first\n end",
"def fetch_model_list\n if parent_model\n return parent_model.send(\"#{model_name.pluralize.downcase}\")\n else\n return model_name.camelize.constantize.find(:all)\n end\n end",
"def normal\n first\n end",
"def test_find_first_in_state\n # clear all records and create a new record\n TaliaCore::Workflow::PublicationWorkflow.delete_all \n record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => @src.id)\n \n # move current record to publish\n record.vote! @user, 10\n record.publish! @user\n \n records_by_find_by = TaliaCore::Workflow::PublicationWorkflow.find_by_state('published')\n records_by_in_state = TaliaCore::Workflow::PublicationWorkflow.find_in_state(:first, :published)\n \n assert_equal records_by_find_by, records_by_in_state\n end",
"def start\n model_name = model.name\n # $stderr.write \"0 - #{model_name}\\n\"\n # $stderr.write \"A - current_uniq - #{Script.current_uniq ? 'true' : 'false'}\\n\"\n # $stderr.write \"B - #{Script.current_stack.join(',')}\\n\"\n if Script.current_uniq and Script.current_stack.include?(model_name)\n # we've already done this in the current stack, so skip it\n return\n end\n if not Script.current_uniq\n # since we're not trying to uniq, ignore the current contents of the stack\n Script.current_stack.clear\n end\n Script.current_stack << model_name\n unless Run.table_exists?\n Run.auto_upgrade!\n end\n run = Run.new\n run.model_name = model_name\n run.start do\n steps.each do |step|\n step.start\n model.reset_column_information\n end\n end\n end",
"def models\n @models ||= Prepares.models\n end",
"def models\n Model.all.select {|model| model.make_id == id}\n end",
"def first_version\n find( :first, :order => 'number ASC' )\n end",
"def first\n response = query(:per_page => 1, :page => 1).get!\n response[:results].first\n end",
"def find_all\n execute_sql(:read, :user) { table.map {|u| inflate_model(u) } }\n end",
"def first_instance\n params(limit: 1).all.first\n end",
"def first\n self.class.where(id: rid).chronological.first\n end",
"def models\n @@models\n end",
"def index_model\n model().default_order\n end",
"def default\n find_by(default: 1)\n end",
"def first_book\n Book.find(:first)\n end",
"def index\n @auto_models = AutoModel.all\n end",
"def models\n @models ||= []\n end",
"def last\n model.last\n end",
"def first(*args)\n all.send(:first, *args)\n end",
"def first; end",
"def first; end",
"def first?\n self.rel == \"first\"\n end",
"def index\n @models = Model.all\n end",
"def index\n @models = Model.all\n end",
"def first\n self.class.where(:id => rid).order('lower(validity)').first\n end",
"def cti_base_model\n @cti_models.first\n end",
"def models\n @models ||= {}\n end",
"def first_item\n self.simple_acts_as_list_scope.first\n end",
"def find_locally(id)\n if @all.present?\n @all.find { |model| model.id == id }\n end\n end",
"def first(&block)\n use_device(all.first, &block)\n end",
"def first_or_initialize(attrs = {})\n fetch.first || build(attrs)\n end",
"def first\n @adapter.first(collection)\n end",
"def all(model)\n store.all(table: table_name).map {|data| model.new data}\n end",
"def first(options = {})\n all(options).first\n end",
"def state\n State.instance\n end",
"def root\n if(rails_3?)\n configuration[:class].where(\"#{configuration[:foreign_key]} IS NULL\").order(configuration[:order]).first\n else\n configuration[:class].find(\n :first, \n :conditions => \"#{configuration[:foreign_key]} IS NULL\", \n :order => configuration[:order]\n )\n end\n end",
"def all\n @collection ||= Collection.new model_name\n end",
"def first\n enumerator(:limit => 1).first \n end",
"def first\n Profile.all.first\n end",
"def first\n limit(1).to_a.first\n end",
"def head\n raise InvalidDbError if @stale\n super\n end",
"def first\n @features.first\n end",
"def expire_all\n #Load all the models\n Dir.glob(Rails.root + '/app/models/*.rb').each {|file| require file}\n \n ActiveRecord::Base.subclasses.each do |cls|\n expire_tags cls\n\n pk_name = cls.primary_key\n\n return if cls.unscoped.first.nil? #There is no sence in continuing, if model is empty\n\n last_id = cls.order(pk_name).last.try(pk_name.to_sym)\n\n #hardcoded value for first record\n first_id = 1\n\n (first_id..last_id).each do |id|\n expire_tags({:cls => cls, :id => id})\n end\n end\n end",
"def first\n find.limit(1).next_document\n end",
"def pick_class(model_class)\n\t\tmodel_class.all.sample\n\tend",
"def find\n super.first\n end",
"def first\n self['first']\n end",
"def all\n properties = get_properties\n create_models(properties)\n end",
"def state\n @state.last\n end",
"def state\n @state.last\n end",
"def model\n return Sketchup.active_model if not @rep\n @rep.model\nend",
"def first(options={})\r\n find(:first, options)\r\n end",
"def index\n @initial = Initial.first\n end",
"def current\n all\n end",
"def first_model_id\n return 1 if start_param.nil?\n start_param.to_i\n end",
"def earliest\n return self.transactions.first(:order => [:date.asc])\n end",
"def one(model, sql, params={})\n model.new(sql_query(sql, params).first)\n end",
"def get_first_satisfiedPK\n # allColumns = @allColumnList.map do |field|\n # \t# \"#{field.colname} as #{field.relname}_#{field.colname} \"\n # \t\"#{field.relname}_#{field.colname} \"\n # end.join(',')\n query = \"select #{@allColumns_renamed} from golden_record where type = 'satisfied' and branch = '#{@branches[0].name}';\"\n res = DBConn.exec(query)\n abort(\"Cannot find satisfied tuple at #{@branches[0].name}!\") if res.ntuples == 0\n res\n end",
"def first\n resources.first\n end",
"def all\n self.all\n end"
] |
[
"0.6705962",
"0.66695285",
"0.66695285",
"0.65365225",
"0.64858747",
"0.6473638",
"0.64353824",
"0.64353824",
"0.64353824",
"0.64353824",
"0.63323516",
"0.63323516",
"0.63323516",
"0.6331306",
"0.6305375",
"0.6199527",
"0.61174804",
"0.6027006",
"0.5920959",
"0.5886116",
"0.5879099",
"0.5830484",
"0.5829668",
"0.5806706",
"0.5796453",
"0.5795507",
"0.5723785",
"0.5693322",
"0.5691467",
"0.56396365",
"0.5636301",
"0.56361043",
"0.5618063",
"0.56084406",
"0.56049377",
"0.56035787",
"0.5576748",
"0.5576714",
"0.5567053",
"0.54950833",
"0.5490163",
"0.5477724",
"0.54608935",
"0.54469675",
"0.54425687",
"0.5428737",
"0.5424689",
"0.54046065",
"0.5396941",
"0.53963095",
"0.53917015",
"0.53773075",
"0.53748333",
"0.5357251",
"0.5352314",
"0.5351813",
"0.5350576",
"0.5341783",
"0.5325334",
"0.5310255",
"0.5308352",
"0.5308352",
"0.5305698",
"0.5305453",
"0.5305453",
"0.5293634",
"0.52673435",
"0.52468306",
"0.52452207",
"0.52411264",
"0.52371067",
"0.5233114",
"0.5232686",
"0.52309555",
"0.52207804",
"0.521648",
"0.52139664",
"0.5204372",
"0.52025753",
"0.52013427",
"0.5196201",
"0.5193812",
"0.5193563",
"0.5176032",
"0.5173825",
"0.51729375",
"0.51710343",
"0.5170418",
"0.51685214",
"0.5164679",
"0.5164679",
"0.5163062",
"0.51576144",
"0.5157567",
"0.51535827",
"0.51308",
"0.512827",
"0.5127342",
"0.512703",
"0.5125527",
"0.5113473"
] |
0.0
|
-1
|
convert hash into json and save to file
|
def save()
File.write(@database_file, @data.to_json)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_hash_to_file(hash, file_path)\n File.open(file_path, 'w') do |f|\n f.puts hash.to_json\n end\nend",
"def writeHashToJSON(hash, filename)\n File.open(\"./\" + filename,\"w\") do |f|\n f.write(JSON.pretty_generate(hash))\n end\nend",
"def write_fund_hash(fund_hash)\n File.write(\"save.json\", JSON.generate(fund_hash))\n end",
"def write_to_json\n p_hash = pretty_hash()\n File.open(\"map_data2.json\",\"w\") do |f|\n my_json = JSON.pretty_generate(p_hash)\n f.write(my_json)\n end\n end",
"def write_json(user_hash)\n File.exist?('public/user.json') ? json = JSON.parse(File.read('public/user.json')) : json = []\n File.open(\"public/user.json\",\"w\") { |f| f.puts JSON.pretty_generate(json << user_hash) }\nend",
"def save_as_json\n File.open(\"db/emails.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(@hash_villes_emails))\n end\n end",
"def writeHashToJSON(hash, jsonfile, logkey='')\n if not hash.empty?\n Mcmlln::Tools.write_json(hash, jsonfile)\n else\n logstring = 'no data to write to json (empty hash)'\n end\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def put_hash(name, hash)\n file_name = File.join(@db_dir, name + '.json')\n begin\n RobustFile.write(file_name, hash.to_json)\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write hash file '#{file_name}': #{e.message}\"\n end\n end",
"def format_hash(hash)\n return hash.to_json\n end",
"def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database)\n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n\n\n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend",
"def save_hashes_for_write\n \n end",
"def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database) \n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend",
"def export(hash, file)\n File.open(file, 'wb:utf-8') { |f| f.write dump(hash) }\n end",
"def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend",
"def write(json_hash:)\n JSON.pretty_generate(json_hash).tap do |json_string|\n @pathname.write(json_string)\n end\n end",
"def stringify_hash(hash)\n JSON.load(JSON.dump(hash))\n end",
"def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end",
"def save_dict(filename)\n File.open(filename,'w') do |f|\n f.write(JSON.generate(@hash_dict))\n end\n end",
"def hash_to_json( hash )\r\n data = hash.map { |key, value| \"#{key.inspect}: #{value.inspect}\" }\r\n \"{#{data.join(',')}}\"\r\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def save_round_json(slug, round)\n #Check if the match directory exists already\n match_directory = File.join(@logs_directory, @match.slug)\n unless File.directory?(match_directory)\n FileUtils.mkdir_p(match_directory)\n end\n filename = File.join(match_directory, slug + \".json\")\n #Write round hash to json file\n File.open(filename, \"w\") do |file|\n file.write(round.to_json)\n end\n end",
"def test_1_verify_data_output_to_new_json_file\n user_hash = {\"user_name\"=>\"Abby\",\"user_age\"=>\"20\",\"num_1\"=>\"2\",\"num_2\"=>\"4\",\"num_3\"=>\"6\"}\n write_json(user_hash)\n result = read_json()\n assert_equal([{\"user_name\"=>\"Abby\",\"user_age\"=>\"20\",\"num_1\"=>\"2\",\"num_2\"=>\"4\",\"num_3\"=>\"6\"}], result)\n end",
"def get_json(hash)\n MultiJson.dump(hash)\n end",
"def save(file=nil)\n @file = file if file\n FileUtils.mkdir_p(File.dirname(@file))\n File.open(@file,'w') do |f|\n f.write(JSON.pretty_generate(@h))\n end\n self\n end",
"def jsonlogger()\n tempHash = {\n \"commit_hash\" => $commit_hash,\n \"commit_author\" => $commit_author,\n \"r10k_version\" => $r10k_version,\n \"number_of_modules\" => $number_of_modules,\n \"number_of_missing_modules\" => $number_of_missing_modules,\n \"modules\" => $modules,\n \"missingmodules\" => $missingmodulesoutput\n }\n File.open('test.json',\"a\") do |f|\n f.puts(tempHash.to_json)\n end\n end",
"def write_json_file(ember_json_file_name, new_hash)\n\t\tFile.open(ember_json_file_name, 'w') do |file|\n\t\t\tformatted = JSON.pretty_generate(new_hash, :indent => \"\\t\")\n\t\t\tfile.write(formatted)\n\t\tend\n\tend",
"def jsonify(hash)\n deep_reduce(hash) do |k, v, h|\n if v.is_a?(String)\n if v.encoding == ::Encoding::ASCII_8BIT\n # Only keep binary values less than a certain size. Sizes larger than this\n # are almost always file uploads and data we do not want to log.\n if v.length < BINARY_LIMIT_THRESHOLD\n # Attempt to safely encode the data to UTF-8\n encoded_value = encode_string(v)\n if !encoded_value.nil?\n h[k] = encoded_value\n end\n end\n elsif v.encoding != ::Encoding::UTF_8\n h[k] = encode_string(v)\n else\n h[k] = v\n end\n elsif is_a_primitive_type?(v)\n # Keep all other primitive types\n h[k] = v\n end\n end\n end",
"def save_as_JSON\n @result_pretty = JSON.pretty_generate(@result_scrap)\n File.open(\"./db/#{@name}.json\",\"w\") do |f|\n f.write(@result_pretty)\n end\n end",
"def to_json_file(path)\n File.open(path, 'wb'){|f| f.print to_json; }\n end",
"def jsonify(hash)\n Yajl::Encoder.encode(hash)\n end",
"def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end",
"def sync\n return if @no_sync\n File.open( @filename, \"w\" ) do |f|\n Marshal.dump( @hash, f )\n end\n end",
"def json\n JSON.pretty_generate(hash)\n end",
"def add_user_to_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash[@username] = Hash.new\n hash[@username]['email'] = @email\n hash[@username]['sports'] = @sport\n hash[@username]['info'] = @info\n hash[@username]['subscription'] = @subscription\n hash[@username]['last_email_sent'] = Time.now.strftime \"%d/%m/%Y\"\n File.open \"user_information/user_data.json\",\"w\" do |f|\n f.puts JSON.pretty_generate hash\n end\n end",
"def save\n File.open(filepath, 'w') do |file|\n file.write to_json + \"\\n\"\n end\n end",
"def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend",
"def serialize(hash)\n string = VCR::Cassette::Serializers::YAML.serialize(hash)\n Zlib.deflate(string)\n end",
"def to_json\n #JSON.fast_generate(to_hash)\n JSON.pretty_generate(to_hash)\n end",
"def to_json\n #JSON.fast_generate(to_hash)\n JSON.pretty_generate(to_hash)\n end",
"def serialize(hash)\n handle_encoding_errors do\n ::YAML.dump(hash)\n end\n end",
"def save\n File.open(path, \"w+\") do |f|\n f.write(FFI_Yajl::Encoder.encode(to_hash, pretty: true))\n end\n\n true\n end",
"def save_to_file()\n File.open(@filename,\"w\") do |f|\n movies_hash = []\n @items.each do |movie|\n movies_hash.push(movie.to_hash)\n end\n f.write(JSON.pretty_generate(movies_hash))\n end\n end",
"def generate_hash\n \n tmp_file = \"/tmp/zotero.xml\"\n \n File.open(tmp_file, \"w\") { |f| f << @datastreams[\"zotero\"] }\n \n # Check to make sure zotero.xml file has been written\n raise \"Couldn't write #{tmp_file}\" unless File.exist?(tmp_file) and File.file?(tmp_file)\n \n php_output = `/usr/bin/env php #{File.join(Rails.root, 'lib/stanford/zotero_to_json.php' )} /tmp/zotero.xml`\n # puts php_output.inspect\n \n json = JSON(php_output)\n # puts json.inspect\n json.is_a?(Array) ? json = json.first : json = json\n \n if json.nil? or json.is_a?(String)\n json = {}\n end\n\n # this is really stupid, but it's a quick fix to get the coverage data.\n xml = Nokogiri::XML(open(\"/tmp/zotero.xml\"))\n xml.search(\"//dc:coverage\").each do |cov| \n format_coverage(cov.content.strip).each do |key,vals|\n json[\"#{key}\"] ||= [] \n json[\"#{key}\"] << vals.first\n end\n end\n [\"druid\", \"title\", \"originator\", \"date\", \"document_type\", \"document_subtype\",\n \"containing_work\", \"corporate_entity\", \"extent\", \"language\", \"abstract\", \n \"EAF_hard_drive_file_name\", \"tags\", \"notes\", \"box\", \"folder\", \"subseries\"].each {|k| json[k] ||= \"\" }\n return json\n\n end",
"def jsonify_hash hash\n hash = (hash || {}).to_h\n return hash if hash.empty?\n JSON.parse(JSON.dump(hash))\n end",
"def save\n File.binwrite(file, JSON.pretty_generate(@cache))\n end",
"def write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend",
"def simple_json(hash)\n str = hash.inject('{') {|str, pair| str << pair[0].to_s.inspect << ':' << pair[1].inspect << \",\" }\n str[-1] = '}'\n str\n end",
"def save_output_json(data)\n File.open(\"output.json\", \"wb\") {|f| f.write(JSON.pretty_generate(data))}\nend",
"def to_json\r\n to_hash.to_json\r\n end",
"def write(filename, hash)\n File.open(filename, \"w\") { |f| f.write(hash.to_yaml) }\nend",
"def save_hashes\n @storage.save_hash_tree @hash_tree_controller.node_hashes\n end",
"def save!\n # Scrub some fields\n @data[\"installed\"].sort!\n @data[\"installed\"].uniq!\n\n # Save\n @path.open(\"w+\") do |f|\n f.write(JSON.dump(@data))\n end\n end",
"def convert\n old = @hashes\n @hashes = Hash.new\n\n puts 'Warning: old JSON format detected, converting.'\n old.each {|i| add_hash(i[:id], i[:deletehash], 'unknown') }\n save\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def convert_array_of_hashes(array_of_hashes)\n new_recipes_hash = {}\n array_of_hashes.each do |to_merge|\n to_merge.each do |r,i|\n new_recipes_hash[r] = i\n end\n end\n json_edit = {\"recipes\"=>new_recipes_hash}\n File.write(\"JSON/recipes.json\", JSON.dump(json_edit))\nend",
"def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend",
"def to_json\n Yajl::Encoder.encode(to_hash, :pretty => true)\n end",
"def to_json\n Oj.dump(to_hash)\n end",
"def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end",
"def save_file(updated_good_causes, charity_coins, budget_dollars, username)\n # updated_good_causes is an array of objects\n # the others are all single values\n\n all_data_hash = \n {\n charity_causes: updated_good_causes.map { |cause| cause.to_json_format }, # this will iterate and add to hash as value to key charity_causes:\n userdata: {\n username: username,\n budget: budget_dollars.to_i,\n charity_coins: charity_coins.to_i\n }\n }\n\n File.write('./data/user_data.json', JSON.pretty_generate(all_data_hash))\n\n end",
"def save_state\n json_object = { :secret_word => @secret_word, :display_content => @display_content,\n \t :failed_attemps => @failed_attemps }.to_json\n File.open(\"saved_state.json\", \"w\") { |file| file.write(json_object) }\n end",
"def to_json\n return to_hash.to_json\n end",
"def create\n file = File.open(\"db/emails.json\", \"w\")\n system \"clear\"\n puts \"Création du tableau de hash pour le departement du Rhone...\".green\n hash_lyon = get_all_the_urls_townhalls_rhone\n puts \"Création du tableau de hash pour le departement du Cote d'or...\".green\n hash_cote_d_or = get_all_the_urls_townhalls_cot_d_or\n puts \"Création du tableau de hash pour le departement du Bouche du Rhone...\".green\n hash_bouch_du_rhone = get_all_the_urls_townhalls\n puts \"Fusion des tableaux de hash...\".red\n hash = hash_lyon.merge(hash_cote_d_or)\n super_hash = hash.merge(get_all_the_urls_townhalls)\n puts \"Création du fichier .json\".green\n puts \"FIN...\".green\n return File.open(\"db/emails.json\",\"w\") do |f|\n f.write(super_hash.to_json)\n end\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end",
"def save_data(data)\n raw = JSON.dump(data)\n File.open(FILENAME, 'w') do |file|\n file.write(raw)\n end\nend",
"def serialize(hash)\n hash.inspect\n end",
"def write_to_json(raw_input, create_filename)\n input_hash = raw_input.split(\"\\n\").map do |line|\n string = line.split(\" \")\n {\"first_index\" => string[0].split(\"-\")[0].to_i, \"second_index\" => string[0].split(\"-\")[1].to_i, \"character\" => string[1].gsub(':', ''), \"password\" => string[2]}\n end\n File.open(\"#{create_filename}\", \"w\") do |f| \n f.write(JSON.pretty_generate(input_hash))\n end\nend",
"def format(hash)\n hash.inject({}) do |memo, (key, value)|\n if key.to_s.eql? 'iterations'\n value = value.to_i\n else\n value = convert_to_blob value\n end\n memo[key.to_s] = value\n memo\n end\n end",
"def output_hash; end",
"def edit_hash(hash)\n raw = edit_data(hash, false)\n Chef::JSONCompat.parse(raw)\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def update_file\n file = File.read('./user.json')\n data_hash = JSON.parse(file)\n data_hash['balance'] = @user[:balance]\n File.write('./user.json', JSON.dump(data_hash))\n end",
"def store\n\n File.open(@szpm_file, 'w') { |file|\n file.write( JSON.pretty_generate(@structure) )\n }\n\n parse\n end",
"def save\n #we create a hash to save the values into:\n new_json = {name: @name, email: @email, permissions: @permissions}.to_json\n #we open a new file and append (a) the new values to it.\n open('users.json', 'a') do |file|\n file.puts new_json\n end\n\n end",
"def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend",
"def set_hash_and_json\n @hash = {header: @header, payload: @payload, signature: encode(@signature)}\n @json = \"#{@header.to_json}.#{@payload.to_json}.#{encode(@signature)}\"\n end",
"def save\n File.open(path, 'w+') do |f|\n f.write(to_json)\n end\n\n true\n end",
"def write(filename, hash)\n File.open(filename, \"a\") do |f|\n f.write(yaml(hash))\n end\nend",
"def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end",
"def save\n cache_json = JSON.generate @_cache\n File.open(@file_path, 'w') { |file| file.write(cache_json) }\n end",
"def to_file(filename)\n\tdata2write\t= JSON.pretty_generate(@json_data);\n\tFile.open(filename, 'w+'){|f| f.write(data2write)}\nend",
"def to_json!\n File.open(\"./meta_data.json\", \"w+\") { |f| f.puts JSON.pretty_generate(raw_data) }\n end",
"def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end",
"def to_json\n return Json.dump(to_hash)\n end",
"def to_json\n to_hash.to_json\n end",
"def writeJSONToFile(b)\n count = 0\n File.open('data/all.json', 'w') do |json| \n json.puts b.getJSON(\"\\t\").chomp(\",\\n\")\n end\n end",
"def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end",
"def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end",
"def to_hash() end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end",
"def to_json\n to_hash.to_json\n end"
] |
[
"0.7775292",
"0.76422435",
"0.74232256",
"0.7187349",
"0.71720624",
"0.7124088",
"0.6991568",
"0.6972617",
"0.6871131",
"0.68537474",
"0.68434983",
"0.6817205",
"0.6779963",
"0.67663616",
"0.6760551",
"0.66414696",
"0.66293204",
"0.65549237",
"0.6541955",
"0.6532362",
"0.6517311",
"0.6512023",
"0.64328897",
"0.6403644",
"0.63974845",
"0.6360535",
"0.6354291",
"0.63387614",
"0.6316017",
"0.63130295",
"0.6275279",
"0.6269848",
"0.62587965",
"0.62537545",
"0.62169665",
"0.62114644",
"0.61964846",
"0.6191307",
"0.6191307",
"0.61789984",
"0.6153827",
"0.6130547",
"0.6128908",
"0.6126528",
"0.61212146",
"0.61150014",
"0.6110886",
"0.61046714",
"0.60912114",
"0.6077",
"0.60663927",
"0.60437745",
"0.60431105",
"0.60411316",
"0.60411316",
"0.6033969",
"0.6024802",
"0.60218656",
"0.6011199",
"0.6001047",
"0.59514755",
"0.59459424",
"0.5938408",
"0.5937217",
"0.59347427",
"0.59299445",
"0.5913145",
"0.5908283",
"0.5899208",
"0.5893526",
"0.5891102",
"0.58889645",
"0.58870685",
"0.5879917",
"0.5875322",
"0.587268",
"0.5866492",
"0.5864055",
"0.58629125",
"0.58543533",
"0.5849967",
"0.583975",
"0.5837336",
"0.5833541",
"0.5831588",
"0.5818647",
"0.5813358",
"0.5810752",
"0.5810628",
"0.5806765",
"0.5806765",
"0.579762",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116",
"0.5795116"
] |
0.0
|
-1
|
add info in the json file
|
def add(class_name, object)
@data = get_all()
@data[class_name].push(object.to_hash())
save()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_json(file)\n new_json = parse_json_file(file)\n store_all_cities(new_json)\n store_all_routes(new_json)\n end",
"def add_user_to_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash[@username] = Hash.new\n hash[@username]['email'] = @email\n hash[@username]['sports'] = @sport\n hash[@username]['info'] = @info\n hash[@username]['subscription'] = @subscription\n hash[@username]['last_email_sent'] = Time.now.strftime \"%d/%m/%Y\"\n File.open \"user_information/user_data.json\",\"w\" do |f|\n f.puts JSON.pretty_generate hash\n end\n end",
"def add_new_med(name, med_data)\n user_list = JSON.parse(File.read(\"./files/user_info.json\"))\n user_list[\"Users\"].each do |user|\n if user[\"Name\"] == name\n user[\"Medication\"] << med_data \n end\n end \n File.write(\"./files/user_info.json\", JSON.generate(user_list))\nend",
"def add_info(info)\n self.info.push info\n end",
"def save\n #we create a hash to save the values into:\n new_json = {name: @name, email: @email, permissions: @permissions}.to_json\n #we open a new file and append (a) the new values to it.\n open('users.json', 'a') do |file|\n file.puts new_json\n end\n\n end",
"def create_json\n File.open('data/pokemon.json', 'w+') do |f|\n f << JSON.pretty_generate(get_basic_data)\n end\nend",
"def write_info_file(option={})\n last_time = Util::LastTime.get(@info.filepaths.map{|path| @location + path})\n\n # update the scenario info file\n location = @location + \"pione-scenario.json\"\n if option[:force] or not(location.exist?) or last_time > location.mtime\n location.write(JSON.pretty_generate(@info))\n Log::SystemLog.info(\"update the scenario info file: %s\" % location.address)\n end\n end",
"def add_infos(hash)\n self.custom_attributes.merge!(hash)\n end",
"def jsonlogger()\n tempHash = {\n \"commit_hash\" => $commit_hash,\n \"commit_author\" => $commit_author,\n \"r10k_version\" => $r10k_version,\n \"number_of_modules\" => $number_of_modules,\n \"number_of_missing_modules\" => $number_of_missing_modules,\n \"modules\" => $modules,\n \"missingmodules\" => $missingmodulesoutput\n }\n File.open('test.json',\"a\") do |f|\n f.puts(tempHash.to_json)\n end\n end",
"def save\n File.open(filepath, 'w') do |file|\n file.write to_json + \"\\n\"\n end\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end",
"def user_adding\n puts 'User ID :'\n userid = gets.chomp.to_s\n\n puts 'User Name :'\n username = gets.chomp.to_s\n\n puts 'Password :'\n password = gets.chomp.to_s\n\n puts 'Level :'\n level = gets.chomp.to_s\n\n new_user = User.new(userid, username, password, level)\n\n $user_array.push(new_user.to_hash)\n\n File.open(\"Users.json\", \"w+\") do |f|\n f.puts($user_array.to_json)\n end\n puts \"Them moi nguoi dung thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"def public_json_output_file(info, file)\n # format as JSON\n results = JSON.pretty_generate(info)\n\n write_output(file, results)\n\nend",
"def update_file\n file = File.read('./user.json')\n data_hash = JSON.parse(file)\n data_hash['balance'] = @user[:balance]\n File.write('./user.json', JSON.dump(data_hash))\n end",
"def write_user(users)\nbegin\n File.open(\"./files/user_info.json\", \"w\") do |f|\n f.write(users.to_json)\n end \nrescue Errno::ENOENT\n puts \"This file does not exist, Please re-check source files\"\nend\n\nend",
"def send_to_file\n File.open(\"userDetails/#{@@username}.json\", \"a\") do |f|\n f.puts JSON.generate(@new_score)\n end\n end",
"def generate_json(json_file_name, data)\n File.open(json_file_name, 'w') do |f|\n f.puts(data.to_json)\n end\n end",
"def book_adding\n puts 'Ma so :'\n isbn = gets.chomp.to_s\n\n puts 'Ten sach :'\n title = gets.chomp.to_s\n\n puts 'Chu de :'\n subject = gets.chomp.to_s\n\n puts 'Tac gia :'\n author = gets.chomp.to_s\n\n puts 'Nha xuat ban :'\n publisher = gets.chomp.to_s\n\n puts 'Ngay xuat ban :'\n date = gets.chomp.to_s\n\n puts 'So trang :'\n pages = gets.chomp.to_s\n\n puts 'So ban copy :'\n copies = gets.chomp.to_s\n\n new_book = Book.new(isbn, title, subject, author, publisher, date, pages, copies)\n\n $books_array.push(new_book.to_hash)\n\n File.open(\"Books.json\", \"w+\") do |f|\n f.puts($books_array.to_json)\n end\n puts \"Da them sach moi thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"def save!\n # Scrub some fields\n @data[\"installed\"].sort!\n @data[\"installed\"].uniq!\n\n # Save\n @path.open(\"w+\") do |f|\n f.write(JSON.dump(@data))\n end\n end",
"def add_info(model_data)\n @model_data = model_data\n ensure_file_end_with_empty_line\n if File.exists?(model_path)\n File.open(model_path, 'a') do |file|\n file.puts(ExtendedContent.from(@model_data.content))\n end\n end\n end",
"def add_inv inv_file\n self.inventory_database = JSON.parse File.read(inv_file)\n end",
"def gather_information\n self.json = Services.dig_up_dirt(first_name, last_name).to_json\n save\n end",
"def write_json_file(ember_json_file_name, new_hash)\n\t\tFile.open(ember_json_file_name, 'w') do |file|\n\t\t\tformatted = JSON.pretty_generate(new_hash, :indent => \"\\t\")\n\t\t\tfile.write(formatted)\n\t\tend\n\tend",
"def write_epilogue\n puts @json.to_json\n super\n end",
"def addinfo\n\nend",
"def writeJSONToFile(b)\n count = 0\n File.open('data/all.json', 'w') do |json| \n json.puts b.getJSON(\"\\t\").chomp(\",\\n\")\n end\n end",
"def augment_new_json(json)\n json\n end",
"def write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend",
"def save\n puts \"Saving project information to #{project_file}\"\n json = MultiJson.encode(@attributes)\n File.open(project_file, 'w') { |f| f.write(json) }\n end",
"def save\n File.open(path, 'w+') do |f|\n f.write(to_json)\n end\n\n true\n end",
"def update_tests_info(tests_info)\n # Persist the tests information on disk\n FileUtils.mkdir_p File.dirname(@tests_info_file)\n File.write(@tests_info_file, JSON.pretty_generate(tests_info))\n @tests_info_cache = tests_info\n end",
"def write_json(user_hash)\n File.exist?('public/user.json') ? json = JSON.parse(File.read('public/user.json')) : json = []\n File.open(\"public/user.json\",\"w\") { |f| f.puts JSON.pretty_generate(json << user_hash) }\nend",
"def add(data)\n if count == 0\n fh.puts \"[\"\n else\n fh.puts \",\"\n end\n fh.write(JSON.pretty_generate(data))\n self.count += 1\n if count >= 100\n close\n end\n end",
"def add_persistent_property(file, name, value)\n current_config = File.read(file)\n rconfig = JSON.parse(current_config)\n rconfig[name] = value\n File.open(file, 'w') {|f| f.write(JSON.pretty_generate(rconfig))}\n end",
"def create_json(json_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write json_contents\n end\n end",
"def persist_info\n file = VER.loadpath.first / 'buffer_info.json'\n l \"Persisting Buffer info into: #{file}\"\n\n JSON::Store.new(file.to_s, true).transaction do |buffer_info|\n syntax_name = @syntax.name if @syntax\n\n buffer_info[uri.to_s] = {\n 'insert' => index('insert').to_s,\n 'syntax' => syntax_name\n }\n end\n end",
"def write_json(file)\n open(file, \"w\") do |io|\n \tio.write(JSON.pretty_generate(@data))\n end\n end",
"def filename\n files = Hash.new\n filenames = Dir.glob('/home/vagrant/register-stub/data/*.json')\n filenames.foreach(\".\") do |file|\n puts file\n files[file].add file\n end\n return files.to_json\nend",
"def write_to_json filename = \"#{title}.json\", options = {}\n File.open(filename, \"w\") { |f| f.write(to_json(options)) }\n filename\n end",
"def add_info( info_attributes = {})\n info = Info.new( info_attributes )\n self.infos << info\n info\n end",
"def bootstrap\n return if File.exist?(json_file)\n FileUtils.touch json_file\n File.open(json_file, 'w') {|f| f.write(to_json) }\n save\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"def save\n File.write @name, Oj.dump(as_json)\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"../report.txt\", \"w+\")\nend",
"def guarda nombre, data\n fname = \"#{$outDir}/#{nombre}.json\"\n puts \"Creando #{fname}\"\n FileUtils.mkdir_p File.dirname(fname)\n File.open(fname, 'w+') do |f|\n f << data.to_json\n end\nend",
"def augment_current_json(json)\n json\n end",
"def json_print_to_file\n outfile = File.open(\"metadata_output.json\", \"w\")\n outfile << JSON.pretty_generate(metadata)\n outfile.close\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"def bootstrap\n return if File.exist?(json_file) and !File.zero?(json_file)\n FileUtils.touch json_file\n File.open(json_file, 'w') {|f| f.write(to_json) }\n save\n end",
"def setup_files\n require 'json'\n\tpath = File.join(File.dirname(__FILE__), '../data/products.json')\n\tfile = File.read(path)\n\t$products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"def new_status_file()\n\n File.new('config/status.json', 'w+')\n\n file_source = File.read('config/ms_ports.json')\n data_hash = JSON.parse(file_source)\n services = []\n\n data_hash.each do |service|\n name = service[\"name\"]\n file_line = {'name' => name, 'status' => nil, 'health' => nil}\n services.push(file_line)\n end\n\n file_result = services.to_json\n File.write('config/status.json', file_result)\n return file_result\n end",
"def save(file = RC_FILE)\n @original['todo']['notes'] = @notes\n json = @original.to_json\n open(file, 'wb+') { |f| f.write(json) }\n end",
"def create_ext_json_file(directory)\n ext_json = {\n extensionID: self.get_extension_id,\n developerID: self.get_developer_id,\n createdBy: self.created_by,\n name: self.get_extension_name,\n version: VERSION,\n timeCreated: self.get_created_at,\n description: self.get_description\n }\n # write the file\n File.open(directory,\"w\") do |f|\n # call the convert_to_json private method and write a json file\n f.write(convert_to_json(ext_json))\n end\n end",
"def info_file\n @info_file ||= File.join(image_dir, '_info.json')\n end",
"def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database)\n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n\n\n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend",
"def to_json!\n File.open(\"./meta_data.json\", \"w+\") { |f| f.puts JSON.pretty_generate(raw_data) }\n end",
"def saveJSON\n File.open(\"./db/larves.json\", 'w') do |file|\n file.write(@url)\n end\n puts \"Ecriture effectuer avec success!\"\n end",
"def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend",
"def add_info\n UpcomingReleases::Album.all.each do |album|\n info = UpcomingReleases::Scraper.scrape_info_page(ALBUM_URL + album.info_url)\n album.add_album_info(info)\n end\n end",
"def save\n File.open(@path, \"w\") do |f|\n f.write(JSON.pretty_generate(\n \"version\" => VERSION,\n \"reqs\" => reqs,\n ))\n end\n end",
"def set_json\n File.open('public/json.json', 'wb') do |f|\n f.write(params[:json])\n end\n\n render json: {response: 'successful'}\n end",
"def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end",
"def write_json(a)\n write \"(\" + a.write_json_item + \")\\n\"\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n end",
"def store_json(json, compressed, album_type)\n if match_type(album_type)\n self.json = json\n self.compressed = compressed\n end\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"../report.txt\", \"w+\")\n\tend",
"def add_torrent(info)\r\n hash = { \"torrent-file\"=>info[0], \"file-dir\"=>info[1], \"download-dir\"=>info[2] }\r\n @torrents[\"torrent#{@torrents.length}\"] = hash\r\n @file_descriptor.seek(0, IO::SEEK_SET)\r\n @file_descriptor.write(@torrents.to_yaml)\r\n end",
"def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend",
"def addcontacts (host, port, jsonfile)\n\naddrecordpath = \"/phonebook/person/\"\n\nbegin\n\n\tfile = File.open(jsonfile, \"r\")\n\trecords = JSON.parse(file.read)\n\trecords.each do |record|\n\t\tputs JSON.pretty_generate(record)\n\t\t\n\t\taddrecord host, port, record\n\n\t\t#If photo field is not empty, try to upload a photo.\n\t\tif !record['photo'].to_s.empty?\n\t\t\timagelocation = record['photo'].to_s\n\t\t\timagename = \"#{record['firstname']}\\&!\\&\"\"#{record['lastname']}.jpg\"\n\t\t\tuploadfile host, port, imagelocation, imagename\n\t\tend\n\t\tputs \"\"\n\tend\n\nrescue Exception => e\n\tputs e.message\n\tputs e.backtrace.inspect\nensure\n\tfile.close if file\nend\n\nend",
"def save_data(file)\n File.open(file, 'w').write(JSON.pretty_generate(@data))\n end",
"def to_json_larves\n File.open(\"./db/monstre_larve.json\", 'w') do |file|\n file.write(@type)\n end\n puts \"JSON : monstre_larve.json => ok(voir dans le dossier db)\"\n end",
"def save(file=nil)\n @file = file if file\n FileUtils.mkdir_p(File.dirname(@file))\n File.open(@file,'w') do |f|\n f.write(JSON.pretty_generate(@h))\n end\n self\n end",
"def save_file(updated_good_causes, charity_coins, budget_dollars, username)\n # updated_good_causes is an array of objects\n # the others are all single values\n\n all_data_hash = \n {\n charity_causes: updated_good_causes.map { |cause| cause.to_json_format }, # this will iterate and add to hash as value to key charity_causes:\n userdata: {\n username: username,\n budget: budget_dollars.to_i,\n charity_coins: charity_coins.to_i\n }\n }\n\n File.write('./data/user_data.json', JSON.pretty_generate(all_data_hash))\n\n end",
"def write_json_file(json, filepath)\n File.open(filepath,\"w\") do |f|\n f.write(json.to_json)\n end\nend",
"def add_file(file)\n raise FileError, 'Piece length must be greater than 0' if @data['info']['piece length'] <= 0\n\n if @data['info'].key?('name') && @data['info'].key?('length')\n @data['info']['files'] = []\n @data['info']['files'] << {\n 'path' => [@data['info']['name']],\n 'length' => @data['info']['length']\n }\n @data['info'].delete('name')\n @data['info'].delete('length')\n end\n\n if @data['info'].key?('files')\n @data['info']['files'] << {\n 'path' => file.split('/'),\n 'length' => ::File.size(file)\n }\n @data['info']['pieces'] += hash_file(file, @data['info']['piece length'])\n return\n end\n\n @data['info']['name'] = ::File.basename(file)\n @data['info']['length'] = ::File.size(file)\n @data['info']['pieces'] = hash_file(file, @data['info']['piece length'])\n end",
"def populate\n file = File.new(json_file, 'r')\n storage = Yajl::Parser.parse(file)\n\n storage['lists'].each do |lists|\n lists.each do |list_name, items|\n @lists << list = List.new(list_name)\n\n items.each do |item|\n item.each do |name,value|\n list.add_item(Item.new(name,value))\n end\n end\n end\n end\n end",
"def new_pattern\n # display file\n if File.exist?('jsons/new_project.json')\n render file: 'jsons/new_project.json', status: 200, content_type: \"application/json\"\n else\n render nothing: true, status: 500\n end\n end",
"def update_file_level_data!(key_val_pairs)\n # Create corresponding data.json file if it doesn't exist yet\n cdjf = corresponding_data_json_file(true)\n cdjf.update_data!(key_val_pairs)\n end",
"def update_file\n updated_data = Login.load_data.each { |user| user['mylist'] = @mylist if user['id'] == @user.uid.to_s }\n File.open(userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n puts 'Sweet! Your list has been updated!'.colorize(:light_green)\n @prompt.keypress('Press any key to return to the previous menu..')\n @menu.my_list\n end",
"def recupera_json(nome_arq)\n linha = ''\n File.open(nome_arq, 'r').each_line do |line|\n if line.include? 'trackinfo: '\n linha = line\n break\n end\n end\n linha.slice!(-2..-1)\n linha.slice!(' trackinfo: ')\n JSON.parse linha\nend",
"def save_json(dir)\n save_json_one(dir, country_data, 'country')\n save_json_one(dir, us_state_data,'us_state')\n save_json_one(dir, us_metro_data, 'us_metro')\n save_json_one(dir, us_county_data, 'us_county')\n\n bn = File.basename(dir)\n dn = File.dirname(dir)\n\n\n puts \"Uploading json data\"\n Dir[File.join(dir,'*.json')].each do |path|\n bn = File.basename(path)\n dn = File.dirname(path)\n cmd = \"curl -u 'corona@coronamodel.com:Pp[31415926]' --ftp-create-dirs -s -T #{dn}/#{bn} ftp://160.153.91.2/standalone/#{bn}\"\n r = `#{cmd} 2>&1`.chomp\n r = ' - ERRORS: ' + r unless r.empty?\n puts \" #{bn}#{r}\"\n end\n end",
"def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database) \n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend",
"def save_list(file_path)\n jsonArray = @array.map { |property| \n {\n \"property_id\": property.property_id,\n \"type\": property.type,\n \"address\": {\n \"street_number\": property.address[:street_number],\n \"street_name\": property.address[:street_name],\n \"suburb\": property.address[:suburb]\n },\n \"weekly_rent\": property.rent,\n \"status\": property.status,\n \"landlord\": {\n \"first_name\": property.landlord.first_name,\n \"last_name\": property.landlord.last_name\n },\n \"tenant\": {\n \"first_name\": property.tenant.first_name,\n \"last_name\": property.tenant.last_name\n }\n }\n }\n \n File.write(file_path, JSON.pretty_generate(jsonArray))\n end",
"def process_file (filename)\n\n @log.info \"ApplicationAuthorization file: \" + filename\n if File.exists?('updated.json')\n @log.error \"updated.json already exists\"\n exit 1\n end\n if File.exists?(filename)\n File.readlines(filename).each do |line|\n begin\n aa_json = JSON.parse(line)\n rescue Exception => e\n @log.error \"Unable to parse line as json: \" + line\n e.backtrace.each { |trace_line| @log.error trace_line }\n next\n end\n body = aa_json[\"body\"]\n edorgs = body[\"edorgs\"]\n new_edorgs = Array.new\n edorgs.each do |edorg|\n new_hash = Hash.new\n new_hash[\"authorizedEdorg\"] = edorg\n new_edorgs.insert(-1, new_hash)\n end\n body[\"edorgs\"] = new_edorgs\n File.open('updated.json', 'a') do |file|\n file.puts(aa_json.to_json)\n end\n end\n end\n FileUtils.mv('updated.json', filename) if File.exist?('updated.json')\n\nend",
"def write\n return if PictureTag.site.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n f.write JSON.generate(data)\n end\n end",
"def test_1_verify_data_output_to_new_json_file\n user_hash = {\"user_name\"=>\"Abby\",\"user_age\"=>\"20\",\"num_1\"=>\"2\",\"num_2\"=>\"4\",\"num_3\"=>\"6\"}\n write_json(user_hash)\n result = read_json()\n assert_equal([{\"user_name\"=>\"Abby\",\"user_age\"=>\"20\",\"num_1\"=>\"2\",\"num_2\"=>\"4\",\"num_3\"=>\"6\"}], result)\n end",
"def add(data)\n params = self.params\n data['add']['parameters'].each { |k,v|\n params[k] = v\n }\n write(params)\n data['add']['parameters']\n end",
"def update_info(uid, info)\n object(\"#{uid}.info\").put(body: info.to_json)\n end",
"def create_meta(file_name, uid, uname, user_address)\n hist_dir = history_dir(storage_path(file_name, user_address)) # get the path to the file history\n\n # write user name, user uid and the creation time to the json object\n json = {\n :created => Time.now.to_formatted_s(:db),\n :uid => uid,\n :uname => uname\n }\n\n # write file meta information to the createdInfo.json file\n File.open(File.join(hist_dir, \"createdInfo.json\"), 'wb') do |file|\n file.write(json.to_json)\n end\n end",
"def load_json(filename); end",
"def save_to_directory(directory)\n entries.each do |entry|\n FileUtils.mkdir_p \"#{directory}/#{entry.directory}\"\n File.write \"#{directory}/#{entry.filepath}\", entry.to_s\n end\n\n File.write \"#{directory}/info.json\", Oj.dump(info, indent: 2)\n true\n end",
"def to_json_larves\n File.open(\"./db/larves.json\", 'w') do |file|\n file.write(@type)\n end\n puts \"Fichier larves.json \"\n end",
"def get_json\n recipe_json = File.read('./recipes.json')\n @json_recipes = JSON.parse(recipe_json)\n end",
"def to_json_monsters1\n File.open(\"./db/Monstres_des_cavernes.json\", 'w') do |file|\n file.write(@type)\n end\n puts \"...ecriture dans le fichier Monstres_des_cavernes.json... success!\"\n end",
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def addStudent(stu_name, grd)\n file_name = \"DB/\" + @name + \".db\"\n to_edit = File.read(file_name)\n File.open(file_name, 'w+') do |file|\n school = JSON.parse(to_edit)\n #students = []\n # #students << stu_name\n # if school['structure'][grd] != nil #school['structure'][grd] || = []\n # school['structure'][grd] << stu_name\n # #puts \"??????\"\n # else\n # students = []\n # students << stu_name\n # school['structure'][grd] = students\n # end\n school['structure'][grd.to_s] ||= []\n school['structure'][grd.to_s] << stu_name\n\n file.write(school.to_json)\n end\n end",
"def to_json_monsters2\n File.open(\"./db/Monstres_des_plaines_herbeuses.json\", 'w') do |file|\n file.write(@type)\n end\n puts \"...ecriture dans le fichier Monstres_des_plaines_herbeuses.json... success!\"\n end",
"def setup_files\n\tpath = File.join(File.dirname(__FILE__), '../data/products.json')\n\tfile = File.read(path)\n\t$products_hash = JSON.parse(file)\n\t$report_file = File.new(\"report.txt\", \"w+\")\nend",
"def to_json_larves\n File.open(\"./db/Larves.json\", 'w') do |file|\n file.write(@type)\n end\n puts \"... ecriture dans le fichier larves.json...success! \"\n end",
"def write_info(new_info)\n\tinfo = File.open(\"/Users/aasteward/Code/drills/007/accounts.csv\", \"a\")\n\tinfo.print new_info\n\tinfo.close\nend"
] |
[
"0.73534614",
"0.71178865",
"0.7101964",
"0.63882226",
"0.62845576",
"0.6174899",
"0.61630577",
"0.6126698",
"0.61131954",
"0.6105447",
"0.61017364",
"0.61017364",
"0.609724",
"0.60946155",
"0.6085512",
"0.6063037",
"0.6058491",
"0.60304344",
"0.5997716",
"0.5976724",
"0.596643",
"0.59562266",
"0.59241456",
"0.59033006",
"0.58991337",
"0.5875657",
"0.587116",
"0.5861996",
"0.58461225",
"0.5829524",
"0.5805968",
"0.5800105",
"0.57974106",
"0.57882094",
"0.5785286",
"0.5759805",
"0.5740819",
"0.57359976",
"0.5730668",
"0.5712735",
"0.57105136",
"0.5705441",
"0.5700306",
"0.56989396",
"0.56695825",
"0.5659338",
"0.56564814",
"0.5654721",
"0.5650298",
"0.56414694",
"0.5631069",
"0.56266177",
"0.5622399",
"0.56203264",
"0.56153363",
"0.5613283",
"0.5604496",
"0.55773383",
"0.55740225",
"0.5572897",
"0.5560392",
"0.55546093",
"0.555011",
"0.55423295",
"0.5542062",
"0.5538509",
"0.5530479",
"0.5529747",
"0.55251914",
"0.552171",
"0.5520918",
"0.55040514",
"0.5502",
"0.550045",
"0.5498843",
"0.54976225",
"0.54828066",
"0.54729384",
"0.545917",
"0.54590964",
"0.5452107",
"0.54481655",
"0.54460466",
"0.5441573",
"0.54406255",
"0.5440057",
"0.5439101",
"0.5438165",
"0.5437731",
"0.54368776",
"0.543632",
"0.54323304",
"0.54279333",
"0.5413134",
"0.5407889",
"0.54058176",
"0.54047436",
"0.5402169",
"0.5388813",
"0.53881454",
"0.53868085"
] |
0.0
|
-1
|
edit item in the json file and save
|
def edit(class_name, object)
begin
@data = get_all()
# go through all items in the file
@data[class_name].map!{|item|
if item["id"] == object["id"]
object
else
item
end
}
save()
rescue Exception => e
raise "Either class_name: #{class_name} or object: #{object} are invalid."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit\n require 'ruby-debug'; debugger\n if storage.respond_to?(\"json_file\")\n output \"#{cyan(\"Boom!\")} #{Platform.edit(storage.json_file)}\"\n else\n output \"This storage backend #{red storage.class} does not store #{cyan(\"Boom!\")} data on your computer\"\n end\n end",
"def save(file = RC_FILE)\n @original['todo']['notes'] = @notes\n json = @original.to_json\n open(file, 'wb+') { |f| f.write(json) }\n end",
"def book_editing\n book_seaching\n puts \"Nhap index record muon sua\"\n edit_index = gets.chomp.to_i\n puts \"-------------Nhap thong tin moi---------------\"\n puts 'Ma so :'\n isbn = gets.chomp.to_s\n\n puts 'Ten sach :'\n title = gets.chomp.to_s\n\n puts 'Chu de :'\n subject = gets.chomp.to_s\n\n puts 'Tac gia :'\n author = gets.chomp.to_s\n\n puts 'Nha xuat ban :'\n publisher = gets.chomp.to_s\n\n puts 'Ngay xuat ban :'\n date = gets.chomp.to_s\n\n puts 'So trang :'\n pages = gets.chomp.to_s\n\n puts 'So ban copy :'\n copies = gets.chomp.to_s\n\n new_book = Book.new(isbn, title, subject, author, publisher, date, pages, copies)\n\n $books_array[$search_result_array[edit_index-1].to_i] = new_book.to_hash\n\n File.open(\"Books.json\", \"w+\") do |f|\n f.puts($books_array.to_json)\n end\n puts \"Thong tin sach da duoc update. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def edit_data(&block)\n lock do\n @cached_data = load_data_from_file\n block.call(self)\n File.safe_write(path, JSON.pretty_generate(@cached_data))\n @cached_data\n end\n end",
"def update_file\n file = File.read('./user.json')\n data_hash = JSON.parse(file)\n data_hash['balance'] = @user[:balance]\n File.write('./user.json', JSON.dump(data_hash))\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def edit_item(item, name, price, quantity, currency, description = \"\", image = \"\")\n item.edit(name, price, quantity, currency, description, image)\n Activity.log(self, \"edit_item\", item, self.working_for)\n end",
"def update\n @item = @collection.items.get(params[:id])\n @collection.schema.each do |field|\n if params[:item][field.to_s].blank? && !field.is_file\n @item[field.name]=nil\n elsif field.is_file\n #do nothing\n unless params[:item][field.to_s].nil?\n new_file = @file_collection.items.new()\n new_file.file =params[:item][field.to_s]\n new_file.save\n @item[field.name]='{\"project\":{\"id\": \"'+@project.id+'\"}, \"collection\":{\"id\": \"'+@file_collection.id+'\"},\"item\":{\"id\": \"'+new_file.id.to_s+'\", \"display\": \"'+new_file.original_filename+'\"}}'\n end\n else\n @item[field.name] = params[:item][field.to_s]\n end\n end\n if @item.save\n update_associated_fields(@item, @collection, @project)\n respond_to do |format|\n format.html do\n flash[:notice] = \"Item Updated Successfully!\"\n end\n #format.json { render json: @item.to_json, status: :updated}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item updated. Close window and refresh your page.</h2>\").attr(\"class\",\"message notice\"); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n else\n respond_to do |format|\n format.html do\n flash[:error] = [\"Item failed to save! Errors:\", @item.errors.full_messages].flatten.join(' ')\n end\n format.json { render json: @item.to_json, status: :error}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item failed update.</h2>\").attr(\"class\",\"message error\").scrollTop(0); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n end\n redirect_to :back\n end",
"def update_file\n updated_data = Login.load_data.each { |user| user['playlist'] = @user.playlist if user['id'] == @user.uid.to_s }\n File.open(userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n puts 'Sweet! Your list has been updated!'.colorize(:light_green)\n @prompt.keypress('Press any key to return to the previous menu..')\n menu = Menu.new(@user)\n menu.menu_router\n end",
"def update_file\n updated_data = Login.load_data.each { |user| user['mylist'] = @mylist if user['id'] == @user.uid.to_s }\n File.open(userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n puts 'Sweet! Your list has been updated!'.colorize(:light_green)\n @prompt.keypress('Press any key to return to the previous menu..')\n @menu.my_list\n end",
"def edit(args=[])\n raise ArgumentError.new \"Edit requires the item number you wish to edit\" unless args.length > 0\n\n item_list = items\n index = args[0].to_i - 1\n\n if item_list.length < index + 1\n puts \"There is no item #{args[0]}\"\n else \n puts\n puts \"EDITING ITEM #{args[0]}\"\n puts \"Current > #{item_list[index]}\"\n print \"Update > \"\n item_list[index] = gets\n\n File.write(@filename, item_list.join)\n end\n end",
"def save\n File.open(filepath, 'w') do |file|\n file.write to_json + \"\\n\"\n end\n end",
"def save\n #we create a hash to save the values into:\n new_json = {name: @name, email: @email, permissions: @permissions}.to_json\n #we open a new file and append (a) the new values to it.\n open('users.json', 'a') do |file|\n file.puts new_json\n end\n\n end",
"def edit(key, item)\n\t\tcurrent_item = Item.find(key.to_i)\n\t\tcurrent_item.update_attributes(item_params(item))\n\t\tflash[:success] = \"Item(s) edited\"\n\tend",
"def save\n File.open(path, 'w+') do |f|\n f.write(to_json)\n end\n\n true\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def updated(item)\n bowline.updated(\n name, \n item.id, \n item.to_js\n ).call\n end",
"def update obj, &block\n populate(obj, &block).save!\n json obj\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def edit\n yield if block_given?\n save\n end",
"def save\n if new_record?\n overwrite @api.post(\"/meetings/#{meeting.shortcode_url}/items.json\",\n 'content' => content)\n else\n overwrite @api.put(\"/items/#{shortcode_url}.json\", 'content' => content)\n end\n end",
"def editing_update(item = nil, **attr)\n rec = edit_record(item)\n file = attr.key?(:file_status) || attr.key?(:file_data)\n data = attr.key?(:data_status) || attr.except(*RECORD_KEYS).present?\n ready = attr.key?(:ready_status) || file || data\n attr[:attr_opt] = { file: file, data: data, ready: ready }\n update_record(rec, **attr, editing: false)\n Hash(\n items: { rec.id => rec.fields.except(*NON_DATA_KEYS) },\n pending: (rec.manifest.pending_items_hash if file || data || ready),\n problems: rec.errors.to_hash,\n )\n end",
"def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end",
"def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend",
"def item_update(item)\n @item = item\n end",
"def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend",
"def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updated(item)\n end",
"def update_order_item\n \n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def save!\n # Scrub some fields\n @data[\"installed\"].sort!\n @data[\"installed\"].uniq!\n\n # Save\n @path.open(\"w+\") do |f|\n f.write(JSON.dump(@data))\n end\n end",
"def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n load_data\n end",
"def edit_quiz(id)\r\n clear\r\n custom_banner\r\n puts\r\n # In case the file is corrupted or empty, useing rescue to handle exception and prompt user to go back to create a new custom object and save.\r\n begin quiz_array = @custom.custom_load['Custom'][id - 1]['Content']\r\n options = []\r\n if quiz_array.size > 0\r\n # Passing the custom id and selecting question item to edit_single_question method\r\n quiz_array.each do |e|\r\n options.push({ name: \"Question:#{e['Id']}\", value: lambda {\r\n edit_single_question(id, e)\r\n } })\r\n end\r\n else\r\n puts 'Sorry,the content is empty.'\r\n end\r\n rescue JSON::ParserError, NoMethodError, NoMemoryError, StandardError\r\n puts \"It seems the custom content is empty. Please move to custom menu to add a new custom collection.\\n\\n\\n\"\r\n end\r\n # Provide go back access\r\n options.push({ name: 'Back', value: lambda {\r\n clear\r\n edit_collection\r\n } })\r\n option = @prompt.select(\"Please select one question to edit or turn back to upper menu.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\\n\", show_help: :always)\r\n end",
"def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end",
"def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end",
"def update\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n if @tipo_item.update_attributes(params[:tipo_item])\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n\n respond_to do |format|\n if @file_item.update_attributes(params[:file_item])\n format.html { redirect_to (params[:redirect_to] || @file_item), :notice => 'File item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit_#{@file_item.item_type}\" }\n format.json { render :json => @file_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"Aggiornato con successo.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @orden_item.update(orden_item_params)\n \t@orden_item.orden_id = @orden_item.id_orden\n \t@orden_item.item_id = @orden_item.id_item\n \t@orden_item.item_name = @orden_item.item.item_name\n \t@orden_item.item_image = @orden_item.item.item_image\n \t@orden_item.item_type = @orden_item.item.item_type\n \t@orden_item.save\n format.html { redirect_to @orden_item, notice: 'Orden item was successfully updated.' }\n format.json { render :show, status: :ok, location: @orden_item }\n else\n format.html { render :edit }\n format.json { render json: @orden_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n @item.save_info\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end",
"def update\n if params[:file]\n file = params[:file].read\n data = JSON.parse(file)\n ActiveRecord::Base.transaction do\n @patient = Patient.find_by(case_id: data['case_id'])\n if @patient.valid?\n @patient.update_json(data)\n name = params[:file].original_filename\n path = File.join(\"Data\", \"jsons\", name)\n File.open(path, \"wb\") { |f| f.write(file) }\n end\n end\n end\n if usi_params\n usi = UsiMaterialnr.find_or_create_by(patient_id:@patient.id)\n usi.usi_id = usi_params[:usi_id]\n usi.materialnr = usi_params[:materialnr]\n usi.save\n end\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end",
"def update\n respond_to do |format|\n if @item.update(item_save_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_inv inv_file\n self.inventory_database = JSON.parse File.read(inv_file)\n end",
"def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end",
"def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @items.to_json\n end",
"def item_edit\n end",
"def update\n self.publish_json\n end",
"def update\n @itemname = Itemname.find(params[:id])\n\n respond_to do |format|\n if @itemname.update_attributes(params[:itemname])\n format.html { redirect_to @itemname, notice: 'Item actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @itemname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_task\n puts 'edit task method'\n @task = Task.find_by(id: params[:id])\n @task.update(name: params[:new_name])\n\n render :json => @task.as_json(:only => [:id, :name])\n end",
"def saveJSON\n File.open(\"./db/larves.json\", 'w') do |file|\n file.write(@url)\n end\n puts \"Ecriture effectuer avec success!\"\n end",
"def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n item = findItem\n if item.update_column(:done, \"1\")\n render json: {data:item}, status: :ok\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item.pedido, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item.pedido }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n raise NotImplementedError, \"Lists can't be edited through the API\"\n end",
"def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @item = args[:item] if args.key?(:item)\n end",
"def update!(**args)\n @item = args[:item] if args.key?(:item)\n end",
"def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end",
"def set_json_entry\n @json_entry = JsonEntry.find(params[:id])\n end",
"def edit\n \n end",
"def update\n @item_cardapio = ItemCardapio.find(params[:id])\n\n respond_to do |format|\n if @item_cardapio.update_attributes(params[:item_cardapio])\n format.html { redirect_to @item_cardapio, :notice => 'Item cardapio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item_cardapio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'O item foi actualizado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { head :ok }\n else\n error_respond(format, \"edit\");\n end\n end\n end",
"def update\n if @item.update(item_params)\n render json: ItemSerializer.new(@item)\n else\n render json: @menu.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.6637274",
"0.6297716",
"0.628253",
"0.6248859",
"0.6248859",
"0.61671454",
"0.61314636",
"0.61131",
"0.6110778",
"0.60771143",
"0.6028917",
"0.6001276",
"0.59909153",
"0.59732217",
"0.5968674",
"0.59677356",
"0.5940953",
"0.5914207",
"0.5912161",
"0.59079623",
"0.5871321",
"0.5866101",
"0.5854946",
"0.58312696",
"0.58140415",
"0.57850975",
"0.5783863",
"0.5734208",
"0.5724789",
"0.5719926",
"0.5718944",
"0.5717907",
"0.5713955",
"0.5705239",
"0.5702593",
"0.57023036",
"0.568638",
"0.5676915",
"0.5660707",
"0.565733",
"0.5657081",
"0.5655685",
"0.565203",
"0.5643894",
"0.56312335",
"0.56220394",
"0.5617205",
"0.5616628",
"0.56095195",
"0.5608983",
"0.5605792",
"0.5602146",
"0.55983514",
"0.5593403",
"0.55924195",
"0.5592328",
"0.5586949",
"0.55803376",
"0.5575317",
"0.55690897",
"0.5562013",
"0.5559388",
"0.5558138",
"0.5556735",
"0.5553695",
"0.5551671",
"0.55511",
"0.55511",
"0.55455244",
"0.55452186",
"0.55452186",
"0.5539468",
"0.55360454",
"0.5534654",
"0.5521325",
"0.5519082",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.5514241",
"0.55140865",
"0.5513302",
"0.55085087"
] |
0.6591906
|
1
|
delete item in the json file and save
|
def delete(class_name, id)
@data = get_all()
for item in @data[class_name]
if item["id"] == id
@data[class_name].delete(item)
end
end
save()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_category(name)\n data_array = JSON.parse(File.read(File_path))\n category_item = find_category(name)\n data_array.delete(category_item)\n File.open(File_path, 'w') { |f| f.write(data_array.to_json) }\nend",
"def remove_user_from_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash.delete @username\n File.open \"user_information/user_data.json\",\"w\" do |f|\n f.puts JSON.pretty_generate hash\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 remove_file(id)\n\n # Get file name\n file_name = \"#{Repository.data_dir}#{id}.json\"\n\n\t\t# Check if file exists\n\t\tif File.exists?(file_name)\n\t\t\t# if so delete\n\t\t\tFile.delete(file_name)\n\t\telse\n\t\t\tDebug.add(\"[WARNING] #{id}.json not found\")\n\t\tend\n end",
"def del\n File.delete(@file)\n end",
"def delete_from_file\n updated_data = []\n Login.load_data.each { |user| updated_data << user unless user['id'] == Login.user.uid.to_s }\n File.open(Login.userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n puts 'Your account has been deleted. The program will now exit.'.colorize(:light_red)\n @prompt.keypress('Press any key to continue..')\n exit\n end",
"def remove(item)\r\n @contents.delete(item)\r\n end",
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend",
"def remove\n rows = self.open_import_file\n field = rows.first\n rows.each do |row|\n item_identifier = row['item_identifier'].to_s.strip\n if item = Item.where(:item_identifier => item_identifier).first\n item.destroy\n end\n end\n end",
"def delete_file\n @file = []\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def destroy\n file&.delete\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def delete \n @data = {} \n end",
"def delete(key)\n @data.delete(key).tap {\n save if autosave?\n }\n end",
"def delete_item(item)\n @get_items.delete(item)\n end",
"def clean\n FileUtils.rm(\"#{build_name}.json\")\n end",
"def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end",
"def delete\n ::File.unlink(@path)\n end",
"def destroy(item)\n raise StandardError unless @mode == :update\n @attached.delete(item)\n @remove_file.puts(XML.generate({ :id => item.is_a?(String) ? item : item.id }, false))\n end",
"def save!\n delete_file\n save\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def delete_item(grocery,item_name)\n # input: list, item name.\n # steps: delete item_name from the hash\n grocery.delete(item_name)\n # output: display the latest list\n display_list(grocery)\nend",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def book_deleting\n book_seaching\n puts \"Nhap index record muon xoa (xoa nhieu record bang cach dung dau cach giua cac index)\"\n delete_index = gets.chomp.to_s\n delete_index.split(' ').each {\n |value|\n $books_array.delete_at ($search_result_array[value.to_i - 1].to_i)\n }\n File.open(\"Books.json\", \"w+\") do |f|\n f.puts($books_array.to_json)\n end\n puts \"Lua chon da duoc xoa thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend",
"def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def delete(item)\n !!@data.delete(item)\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n @file_item.destroy\n\n respond_to do |format|\n format.html { redirect_to file_items_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n path = self.class.path(path).to_s\n zip.fopen(path).delete\n entries.delete(path)\n end",
"def delete(filename); end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def delete_item(item)\n @chores.delete(item)\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }\n end",
"def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end",
"def delete_arrays(num)\n\t\t#delete selection from array\n\t\t@@json_titles.delete_at num\n\t\t@@json_urls.delete_at num\n\t\t\n\t\t#write to json file\n\t\tFile.open(\"favorites.json\", \"w\") do |f|\n\t\t\tf.write(@@topObject.to_json)\n\t\tend\n\t\t#f.close\n\tend",
"def delete_arrays(num)\n\t\t#delete selection from array\n\t\t@@json_titles.delete_at num\n\t\t@@json_urls.delete_at num\n\t\t\n\t\t#write to json file\n\t\tFile.open(\"favorites.json\", \"w\") do |f|\n\t\t\tf.write(@@topObject.to_json)\n\t\tend\n\t\t#f.close\n\tend",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n item = findItem\n if item.update_column(:trash, \"1\")\n render json: {data:item}, status: :ok\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def remove_item\n\n end",
"def delete_item(item)\r\n @list.delete(item)\r\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n @cell_automaton.destroy\n file_path = Rails.root.join(\"public\", \"cell_automatons\", \"#{current_user.id}\")\n file_name = file_path.to_s + \"/\" + @cell_automaton.id.to_s\n File.delete(\"#{file_name}.rb\")\n \n redirect_to cell_automatons_url, notice: 'Cell automaton was successfully destroyed.'\n end",
"def clear\n if ::File.exists?(@file) \n @log.info(\"Deleted id list file.\")\n ::File.delete(@file)\n end\n end",
"def deleteRepositoryObject(path)\n begin\n File.delete(path+\".obj\")\n rescue DefaultException => e\n puts \"Failed to delete repository object : #{path}\"\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end",
"def remove_item\n\tsaved = current_user.saved\n\titem = saved.items.find(params[:item])\n saved.items.delete(item)\n redirect_to :back\n\tend",
"def destroy\n @file = Asset.find_by(uid: params[:id])\n unless @file.editable_by?(@context)\n type = :warning\n text = \"You have no permission to deleted this Asset \\\"#{@file.prefix}\\\"\"\n path = api_assets_path\n\n render json: { path: path, message: { type: type, text: text } }, adapter: :json\n return\n end\n\n UserFile.transaction do\n @file.reload\n\n if @file.license.present? && !@file.apps.empty?\n type = :error\n text = \"This asset contains a license, and has been included in one or more apps. \" \\\n \"Deleting it would render the license inaccessible to these apps, \" \\\n \"breaking reproducibility. You can either first remove the license \" \\\n \"(allowing these existing apps to run without requiring a license) \" \\\n \"or contact the precisionFDA team to discuss other options.\"\n path = api_asset_path(@file)\n\n render json: { path: path, message: { type: type, text: text } }, adapter: :json\n return\n end\n @file.destroy\n end\n\n DNAnexusAPI.new(@context.token).call(@file.project, \"removeObjects\", objects: [@file.dxid])\n\n type = :success\n text = \"Asset \\\"#{@file.prefix}\\\" has been successfully deleted\"\n path = api_assets_path\n\n render json: { path: path, message: { type: type, text: text } }, adapter: :json\n end",
"def destroy\n @item_datum = ItemData.find(params[:id])\n @item_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to item_datum_url }\n format.json { head :ok }\n end\n end",
"def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def delete_item(list_name,name)\n if storage.list_exists?(list_name)\n list = List.find(list_name)\n if list.delete_item(name)\n output \"#{cyan(\"Boom!\")} #{yellow(name)} is gone forever.\"\n save\n else\n output \"#{yellow(name)} #{red(\"not found in\")} #{yellow(list_name)}\"\n end\n else\n output \"We couldn't find that list.\"\n end\n end",
"def delete(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.delete\n end",
"def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end",
"def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end",
"def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def delete\n storage.delete(id)\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 delete\n File.delete(header_file_full_path)\n File.delete(data_file_full_path)\n end",
"def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end",
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def destroy\n\t\t@item.destroy\n\t\thead :no_content\n\tend",
"def delete\n path = @p.path\n File::unlink path\n end",
"def deleteItem\n\t\tif @public_id\n\t\t\tCloudinary::Uploader.destroy(@public_id)\n\t\tend\n\tend",
"def del\n delete\n end",
"def delete \n \t @data = {} \n \tend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end",
"def destroy\n @item.destroy!\n end",
"def delete_cache(url, json: true)\n filename = cache_filename(url, json)\n if File.exist?(filename)\n logger.debug(\"Deleting cache #{filename}\")\n File.delete(filename)\n end\n end",
"def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end",
"def delete_item(hash, item)\n\thash.delete(item)\n\treturn hash \nend",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def delete\n @delete_mixin.json_dict = @json_dict\n @delete_mixin._deleted = @_deleted\n @delete_mixin.delete\n @json_dict = @delete_mixin.json_dict\n @_deleted = @delete_mixin._deleted\n end",
"def rm(*path)\n super; on_success{ nil }\n end",
"def destroy\n @item.destroy\n render json: ItemSerializer.new(@item)\n end",
"def delete(x)\n @contents.delete x\n end",
"def rm path\n end",
"def delete(id)\n record = find(id)\n return unless record\n\n delete_from_file(@file, record)\n @records = read_file(@file)\n end",
"def delete_current_presentation(file_id, user)\n delete_url = \"https://www.googleapis.com/drive/v2/files/#{file_id}\"\n headers = { 'Authorization': \"Bearer #{user.google_access_token}\", 'Content-type': 'application/json' }\n rest_resource = RestClient::Resource.new(delete_url, :headers => headers)\n rest_resource.delete\n end",
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def remove_file_from_bundle\n bundle = object.study_file_bundle\n if bundle.present?\n bundle.original_file_list.delete_if {|file| file['file_type'] == object.file_type} # this edits the list in place, but is not saved\n object.update(study_file_bundle_id: nil)\n bundle.save\n end\n end",
"def save\n File.open(path, 'w+') do |f|\n f.write(to_json)\n end\n\n true\n end",
"def rm(path)\n file = scope.get(path)\n return if !file\n file.remove!\n end",
"def destroy\n @etx_file = EtxFile.find(params[:id])\n \n arr = @etx_file.ques_no.split(\",\")\n Question.destroy(arr)\n @etx_file.update_attributes(status: true)\n #@etx_file.destroy\n\n respond_to do |format|\n format.html { redirect_to etx_files_url }\n format.json { head :ok }\n end\n end",
"def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end",
"def delete_from_disk; end"
] |
[
"0.710266",
"0.69492525",
"0.6783052",
"0.67735845",
"0.67085266",
"0.66362226",
"0.65042526",
"0.6467084",
"0.64320314",
"0.636976",
"0.62376195",
"0.6206556",
"0.61719835",
"0.61638486",
"0.6157596",
"0.61488765",
"0.6143981",
"0.6142705",
"0.6125897",
"0.6103811",
"0.6093937",
"0.60739857",
"0.6064258",
"0.6059658",
"0.604012",
"0.6037041",
"0.60369265",
"0.6029731",
"0.60254353",
"0.60234946",
"0.6012513",
"0.6003054",
"0.6002953",
"0.5993902",
"0.5993902",
"0.5990354",
"0.5944562",
"0.5944562",
"0.5940873",
"0.59358937",
"0.5934079",
"0.5928086",
"0.5925404",
"0.5923846",
"0.59188515",
"0.59059674",
"0.5888509",
"0.5883843",
"0.58804613",
"0.58788097",
"0.5874988",
"0.58712834",
"0.5868184",
"0.58646524",
"0.58630484",
"0.5862962",
"0.58605725",
"0.586053",
"0.58566463",
"0.58558035",
"0.5854408",
"0.5854408",
"0.585373",
"0.58527935",
"0.58489716",
"0.58489716",
"0.5848472",
"0.5840969",
"0.58388865",
"0.58388865",
"0.5836823",
"0.58260804",
"0.5824324",
"0.5824194",
"0.5801988",
"0.5801382",
"0.5799705",
"0.5795605",
"0.5793243",
"0.57914025",
"0.5785176",
"0.5782068",
"0.57794213",
"0.5778039",
"0.5777168",
"0.577696",
"0.5776137",
"0.5770822",
"0.57629675",
"0.5758377",
"0.5757822",
"0.57545644",
"0.5747533",
"0.5742327",
"0.5741822",
"0.5739811",
"0.573825",
"0.57327837",
"0.573108",
"0.5727725",
"0.57270724"
] |
0.0
|
-1
|
get item from json file and return it
|
def get_by_id(class_name, id)
@data = get_all()
for item in @data[class_name]
if item["id"] == id
return item
end
end
raise "#{class_name} id #{id} not found."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end",
"def extract_datas_from_json(path)\n file = File.read(path)\n data_details = JSON.parse(file)\n return data_details\nend",
"def read_from_json\n JSON.parse File.new(@filepath).read\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end",
"def openJsonFile(filepath)\n $file = File.open filepath\n $jsonObjectMain = JSON.load $file\n return $jsonObjectMain\nend",
"def read_json_file(path)\n JSON.parse(File.open(path){ |f| f.read })\nend",
"def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend",
"def read_json\n file = File.read('townhall.json')\n jason = JSON.parse(file)\n return jason\nend",
"def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end",
"def read\n file = File.read(@filename)\n JSON.parse(file)\n end",
"def get_data_from_json_file(filename)\n file_to_parse = File.read(filename)\n data_hash = JSON.parse(file_to_parse)\n return data_hash\nend",
"def get_items_from_file()\n if(File.exists?(@filename) && !File.empty?(@filename))\n file = File.read(@filename)\n JSON.parse(file).each do |item|\n movie = Movie.new\n item.each { |key, value| movie.send(\"#{key}=\", value)}\n @items.push(movie)\n end\n end\n end",
"def load_json(filename); end",
"def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend",
"def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend",
"def get_json\n recipe_json = File.read('./recipes.json')\n @json_recipes = JSON.parse(recipe_json)\n end",
"def getjson(filename)\n #checks if file exists and goes to failed page if it doesn't\n if File.file?(\"/home/vagrant/register-stub/data/\"+filename)\n json = File.read(\"/home/vagrant/register-stub/data/\"+filename)\n obj = JSON.parse(json.force_encoding(\"iso-8859-1\"))\n return obj.to_json\n else\n redirect \"../failed\"\n end\nend",
"def item_by_file(filename)\n item = self.item.select do |it|\n it.path.match(/.*(?:\\\\|\\/|^)(.+)$/)[1] == filename\n end\n item.first if item\n end",
"def read_json\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def get_json(name)\n r = {}\n open_file(name) do |f|\n r = JSON.parse(f.read)\n yield r if block_given?\n end\n r\n end",
"def get(item)\n @items[item]\n end",
"def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend",
"def parse_json_file(json_file)\n json = File.read(json_file)\n obj = JSON.parse(json)\n return obj\n end",
"def read_json_test\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend",
"def read_json_file(filepath)\n file = File.open(filepath)\n file_data = file.read\n return JSON.parse(file_data)\nend",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend",
"def read_JSON_file # called a helper method (is helping you to use less code and dealing with something so that your other methods don't have to)\n @json_data = File.read('./lib/contacts.json')\n @contacts = JSON.parse(@json_data, {:symbolize_names => true})\n end",
"def json_string(filename)\n File.read json_file(filename)\n end",
"def get_item_from_body(body)\n get_item_from_result(body.fetch('Item', {}))\n end",
"def parsed_json_fixture(path)\n JSON.parse json_fixture(path)\nend",
"def read_json j_file\n data = nil\n open(j_file) do |f|\n data = f.read\n end\n j = JSON.parse(data)\n\n return j\nend",
"def get_favorite(key, json)\n data =JSON.parse(json)\n return data['favorites'][key]\nend",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\nend",
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def get_favorite(key, json)\n hash = JSON.parse(json)\n return hash[\"favorites\"][key]\n\nend",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def findItem\n item = Item.find(params[:id])\n if item\n return item\n else\n return render json: {data: \"Failure, could not find this item.\"}, status: :not_found\n end\n end",
"def get_favorite(key, json)\n return JSON.parse(json)[\"favorites\"][key]\nend",
"def read_tasks\n JSON.parse(File.read(\"tasks.json\"))\nend",
"def get_databag_item(databag, item)\n unless inside_testkitchen?\n unless chef_server.data_bags.any? { |k| k.name == databag }\n raise format('Databag \"%s\" not found on Chef Infra Server', databag)\n end\n\n chef_server.data_bag_item.fetch(item, bag: databag).data\n else\n filename = File.join(data_bags_path, databag, item + \".json\")\n\n begin\n return JSON.load(File.read(filename))\n rescue\n raise format(\"Error accessing databag file %s, check TestKitchen configuration\", filename)\n end\n end\n end",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\n end",
"def read_jason(file_path)\r\n json_file = File.read(file_path)\r\n data_hash = JSON.parse(json_file)\r\n return data_hash\r\nend",
"def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end",
"def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end",
"def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend",
"def new_from_json_file(path)\n json = ::File.read(path)\n new_from_json_string(json)\n end",
"def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def json(*files, **options, &block) = read(*files, parse: :json, ext: '.json', **options, &block)",
"def read\n raise Errors::FileMissing, @pathname unless @pathname.exist?\n\n JSON.parse(\n @pathname.read,\n symbolize_names: true\n )\n rescue JSON::ParserError => e\n raise Errors::ParserError, e\n end",
"def load_json( filename, debug = false)\n\traise RuntimeError, \"Missing filename\" if not filename\n\n\tif( File.exists?( filename ) or File.symlink?( filename ) )\t\t\n\t\treturn JSON.load( File.open( filename ) )\n\telse\n\t\traise RuntimeError, \"Could not find \"+filename+\"\\n\"\n\tend\n\nend",
"def load_json(filename)\n File.open(File.expand_path(\"../support/#{filename}\", __FILE__), \"r\") do |json_file|\n JSON.load(json_file)\n end\nend",
"def get_item(index)\n @get_items[index]\n end",
"def json_from(json_file)\n JSON.parse(File.read(json_file), symbolize_names: true)\nend",
"def get_data_discussion(json_file)\n\tfile = Rails.root.join('public', json_file);\n\tdata_discussions = JSON.parse(IO.read(file))\nend",
"def load_json_doc( filename )\n\n begin\n File.open( filename, 'r') do |file|\n json_str = file.read( )\n doc = JSON.parse json_str\n return doc\n end\n\n rescue => ex\n puts \"ERROR: loading #{filename} (#{ex})\"\n return nil\n end\n\n end",
"def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end",
"def process_file(filename)\n structure = nil\n begin\n structure = JSON.parse( IO.read(filename, encoding:'utf-8') )\n rescue\n print \"Error loading/parsing File: #{$!}\"\n return nil\n end\n begin\n if( structure[\"restaurants\"].count > 0 )\n structure[\"restaurants\"].each do |r_data|\n if( r_data[\"name\"] && r_data[\"rating\"] && r_data[\"meals_qty\"] )\n restaurant = Restaurant.new(r_data[\"name\"],r_data[\"rating\"],r_data[\"meals_qty\"])\n if( r_data[\"specials\"] )\n specials = r_data[\"specials\"]\n specials.each do |special|\n special.keys.each do |key|\n restaurant.addMeal(Meal.new( key, special[key] ))\n end\n end\n end\n addRestaurant(restaurant)\n else\n print \"Restaurant #{r_data} doesn't have minimum data\"\n return\n end\n end\n if( structure[\"order\"] )\n if( structure[\"order\"][\"quantity\"] )\n order_meal = OrderMeal.new(structure[\"order\"][\"quantity\"])\n specials = structure[\"order\"][\"specials\"]\n if( specials )\n specials.each do |special|\n special.keys.each do |key|\n order_meal.addMeal(Meal.new( key, special[key]))\n end\n end\n end\n return finder(order_meal)\n else\n print \"No quantity defined for order.\"\n end\n end\n else\n print \"No restaurantsi defined\";\n return\n end\n rescue\n print \"Error trying to load structure on #{$!}\"\n end\n return\n end",
"def read_file(filename)\n JSON.parse(File.read(\"spec/fixtures/files/#{filename}\"))\n end",
"def get\n File.read(path)\n end",
"def get_fixture(name)\n #JSON.parse(File.read(File.expand_path(\"../fixtures/#{name}\", __FILE__)))\n File.read(File.expand_path(\"../fixtures/#{name}\", __FILE__))\nend",
"def readJson(dataFilePath)\n dataFile = File.new(dataFilePath, \"r\");\n data = JSON.load(dataFile);\n dataFile.close();\n data;\nend",
"def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end",
"def item(id)\n Item.find(id)\n end",
"def item\n $data_items[1]\n end",
"def load_json(filename)\n begin\n File.open(filename, \"r\" ) do |f|\n JSON.load(f)\n end\n rescue Errno::ENOENT, TypeError => e\n puts \"You must supply a valid filename: #{e.message}\"\n exit\n end\nend",
"def read_list_index()\n list_index = 0\n file = File.open(\"jira-epic-progress.json\",\"r\")\n list_index =JSON.parse(file.read)['index']\n return list_index\nend",
"def issue_from_id(id)\n json_file('partystances').detect { |i| i['id'] == id } \n end",
"def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend",
"def fetch(key)\n return nil unless (val = get(key.to_s))\n\n JSON.parse(val, symbolize_names: true)\n rescue JSON::ParserError\n nil\n end",
"def load_data_from_file(default=json_default)\n KiJSONFile.load_json(path, default)\n end",
"def parse_json(json_file)\r\n\t\t\tjfile = File.read(json_file)\r\n\t\t\treturn JSON.parse(jfile)\r\n\t\tend",
"def payload_for(filename)\n JSON.parse(get_json(filename), symbolize_names: true)\n end",
"def get_json(url, options = {})\n\t\t\tresponse = get_file(url, options)\n\t\t\traw_json = response.scan(/\\w+\\((.+)\\);\\z/)[0][0]\n\t\t\treturn JSON.parse(raw_json)\n\t\tend",
"def get_item(course_id, item_id)\r\n relative_url = PATH_COURSES_ITEMS_ % [course_id, item_id]\r\n get(relative_url)\r\n end",
"def load_bitbucket()\n JSON.parse(IO.read('db-1.0.json'))\nend",
"def read_json\n if project.source_exists?\n JSON.parse(File.read(project.project_path))\n else\n []\n end\n end",
"def getJsonValue(key)\n return $jsonObjectMain[key]\nend",
"def read_search_term_file(file_name)\n file = File.open \"jobs/twitter_resources/#{file_name}.json\"\n data = JSON.load file\n file.close\n return data[\"search_terms\"]\nend",
"def get_item(id, options = {})\n\t\t\tif (id.is_a?(Hash))\n\t\t\t\toptions = id\n\t\t\telse\n\t\t\t\toptions.merge!(:item_id => id)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\toptions.delete(:realm)\n\t\t\t\n\t\t\tinfo = get_xml(@@item_info_url, options)\n\t\t\ttooltip = get_xml(@@item_tooltip_url, options)\n\t\t\t\n\t\t\tif (info%'itemInfo'%'item') && !tooltip.nil?\n\t\t\t\treturn Wowr::Classes::FullItem.new(info%'itemInfo'%'item', tooltip%'itemTooltip', self)\n\t\t\telse\n\t\t\t\traise Wowr::Exceptions::ItemNotFound.new(options[:item_id])\n\t\t\tend\n\t\tend",
"def get_item(id, options = {})\n\t\t\tif (id.is_a?(Hash))\n\t\t\t\toptions = id\n\t\t\telse\n\t\t\t\toptions.merge!(:item_id => id)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\toptions.delete(:realm)\n\t\t\t\n\t\t\tinfo = get_xml(@@item_info_url, options)\n\t\t\ttooltip = get_xml(@@item_tooltip_url, options)\n\t\t\t\n\t\t\tif (info%'itemInfo'%'item') && !tooltip.nil?\n\t\t\t\treturn Wowr::Classes::FullItem.new(info%'itemInfo'%'item', tooltip%'itemTooltip', self)\n\t\t\telse\n\t\t\t\traise Wowr::Exceptions::ItemNotFound.new(options[:item_id])\n\t\t\tend\n\t\tend",
"def get_json_result(json, index)\n return json[\"items\"][index][\"pagemap\"][\"cse_image\"][0][\"src\"]\nend",
"def fetch_id\n return unless @name\n\n begin\n response = Inventory.request[\"assets/#{@name}\"].get :content_type => :json, :accept => :json \n asset = JSON.parse(response)\n asset['id']\n rescue RestClient::ResourceNotFound\n nil\n rescue => exception\n puts exception.message\n puts exception.response\n exit 1\n end\n end",
"def item_from_filename(filename)\n identifier = Nanoc::Identifier.from(expand_volume_path(filename))\n @items[identifier] || raise(\"Unable to resolve item for file '#{filename}'\")\n end",
"def parse_cards_json\n filepath = File.join(Rails.root, 'db', 'json', 'AllSets.enUS.json')\n file_contents = File.open(filepath).read\n JSON.parse(file_contents)\nend",
"def get_item(key)\n self[key]\n end",
"def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end",
"def item\n fetch('sword_art_online.item')\n end",
"def get(item)\n if values = @items[item]\n values[:value]\n end\n end",
"def parse(json_file)\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n cars_array = nil\r\n rentals_array = nil\r\n begin\r\n # Check file\r\n check_json_file_path(json_file)\r\n json_data = JSON.parse(File.read(json_file))\r\n # Binding json data to obj\r\n cars_array = json_data_cars_to_array json_data\r\n rentals_array = json_data_rentals_to_array json_data\r\n rescue JSON::ParserError => j\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n raise JsonLoaderTechnicalException.new(\"JsonLoader - parse : Structural problem in json file.\\nJSON::ParserError => #{j.message}\")\r\n rescue JsonLoaderTechnicalException => t\r\n raise t\r\n rescue JsonLoaderFonctionalException => f\r\n raise f\r\n end\r\n return cars_array, rentals_array\r\n end",
"def from_json(filename)\n require \"json\" unless defined?(JSON)\n from_hash(JSON.parse(IO.read(filename)))\n end",
"def read(path)\n @file_data = ::JSON.parse(open(path).read)\n @json = @file_data\n self\n end",
"def read_unicorns\n JSON.parse(File.read(\"unicorns.json\"))\nend",
"def get\n file\n end",
"def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end"
] |
[
"0.6940929",
"0.6846219",
"0.68115294",
"0.6722442",
"0.6720814",
"0.6720814",
"0.67011225",
"0.65319675",
"0.6495636",
"0.6461876",
"0.6451821",
"0.64309067",
"0.6414099",
"0.6324142",
"0.63058877",
"0.626974",
"0.62653255",
"0.62653255",
"0.62273043",
"0.61910844",
"0.61874753",
"0.6185958",
"0.6184987",
"0.6180456",
"0.6165094",
"0.61595356",
"0.6132929",
"0.61057717",
"0.6099133",
"0.60780084",
"0.60748994",
"0.6074332",
"0.60668844",
"0.60604715",
"0.6059473",
"0.60465205",
"0.60333914",
"0.6022038",
"0.60209",
"0.59989333",
"0.59911156",
"0.5975207",
"0.59699774",
"0.5955998",
"0.5952531",
"0.59491605",
"0.5940179",
"0.5932262",
"0.59281325",
"0.59068155",
"0.58613366",
"0.5840492",
"0.583595",
"0.58194804",
"0.5817003",
"0.5798584",
"0.5788126",
"0.5782594",
"0.5781201",
"0.57758844",
"0.57709545",
"0.5764694",
"0.57637465",
"0.5757708",
"0.5746901",
"0.57456785",
"0.5738405",
"0.5737624",
"0.5736115",
"0.57351226",
"0.5731097",
"0.5723697",
"0.57121205",
"0.57092214",
"0.5707755",
"0.5691223",
"0.5671317",
"0.56592363",
"0.5650281",
"0.5649782",
"0.56363744",
"0.56262255",
"0.56247497",
"0.5621948",
"0.5618774",
"0.5616345",
"0.5616345",
"0.5616186",
"0.5613447",
"0.5606463",
"0.5593725",
"0.5589414",
"0.55883664",
"0.55850697",
"0.55793625",
"0.5575209",
"0.557017",
"0.55620855",
"0.5559602",
"0.5556533",
"0.5556234"
] |
0.0
|
-1
|
get from json file class data
|
def get_data(class_name)
return JSON.parse(File.read(@database_file))[class_name]
# error handling
rescue Errno::ENOENT
File.open(@database_file, 'w+')
File.write(@database_file, [])
retry
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def load_json(filename); end",
"def extract_datas_from_json(path)\n file = File.read(path)\n data_details = JSON.parse(file)\n return data_details\nend",
"def parse_klass_json(json_file_path)\n json_string = IO.read(json_file_path)\n klass_data = ActiveSupport::JSON.decode(json_string)\n season= klass_data['season']\n year = klass_data['year']\n formatted_semester = Klass.semester_code_from_s(\"#{season} #{year}\")\n klass_data['departments'].each do |dept_abbr, klasses_for_dept|\n import_department(dept_abbr, klasses_for_dept, formatted_semester)\n end\nend",
"def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end",
"def read\n file = File.read(@filename)\n JSON.parse(file)\n end",
"def read_classes\n\n data = File.read(PLAYER_CLASSES)\n JSON.parse(data).map do |player_class|\n Character.new(\n player_class['name'],\n player_class['short_description'],\n player_class['stats']\n )\n end\n\nend",
"def parse_file(filename)\n klass = class_name(filename)\n read_file(filename) do |data|\n data = JSON.parse(data, :object_class => Types::Base, :max_nesting => 100)\n store_schema(data) do\n if data.resources # discovery format\n parse_resource(data)\n else\n data_types[klass] = {}\n data_types[klass] = parse_object(data)\n end\n end\n end\n klass\n end",
"def read_JSON_file # called a helper method (is helping you to use less code and dealing with something so that your other methods don't have to)\n @json_data = File.read('./lib/contacts.json')\n @contacts = JSON.parse(@json_data, {:symbolize_names => true})\n end",
"def read_jason(file_path)\r\n json_file = File.read(file_path)\r\n data_hash = JSON.parse(json_file)\r\n return data_hash\r\nend",
"def from_json\n JSON.parse(self)\n end",
"def get_data_from_json_file(filename)\n file_to_parse = File.read(filename)\n data_hash = JSON.parse(file_to_parse)\n return data_hash\nend",
"def initialize json_file\n @json_file = JSON.parse(File.read(json_file))\n @date = @json_file[\"date\"]\n @base = @json_file[\"base\"]\n @rates = @json_file[\"rates\"]\n @rate_keys = @json_file[\"rates\"].keys\n @rate_values = @json_file[\"rates\"].values\n end",
"def read_from_json\n JSON.parse File.new(@filepath).read\n end",
"def get_json\n recipe_json = File.read('./recipes.json')\n @json_recipes = JSON.parse(recipe_json)\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\n end",
"def initialize\n @json_file = JSON.parse(HTTParty.get('http://data.fixer.io/api/latest?access_key=8673ff340f8c9309e05687dc6d5454f9').body)\n end",
"def parse_json_file(json_file)\n json = File.read(json_file)\n obj = JSON.parse(json)\n return obj\n end",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\nend",
"def json_from(json_file)\n JSON.parse(File.read(json_file), symbolize_names: true)\nend",
"def instance\n @instance ||= if File.exists?(path) && File.readable?(path)\n new(JSON.parse(File.read(path)))\n else\n new\n end\n end",
"def get_data_discussion(json_file)\n\tfile = Rails.root.join('public', json_file);\n\tdata_discussions = JSON.parse(IO.read(file))\nend",
"def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend",
"def data\n @data ||= JSON.parse(self['raw']) \n end",
"def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend",
"def parse(json_file)\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n cars_array = nil\r\n rentals_array = nil\r\n begin\r\n # Check file\r\n check_json_file_path(json_file)\r\n json_data = JSON.parse(File.read(json_file))\r\n # Binding json data to obj\r\n cars_array = json_data_cars_to_array json_data\r\n rentals_array = json_data_rentals_to_array json_data\r\n rescue JSON::ParserError => j\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n raise JsonLoaderTechnicalException.new(\"JsonLoader - parse : Structural problem in json file.\\nJSON::ParserError => #{j.message}\")\r\n rescue JsonLoaderTechnicalException => t\r\n raise t\r\n rescue JsonLoaderFonctionalException => f\r\n raise f\r\n end\r\n return cars_array, rentals_array\r\n end",
"def parsed_json_fixture(path)\n JSON.parse json_fixture(path)\nend",
"def instance\n @instance ||= if file\n from_json file\n else\n new\n end\n end",
"def load(json)\n require 'json'\n from_json(JSON.parse(json))\n end",
"def json_struct(filename)\n JSON.parse json_string(filename)\n end",
"def read_json\n file = File.read('townhall.json')\n jason = JSON.parse(file)\n return jason\nend",
"def initialize(file_name)\n @file = File.read(file_name)\n @json_hash = JSON.parse(@file)\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def read_file_level_data\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_data\n end",
"def inspect\n \"#<JsonObj file: \\\"#{file_path}\\\">\"\n end",
"def inspect\n \"#<JsonObj file: \\\"#{file_path}\\\">\"\n end",
"def convert_to_property\n json = JSON.load_file(@file_path, symbolize_names: true)\n properties = []\n json.each {|prop| \n new_property = Property.new(prop[:type], prop[:weekly_rent], prop[:landlord], prop[:tenant], prop[:address], prop[:status])\n properties.push(new_property)\n }\n return properties\n end",
"def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end",
"def read(path)\n @file_data = ::JSON.parse(open(path).read)\n @json = @file_data\n self\n end",
"def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend",
"def json\n @obj.get_json_regex\n end",
"def json_to_ruby\n json = File.read('./database/townhalls.json')\n obj = JSON.parse(json)\n return obj\n end",
"def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend",
"def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_AUTH\n Megam::Auth\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_NODE\n Megam::Node\n when MEGAM_APPDEFNS\n Megam::Appdefns\n when MEGAM_APPREQUEST\n Megam::AppRequest\n when MEGAM_BOLTREQUEST\n Megam::BoltRequest\n when MEGAM_BOLTDEFNS\n Megam::Boltdefns\n when MEGAM_NODECOLLECTION\n Megam::NodeCollection\n when MEGAM_APPDEFNSCOLLECTION\n Megam::AppdefnsCollection\n when MEGAM_APPREQUESTCOLLECTION\n Megam::AppRequestCollection\n when MEGAM_BOLTREQUESTCOLLECTION\n Megam::BoltRequestCollection\n when MEGAM_BOLTDEFNSCOLLECTION\n Megam::BoltdefnsCollection\n when MEGAM_REQUEST\n Megam::Request\n when MEGAM_REQUESTCOLLECTION\n Megam::RequestCollection\n when MEGAM_PREDEF\n Megam::Predef\n when MEGAM_PREDEFCOLLECTION\n Megam::PredefCollection\n when MEGAM_PREDEFCLOUD\n Megam::PredefCloud\n when MEGAM_PREDEFCLOUDCOLLECTION\n Megam::PredefCloudCollection\n when MEGAM_CLOUDTOOL\n Megam::CloudTool\n when MEGAM_CLOUDTOOLCOLLECTION\n Megam::CloudToolCollection\n when MEGAM_CLOUDTOOLSETTING\n Megam::CloudToolSetting\n when MEGAM_CLOUDTOOLSETTINGCOLLECTION\n Megam::CloudToolSettingCollection\n when MEGAM_CLOUDTEMPLATE\n Megam::CloudTemplate\n when MEGAM_CLOUDTEMPLATECOLLECTION\n Megam::CloudTemplateCollection\n when MEGAM_CLOUDINSTRUCTION\n Megam::CloudInstruction\n when MEGAM_CLOUDINSTRUCTIONGROUP\n Megam::CloudInstructionGroup\n when MEGAM_CLOUDINSTRUCTIONCOLLECTION\n Megam::CloudInstructionCollection\n when MEGAM_SSHKEY\n Megam::SshKey\n when MEGAM_SSHKEYCOLLECTION\n Megam::SshKeyCollection\n when MEGAM_MARKETPLACE\n Megam::MarketPlace\n when MEGAM_MARKETPLACECOLLECTION\n Megam::MarketPlaceCollection\n when MEGAM_MARKETPLACEADDON\n Megam::MarketPlaceAddons\n when MEGAM_MARKETPLACEADDONCOLLECTION\n Megam::MarketPlaceAddonsCollection\n<<<<<<< HEAD\n when MEGAM_ORGANIZATION\n Megam::Organizations\n=======\n when MEGAM_CSAR\n Megam::CSAR\n when MEGAM_CSARCOLLECTION\n Megam::CSARCollection\n>>>>>>> origin/0.5\n else\n raise JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end",
"def deserialize(json)\n raise NotImplementedError\n end",
"def load_file(filename)\n file = File.open(filename, \"r\")\n grid = JSON.parse(file.read)\n file.close\n return Game.new(grid.length, grid[0].length, grid)\nend",
"def new_from_json_file(path)\n json = ::File.read(path)\n new_from_json_string(json)\n end",
"def load_raw_json(json_data)\n temp = Hashie::Mash.new(MultiJson.load(json_data))\n @structure = temp.structure ? temp.structure : Hashie::Mash.new\n @measure_instances = temp.measure_instances ? temp.measure_instances : Hashie::Mash.new\n # these could be set in the file\n @analysis_id = temp.structure.analysis_id if temp.structure.analysis_id\n @user_defined_id = temp.structure.user_defined_id if temp.structure.user_defined_id\n\n return true\n end",
"def get(key,classname='Entity')\n value = nil\n begin\n value = @store.get(key)\n rescue Exception => e\n GameMachine.logger.error(e.message+\"\\n\"+e.backtrace.join(\"\\n\"))\n return nil\n end\n\n return nil if value.nil?\n klass = class_cache(classname)\n\n if serialization == 'json'\n klass.parse_from_json(value)\n else\n klass.parse_from(value)\n end\n end",
"def get_json_search_object(json_data, file_name)\n values_string = VALUES_SEPARATOR\n\n parse_nested_values(json_data.values).uniq.each do |value|\n next if !value || value.empty?\n\n values_string += \"#{value}#{VALUES_SEPARATOR}\"\n end\n\n JsonSearch.new(search_values: values_string, json_data: json_data, json_data_type: file_name)\n end",
"def load name\n @name = name\n data = Oj.load File.read(name)\n old_data = as_json\n \n ATTRIBUTES.each do |attr|\n unless data.has_key? attr\n data = old_data\n puts \"data #{name} cannot be loaded, #{attr} not found in JSON...\"\n break\n end\n end\n \n @pixels = data['pixels']\n @width = data['width']\n @height = data['height']\n end",
"def json\n @hash ||= ::JSON.parse(data)\n end",
"def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end",
"def load_attributes\n @attributes = MultiJson.decode(File.new(file, 'r').read)\n end",
"def read_tasks\n JSON.parse(File.read(\"tasks.json\"))\nend",
"def from_json(filename)\n require \"json\" unless defined?(JSON)\n from_hash(JSON.parse(IO.read(filename)))\n end",
"def load_data_from_file(default=json_default)\n KiJSONFile.load_json(path, default)\n end",
"def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n rows = []\n CSV.foreach(filename, headers: true, col_sep: ',') do |row|\n rows << row.to_hash\n end\n result = rows\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n result = JSON.parse( result.to_json ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"def readJson(dataFilePath)\n dataFile = File.new(dataFilePath, \"r\");\n data = JSON.load(dataFile);\n dataFile.close();\n data;\nend",
"def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end",
"def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end",
"def data file\n json = self.json file\n width, height = self.dims file\n [json, width, height]\n end",
"def from_json(json)\n deserialize JSON.parse(json)\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def load_attributes\n puts \"Loading project information from #{project_file}\"\n @attributes = MultiJson.decode(File.new(project_file, 'r').read)\n end",
"def read_json\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_ACCOUNTCOLLECTION\n Megam::AccountCollection\n when MEGAM_ASSEMBLIES\n Megam::Assemblies\n when MEGAM_ASSEMBLIESCOLLECTION\n Megam::AssembliesCollection\n when MEGAM_ASSEMBLY\n Megam::Assembly\n when MEGAM_ASSEMBLYCOLLECTION\n Megam::AssemblyCollection\n when MEGAM_COMPONENTS\n Megam::Components\n when MEGAM_COMPONENTSCOLLECTION\n Megam::ComponentsCollection\n when MEGAM_REQUEST\n Megam::Request\n when MEGAM_REQUESTCOLLECTION\n Megam::RequestCollection\n when MEGAM_SSHKEY\n Megam::SshKey\n when MEGAM_SSHKEYCOLLECTION\n Megam::SshKeyCollection\n when MEGAM_EVENTSVM\n Megam::EventsVm\n when MEGAM_EVENTSVMCOLLECTION\n Megam::EventsVmCollection\n when MEGAM_EVENTSMARKETPLACE\n Megam::EventsMarketplace\n when MEGAM_EventsMarketplaceCollection\n Megam::EventsMarketplaceCollection\n when MEGAM_LICENSE\n Megam::License\n when MEGAM_LICENSECOLLECTION\n Megam::LicenseCollection\n when MEGAM_FLAVORS\n Megam::Flavors\n when MEGAM_FLAVORSCOLLECTION\n Megam::FlavorsCollection\n when MEGAM_EVENTSALL\n Megam::EventsAll\n when MEGAM_EVENTSALLCOLLECTION\n Megam::EventsAllCollection\n when MEGAM_EVENTSCONTAINER\n Megam::EventsContainer\n when MEGAM_EVENTSCONTAINERCOLLECTION\n Megam::EventsContainerCollection\n when MEGAM_EVENTSBILLING\n Megam::EventsBilling\n when MEGAM_EVENTSBILLINGCOLLECTION\n Megam::EventsBillingCollection\n when MEGAM_EVENTSSTORAGE\n Megam::EventsStorage\n when MEGAM_EVENTSSTORAGECOLLECTION\n Megam::EventsStorageCollection\n when MEGAM_MARKETPLACE\n Megam::MarketPlace\n when MEGAM_MARKETPLACECOLLECTION\n Megam::MarketPlaceCollection\n when MEGAM_ORGANIZATION\n Megam::Organizations\n when MEGAM_ORGANIZATIONSCOLLECTION\n Megam::OrganizationsCollection\n when MEGAM_DOMAIN\n Megam::Domains\n when MEGAM_DOMAINCOLLECTION\n Megam::DomainsCollection\n when MEGAM_SENSORS\n Megam::Sensors\n when MEGAM_SENSORSCOLLECTION\n Megam::SensorsCollection\n when MEGAM_SNAPSHOTS\n Megam::Snapshots\n when MEGAM_SNAPSHOTSCOLLECTION\n Megam::SnapshotsCollection\n when MEGAM_BACKUPS\n Megam::Backups\n when MEGAM_BACKUPSCOLLECTION\n Megam::BackupsCollection\n when MEGAM_BALANCES\n Megam::Balances\n when MEGAM_BALANCESCOLLECTION\n Megam::BalancesCollection\n when MEGAM_CREDITS\n Megam::Credits\n when MEGAM_CREDITSCOLLECTION\n Megam::CreditsCollection\n when MEGAM_BILLEDHISTORIES\n Megam::Billedhistories\n when MEGAM_BILLEDHISTORIESCOLLECTION\n Megam::BilledhistoriesCollection\n when MEGAM_BILLINGTRANSACTIONS\n Megam::Billingtransactions\n when MEGAM_BILLINGTRANSACTIONSCOLLECTION\n Megam::BillingtransactionsCollection\n when MEGAM_SUBSCRIPTIONS\n Megam::Subscriptions\n when MEGAM_SUBSCRIPTIONSCOLLECTION\n Megam::SubscriptionsCollection\n when MEGAM_DISKS\n Megam::Disks\n when MEGAM_DISKSCOLLECTION\n Megam::DisksCollection\n when MEGAM_ADDONS\n Megam::Addons\n when MEGAM_ADDONSCOLLECTION\n Megam::AddonsCollection\n when MEGAM_REPORTS\n Megam::Reports\n when MEGAM_REPORTSCOLLECTION\n Megam::ReportsCollection\n when MEGAM_QUOTAS\n Megam::Quotas\n when MEGAM_QUOTASCOLLECTION\n Megam::QuotasCollection\n when MEGAM_RAWIMAGES\n Megam::Rawimages\n when MEGAM_RAWIMAGESCOLLECTION\n Megam::RawimagesCollection\n when MEGAM_PROMOS\n Megam::Promos\n else\n fail JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end",
"def load(file)\n data = File.read(file)\n JSONL.parse(data)\n end",
"def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end",
"def rehydrate_model_from(filename)\n log(\"Reading saved #{method2str} model from #{filename}.\")\n File.open(filename, \"r\") do |file|\n @model = JSON.parse(file.read)\n end \n end",
"def load_feed\n \n @url_data_params ||= {}\n response = FellowshipOne::api_request(:get, @url_data_path, @url_data_params)\n data = JSON.parse(response.body)\n @headers = response.headers\n @cacher.save_data(@class_key, data) unless @cacher.nil?\n\n return data\n end",
"def initialize(data)\n self.class.get(data)\n end",
"def data\n @data ||= MultiJson.load(File.read(index_path))\n end",
"def deserialize(data, method = :from_json)\n super\n end",
"def from_json(json:, klass:)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass)\n end",
"def read_json_file(path)\n JSON.parse(File.open(path){ |f| f.read })\nend",
"def payload_for(filename)\n JSON.parse(get_json(filename), symbolize_names: true)\n end",
"def openJsonFile(filepath)\n $file = File.open filepath\n $jsonObjectMain = JSON.load $file\n return $jsonObjectMain\nend",
"def read_json_test\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def get_structure()\n JSON.parse(IO.read(\"./json/#{@jsf}.json\"))[\"id\"]\n end",
"def initialize(file)\n @spec = ::JSON.parse(File.read(file).force_encoding('utf-8'))\n end",
"def find_instance_from_json(json, instance_class)\n key = instance_class.table_name.singularize\n details = json[key]&.slice(*REQUIRED_ATTRIBUTES[instance_class])\n obj = nil\n if details\n obj = instance_class.new(details)\n obj = instance_class.find(obj.id) if obj.id\n end\n obj\n end",
"def load_instance_from(parsed_json, chef_class)\n if Gem::Version.new(Chef::VERSION) < Gem::Version.new('12.0.0')\n chef_class.json_create(parsed_json)\n else\n chef_class.from_hash(parsed_json)\n end\n end",
"def load(json_path_or_hash)\n if(json_path_or_hash.is_a?(String))\n require 'multi_json'\n content = AttributeStruct.hashish.new(MultiJson.load(File.read(json)))\n else\n content = json_path_or_hash\n end\n content.each do |type, hash|\n register(type, hash)\n end\n true\n end",
"def parse_json(json_file)\r\n\t\t\tjfile = File.read(json_file)\r\n\t\t\treturn JSON.parse(jfile)\r\n\t\tend",
"def load_json(filename)\n File.open(File.expand_path(\"../support/#{filename}\", __FILE__), \"r\") do |json_file|\n JSON.load(json_file)\n end\nend",
"def read_cache\n @all_yoga_classes = JSON.parse(File.read(@cache_file))\n # convert date strings to time objects\n @all_yoga_classes.each do |k,v|\n @all_yoga_classes[k]['start_date'] = Time.at(v['start_date'])\n @all_yoga_classes[k]['end_date'] = Time.at(v['end_date'])\n end\n end",
"def extract_mock_data\n raw_json_data = File.read(File.join(Dir.pwd, 'tests', 'example.json'))\n processed_json_data = JSON.parse(raw_json_data).to_s\nend",
"def read_input_file\n\t\tbegin \n\t\t\tfile = File.read('data.json')\n\t\t\tjson_info = JSON.parse(file)\n\t\t\t\n\t\t\t#getting cars and rentals information\n\t\t\t@cars = json_info[\"cars\"]\n\t\t\t@rentals = json_info[\"rentals\"]\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to read the input file!\" \n\t\t\tputs e.message\n\t\tend\n\tend",
"def build_from_json_file(json_file)\n @technologies = JSON.parse(IO.read(json_file))\n end",
"def build_from_json_file(json_file)\n @technologies = JSON.parse(IO.read(json_file))\n end",
"def json(*files, **options, &block) = read(*files, parse: :json, ext: '.json', **options, &block)",
"def read_json_file(filepath)\n file = File.open(filepath)\n file_data = file.read\n return JSON.parse(file_data)\nend"
] |
[
"0.66772264",
"0.6600513",
"0.6600513",
"0.6553418",
"0.6527646",
"0.64734405",
"0.6402046",
"0.63097805",
"0.62799823",
"0.6276879",
"0.6248767",
"0.62441224",
"0.6220357",
"0.62017393",
"0.6178706",
"0.61314386",
"0.6080928",
"0.6075665",
"0.60620433",
"0.60620433",
"0.60608363",
"0.6046765",
"0.6031994",
"0.60311025",
"0.6007108",
"0.5961605",
"0.59445417",
"0.5942852",
"0.5925101",
"0.59180856",
"0.59132004",
"0.5896097",
"0.58886856",
"0.58756155",
"0.58654344",
"0.58541065",
"0.58357775",
"0.5829938",
"0.58237344",
"0.5821355",
"0.5820814",
"0.57981366",
"0.57981366",
"0.5774998",
"0.57717127",
"0.57584345",
"0.5752355",
"0.5737533",
"0.5723878",
"0.57201093",
"0.57174516",
"0.5717351",
"0.5714901",
"0.5711792",
"0.5707164",
"0.5698689",
"0.569132",
"0.5673199",
"0.56702214",
"0.5662659",
"0.56537604",
"0.56420016",
"0.5636124",
"0.5627342",
"0.5627261",
"0.5622147",
"0.5619977",
"0.5615488",
"0.56105727",
"0.5597862",
"0.5597419",
"0.55911624",
"0.5590182",
"0.5589892",
"0.5586671",
"0.5574764",
"0.5572227",
"0.5569223",
"0.5566297",
"0.5565467",
"0.5553936",
"0.55488396",
"0.554628",
"0.5545348",
"0.5541114",
"0.55359477",
"0.5535811",
"0.55258214",
"0.5524549",
"0.5517779",
"0.5488223",
"0.54874456",
"0.54854864",
"0.54784507",
"0.547198",
"0.5470912",
"0.54701304",
"0.54701304",
"0.5467837",
"0.54453593"
] |
0.67145586
|
0
|
get from json file all data
|
def get_all()
return JSON.parse(File.read(@database_file))
# error handling
rescue Errno::ENOENT
File.open(@database_file, 'w+')
File.write(@database_file, [])
retry
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def extract_datas_from_json(path)\n file = File.read(path)\n data_details = JSON.parse(file)\n return data_details\nend",
"def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end",
"def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend",
"def load_json(filename); end",
"def json(*files, **options, &block) = read(*files, parse: :json, ext: '.json', **options, &block)",
"def read\n file = File.read(@filename)\n JSON.parse(file)\n end",
"def get_data_from_json_file(filename)\n file_to_parse = File.read(filename)\n data_hash = JSON.parse(file_to_parse)\n return data_hash\nend",
"def get_data_discussion(json_file)\n\tfile = Rails.root.join('public', json_file);\n\tdata_discussions = JSON.parse(IO.read(file))\nend",
"def read_file_level_data\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_data\n end",
"def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end",
"def get_json\n recipe_json = File.read('./recipes.json')\n @json_recipes = JSON.parse(recipe_json)\n end",
"def read_JSON_file # called a helper method (is helping you to use less code and dealing with something so that your other methods don't have to)\n @json_data = File.read('./lib/contacts.json')\n @contacts = JSON.parse(@json_data, {:symbolize_names => true})\n end",
"def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend",
"def read_from_json\n JSON.parse File.new(@filepath).read\n end",
"def data\n @data ||= MultiJson.load(File.read(index_path))\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def load_data_from_file(default=json_default)\n KiJSONFile.load_json(path, default)\n end",
"def parse(json_file)\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n cars_array = nil\r\n rentals_array = nil\r\n begin\r\n # Check file\r\n check_json_file_path(json_file)\r\n json_data = JSON.parse(File.read(json_file))\r\n # Binding json data to obj\r\n cars_array = json_data_cars_to_array json_data\r\n rentals_array = json_data_rentals_to_array json_data\r\n rescue JSON::ParserError => j\r\n CoreLogger.instance.logger.info(\"JsonTools - parse\") { \"Parsing du fichier '#{json_file}'\" }\r\n raise JsonLoaderTechnicalException.new(\"JsonLoader - parse : Structural problem in json file.\\nJSON::ParserError => #{j.message}\")\r\n rescue JsonLoaderTechnicalException => t\r\n raise t\r\n rescue JsonLoaderFonctionalException => f\r\n raise f\r\n end\r\n return cars_array, rentals_array\r\n end",
"def read_jason(file_path)\r\n json_file = File.read(file_path)\r\n data_hash = JSON.parse(json_file)\r\n return data_hash\r\nend",
"def get_json(serverID,default_language=\"en\")\n data = JSON.load(get_file(default_language))\n file = get(serverID)\n data.deep_merge!(JSON.load(file)) if file\n return data\n end",
"def readJson(dataFilePath)\n dataFile = File.new(dataFilePath, \"r\");\n data = JSON.load(dataFile);\n dataFile.close();\n data;\nend",
"def read_json\n file = File.read('townhall.json')\n jason = JSON.parse(file)\n return jason\nend",
"def get_json(name)\n r = {}\n open_file(name) do |f|\n r = JSON.parse(f.read)\n yield r if block_given?\n end\n r\n end",
"def browse_json\r\n file = File.read('./db/townhalls.json')\r\n datas = JSON.parse(file)\r\n\r\n # elle fait une boucle dnas le fichier json pour sortir deux eléments, les mails et les names\r\n (0...datas.length).each do |i|\r\n send_mails(datas[i]['mail'], datas[i]['name'])\r\n puts datas[i]['name']\r\n puts datas[i]['mail']\r\n end\r\n end",
"def content\n fields = self.get_fields\n fields.empty? ? self.data.merge(self.file_data).to_json : fields.to_json\n end",
"def data file\n json = self.json file\n width, height = self.dims file\n [json, width, height]\n end",
"def evolution_data\n## reads evolution json (1-120 digimons) and parses\nevo_file = File.read(\"#{__dir__}/../dh-data/json/tree-0002-0120.json\")\nevo_data = JSON.parse(evo_file)\nend",
"def read_input_file\n\t\tbegin \n\t\t\tfile = File.read('data.json')\n\t\t\tjson_info = JSON.parse(file)\n\t\t\t\n\t\t\t#getting cars and rentals information\n\t\t\t@cars = json_info[\"cars\"]\n\t\t\t@rentals = json_info[\"rentals\"]\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to read the input file!\" \n\t\t\tputs e.message\n\t\tend\n\tend",
"def all_movies\n # in case the file is empty or missing, return an empty collection\n JSON.parse(File.read('data.json')) rescue []\nend",
"def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend",
"def read_json_file(path)\n JSON.parse(File.open(path){ |f| f.read })\nend",
"def populate\n file = File.read(json_file)\n storage = JSON.parse(file, :symbolize_names => true)\n\n @hashes = storage[:hashes]\n convert if @hashes.is_a? Array\n\n @hashes\n end",
"def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend",
"def query_filedata(uid)\n json = {}\n id = uid.to_i\n dir = id%100\n dir = \"#{fs_root}/#{dir.to_s}/#{id}_lastread\"\n FileUtils.makedirs(dir)\n fname = \"#{dir}/jsondata\" \n #p \"query_filedata:filename #{fname}\"\n\n begin\n if FileTest::exists?(fname) \n data= nil \n open(fname, \"r\") {|f|\n data = f.read\n # f.seek(0)\n # f.write(\"\") \n # f.truncate(0)\n }\n # p \"data=#{data.inspect}\"\n json = JSON.parse(data) if data\n end\n rescue Exception=>e\n # logger.error e\n p e.inspect\n pe(e)\n \n end\n\n return json\n\n end",
"def read(path)\n @file_data = ::JSON.parse(open(path).read)\n @json = @file_data\n self\n end",
"def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end",
"def load_data(file_path)\n json_data = JSON.parse(File.read(file_path))\n @processed_favs = json_data.map do |fav|\n fav.transform_keys(&:to_sym) \n end\n\n i = 0\n while i < @processed_favs.length\n\n items = @processed_favs[i][:name]\n @fav_list << items\n\n i += 1\n end\n rescue Errno::ENOENT\n File.open(file_path, 'w+')\n File.write(file_path, [])\n retry\n end",
"def add_json(file)\n new_json = parse_json_file(file)\n store_all_cities(new_json)\n store_all_routes(new_json)\n end",
"def json_files\n file_list '**/*.json'\n end",
"def get_data(class_name)\n return JSON.parse(File.read(@database_file))[class_name]\n \n # error handling\n rescue Errno::ENOENT\n File.open(@database_file, 'w+')\n File.write(@database_file, [])\n retry\n end",
"def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end",
"def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\n end",
"def read_json\n if project.source_exists?\n JSON.parse(File.read(project.project_path))\n else\n []\n end\n end",
"def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend",
"def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend",
"def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end",
"def initialize json_file\n @json_file = JSON.parse(File.read(json_file))\n @date = @json_file[\"date\"]\n @base = @json_file[\"base\"]\n @rates = @json_file[\"rates\"]\n @rate_keys = @json_file[\"rates\"].keys\n @rate_values = @json_file[\"rates\"].values\n end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def get_items_from_file()\n if(File.exists?(@filename) && !File.empty?(@filename))\n file = File.read(@filename)\n JSON.parse(file).each do |item|\n movie = Movie.new\n item.each { |key, value| movie.send(\"#{key}=\", value)}\n @items.push(movie)\n end\n end\n end",
"def read_unicorns\n JSON.parse(File.read(\"unicorns.json\"))\nend",
"def read_json\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def read_json_file(filepath)\n file = File.open(filepath)\n file_data = file.read\n return JSON.parse(file_data)\nend",
"def json_load(file_path)\n MultiJson.load(File.read(file_path)).to_smash\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def read_json j_file\n data = nil\n open(j_file) do |f|\n data = f.read\n end\n j = JSON.parse(data)\n\n return j\nend",
"def scanJsonFile(_jsonFile)\n open(_jsonFile,\"r\"){|strm|\n scanJsonString(strm.read()) ;\n }\n end",
"def parse_json(filename)\n\tfile = File.read(filename)\n\tbegin\n \t\tdata_hash = JSON.parse(file)\n\trescue JSON::ParserError\n\t\tfile = nil\n\tend\n\tdata_hash\n end",
"def read_tasks\n JSON.parse(File.read(\"tasks.json\"))\nend",
"def index\n file = File.read \"db/extract.json\"\n data = JSON.parse(file)\n @places = PLACES\n end",
"def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\nend",
"def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n return links\nend",
"def readWhitelist filename=\"whitelist.json\"\n\tlist = Array.new\n\tjson = JSON.parse File.read(filename)\n\t#p json\n\tjson.each{ |user| list << user[\"name\"] }\n\treturn list\nend",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend",
"def read_json_test\n recipes_json = File.read('JSON/recipes.json')\n recipe_hash = JSON.parse(recipes_json)\n return recipe_hash\nend",
"def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n \n return links\nend",
"def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end",
"def test_get_mneme_json_data_todolms\n file_name = \"studenta\"\n file_name = IO.read(\"#{@@testFileDir}/todolms/mneme/#{file_name}.json\")\n refute_nil file_name, \"find test file\"\n jsonA = JSON.parse(file_name)\n refute_nil jsonA, \"check that file contents are understood as json\"\n end",
"def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end",
"def filename\n files = Hash.new\n filenames = Dir.glob('/home/vagrant/register-stub/data/*.json')\n filenames.foreach(\".\") do |file|\n puts file\n files[file].add file\n end\n return files.to_json\nend",
"def get_data(path)\n begin\n res = RestClient.get(path, headers=@header)\n rescue RestClient::BadRequest\n return {\"error\" => \"Unknown user\"}\n end\n\n return {\"error\" => \"Unknown error\"} if !res or res.code != 200\n\n JSON.load res.body\n end",
"def getjson(filename)\n #checks if file exists and goes to failed page if it doesn't\n if File.file?(\"/home/vagrant/register-stub/data/\"+filename)\n json = File.read(\"/home/vagrant/register-stub/data/\"+filename)\n obj = JSON.parse(json.force_encoding(\"iso-8859-1\"))\n return obj.to_json\n else\n redirect \"../failed\"\n end\nend",
"def load_databag_json(filename)\n File.open(File.expand_path(\"../../data_bags/rubycas/#{filename}\", __FILE__), \"r\") { |f| MultiJson.load(f) }\nend",
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def fetch_json\n res = open(\"http://www.cleanairmakemore.com/widget_json.cfm\").read\n\n # Documented in views/burn/phx/data.json.\n s = res.index(\"facts\")\n json = res[0, s-4] + \"}\"\n\n # json = File.read(\"views/burn/phx/data.json\")\n json\n end",
"def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n rows = []\n CSV.foreach(filename, headers: true, col_sep: ',') do |row|\n rows << row.to_hash\n end\n result = rows\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n result = JSON.parse( result.to_json ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"def process_file(filename)\n structure = nil\n begin\n structure = JSON.parse( IO.read(filename, encoding:'utf-8') )\n rescue\n print \"Error loading/parsing File: #{$!}\"\n return nil\n end\n begin\n if( structure[\"restaurants\"].count > 0 )\n structure[\"restaurants\"].each do |r_data|\n if( r_data[\"name\"] && r_data[\"rating\"] && r_data[\"meals_qty\"] )\n restaurant = Restaurant.new(r_data[\"name\"],r_data[\"rating\"],r_data[\"meals_qty\"])\n if( r_data[\"specials\"] )\n specials = r_data[\"specials\"]\n specials.each do |special|\n special.keys.each do |key|\n restaurant.addMeal(Meal.new( key, special[key] ))\n end\n end\n end\n addRestaurant(restaurant)\n else\n print \"Restaurant #{r_data} doesn't have minimum data\"\n return\n end\n end\n if( structure[\"order\"] )\n if( structure[\"order\"][\"quantity\"] )\n order_meal = OrderMeal.new(structure[\"order\"][\"quantity\"])\n specials = structure[\"order\"][\"specials\"]\n if( specials )\n specials.each do |special|\n special.keys.each do |key|\n order_meal.addMeal(Meal.new( key, special[key]))\n end\n end\n end\n return finder(order_meal)\n else\n print \"No quantity defined for order.\"\n end\n end\n else\n print \"No restaurantsi defined\";\n return\n end\n rescue\n print \"Error trying to load structure on #{$!}\"\n end\n return\n end",
"def load_query_response\n load_file('sample_query_response.json')\nend",
"def load_penalties\n JSON.parse(File.read(@filename))\n end",
"def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend",
"def json_from(json_file)\n JSON.parse(File.read(json_file), symbolize_names: true)\nend",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def readTable(path)\n return JSON.parse(File.read(path).rstrip)\nend",
"def read_locations_from file\n data_hash = []\n File.readlines(file).each do |line|\n data_hash << JSON.parse(line)\n end\n self.location_hash = data_hash\n self\n end",
"def parse_json(json_file)\r\n\t\t\tjfile = File.read(json_file)\r\n\t\t\treturn JSON.parse(jfile)\r\n\t\tend",
"def parse_json_file(json_file)\n json = File.read(json_file)\n obj = JSON.parse(json)\n return obj\n end",
"def get_all_data\n Hash[*File.read(\"#{@path}scripts/data\").split(/[, \\n]+/)]\n end",
"def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end",
"def load_json(dir_path, filename)\n file_path = File.join(dir_path, filename)\n JSON.parse(File.read(file_path))\n end",
"def load(file)\n data = File.read(file)\n JSONL.parse(data)\n end",
"def openJsonFile(filepath)\n $file = File.open filepath\n $jsonObjectMain = JSON.load $file\n return $jsonObjectMain\nend",
"def read_data_from_file\n file = File.read(\"condensed_capitals.json\")\n @countries_capitals_as_hash = JSON.parse(file)\n end",
"def load\n data = JSON.parse(File.read(@path))\n\n if data[\"version\"] != VERSION\n raise \"GCR cassette version #{data[\"version\"]} not supported\"\n end\n\n @reqs = data[\"reqs\"].map do |req, resp|\n [GCR::Request.from_hash(req), GCR::Response.from_hash(resp)]\n end\n end",
"def load_data\n data = {}.with_indifferent_access\n\n %w[.json .yaml].each do |ext|\n Dir.glob(\"#{DATA_DIR}/*#{ext}\") do |fname|\n key = File.basename(fname, ext).to_sym\n puts \"Loading data[:#{key}] from #{fname}...\"\n data[key] =\n if ext == '.json'\n JSON.parse(File.read(fname))\n else\n Psych.parse(fname)\n end\n end\n end\n\n data\n end",
"def json_string(filename)\n File.read json_file(filename)\n end",
"def test_get_ctools_json_data_todolms\n file_name = \"ctools01\"\n file_name = IO.read(\"#{@@testFileDir}/todolms/ctools/#{file_name}.json\")\n refute_nil file_name, \"find test file\"\n jsonA = JSON.parse(file_name)\n refute_nil jsonA, \"check that file contents are understood as json\"\n end",
"def new_from_json_file(path)\n json = ::File.read(path)\n new_from_json_string(json)\n end"
] |
[
"0.7711639",
"0.7429094",
"0.7429094",
"0.7421307",
"0.7212593",
"0.7078496",
"0.70626694",
"0.6901446",
"0.6874973",
"0.68389195",
"0.6815595",
"0.67915535",
"0.6782154",
"0.6752352",
"0.67179996",
"0.67160785",
"0.66762614",
"0.6659185",
"0.66371727",
"0.6634206",
"0.66214156",
"0.6577114",
"0.6564795",
"0.65396625",
"0.64917",
"0.64873725",
"0.6464526",
"0.6458142",
"0.64175546",
"0.6390393",
"0.6382182",
"0.6381071",
"0.63464725",
"0.6344017",
"0.632518",
"0.6324265",
"0.6305397",
"0.6301726",
"0.62617886",
"0.62494576",
"0.6244601",
"0.62072825",
"0.6191504",
"0.6190188",
"0.6165899",
"0.6142711",
"0.6123482",
"0.61205465",
"0.61205465",
"0.6118484",
"0.61112696",
"0.61105335",
"0.6108116",
"0.61040556",
"0.60989285",
"0.6091818",
"0.6089429",
"0.6085807",
"0.6083504",
"0.60821563",
"0.60766435",
"0.60536927",
"0.60532427",
"0.603752",
"0.6034578",
"0.60331386",
"0.6009431",
"0.60066885",
"0.6003369",
"0.59998053",
"0.59897524",
"0.59812343",
"0.5980807",
"0.5972501",
"0.59678847",
"0.5952617",
"0.59517765",
"0.59470886",
"0.59445226",
"0.59241915",
"0.5919018",
"0.5918051",
"0.5904653",
"0.59030306",
"0.59006023",
"0.5900235",
"0.5896085",
"0.58818185",
"0.58816963",
"0.5875327",
"0.58744276",
"0.58729565",
"0.58661306",
"0.58647436",
"0.58531016",
"0.5851375",
"0.5849584",
"0.5849099",
"0.58471966",
"0.5844213"
] |
0.63527805
|
32
|
get pets client from json using client id and returning it
|
def get_pet_list_by_client_id(client_id)
pet_list = []
for pet in get_data("pets")
if client_id == pet["client_id"]
pet_list.push(pet)
end
end
return pet_list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_client_by_id client_id\n @clients[client_id]\n end",
"def client\n query[\"client_id\"]\n end",
"def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def clientid\n @obj['clientid']\n end",
"def get_client(id)\n conn = @client.get do |req|\n req.url \"/api/v2/client/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end",
"def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end",
"def client_from_id(id)\n resp = get \"#{CLIENT_API_PATH}/#{id}\"\n result = process_response(resp)\n Resources::Client.new(result)\n rescue Errors::NotFound\n nil\n end",
"def client(name)\n client_to_find = name\n @clients.find {|key, value| key == client_to_find } \n end",
"def index\n @client = Client.find params[:client_id]\n @pets = @client.pets\n end",
"def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end",
"def random_cocktail\n\trand_cocktail_url = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\").read\n\trand_cocktail_json = JSON.parse(rand_cocktail_url)\n\trand_cocktail_json[\"drinks\"][0]\nend",
"def get_client_meta(client_id)\n path = type_info(:client, :path)\n json_get(@target, \"#{path}/#{Addressable::URI.encode(client_id)}/meta\", @key_style, headers)\n end",
"def get_bike(bikeID, userID)\n user = User.find_by(id: userID)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/gear/'+bikeID, {Authorization: 'Bearer ' + user.access_token})\n bike = JSON.parse(response)\n end",
"def client(name)\n @clients[name]\n end",
"def fetch_client\n # check if client not present?\n r = ClientApiDetail.get_client_data(@api_key)\n @client = r[:client]\n @client_api_detail = r[:client_api_detail]\n end",
"def show\n @client = clients.find(params[:id])\n end",
"def show\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n end",
"def info &block\n em_get( \"/clients/#{uuid}\" ) { |response| block.call( response ) }\n end",
"def getclient\n return @client\n end",
"def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def clientid\n @data['clientid'].to_i\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find_by(id: params[:id])\n end",
"def get_clients\n @clients\n end",
"def get_clients\n @clients\n end",
"def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def show(id)\n @client = Locomotive::Client.get(id)\n raise NotFound unless @client\n display @client\n end",
"def show\n render json: @client\n end",
"def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end",
"def list_all_clients(shelter)\n if shelter.clients.any?\n shelter.clients.each do |key, x|\n puts \"ID: #{key}, Name: #{x.name}, Age: #{x.age}, Gender: #{x.gender}, Kids: #{x.kids}, Pets: #{x.pets.join(', ')}\"\n end\n else\n puts \"We have no clients left! We need to rethink our strategy!\"\n end\nend",
"def show\n @client = Client.find params[:client_id]\n end",
"def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end",
"def find_by_id(client, id, params = {})\n params = default_params.merge(params)\n\n client.get(\"#{resource_name}/#{id}\", params).data[resource_name_singular]\n end",
"def fetch_id\n return unless @name\n\n begin\n response = Inventory.request[\"assets/#{@name}\"].get :content_type => :json, :accept => :json \n asset = JSON.parse(response)\n asset['id']\n rescue RestClient::ResourceNotFound\n nil\n rescue => exception\n puts exception.message\n puts exception.response\n exit 1\n end\n end",
"def show\n @client = Client.find params[:id]\n end",
"def show\n\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n\n end",
"def client(client, options = {})\n get(\"clients/#{client}\", options).pop\n end",
"def show\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n end",
"def show\n @client = Client.find(params[:id])\n end",
"def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def get_pact_consumer_name pact_url\n json = get_json(pact_url)\n json['consumer']['name']\nend",
"def clients\n @clients = Vendor.find(params[:id]).clients\n end",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def find_album_by_id(client, album_id)\n client.api(:album, :show, album_id)\nend",
"def current_client\n self.clients.where(status: true).first\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @client= @client_asset.client\n end",
"def getPokemonId \n JSON.parse(@random_pokemon.body)[\"id\"]\n end",
"def show\n # @client = Client.find(params[:client_id])\n end",
"def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend",
"def get_account_id(summoner_name)\n # Given the summoner's name, make an API request for account information.\n url = \"https://#{REGION}.api.riotgames.com/lol/summoner/v4/summoners/by-name/#{summoner_name}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n # The JSON object contains summoner account information. Return the accountId.\n summoner_account_info = JSON.parse(response_string)\n account_id = summoner_account_info[\"accountId\"]\nend",
"def client_infos uuid\n return [] if @members.is_a?(Hash)\n\n @members.map do |m|\n client = {:name => m[\"client_name\"]}\n if m[\"pubkey_id\"]\n client[:pubkey_id] = m[\"pubkey_id\"]\n end\n if uuid == m[\"client_uuid\"]\n client[:id] = m[\"client_uuid\"] \n else\n client[:id] = m[\"anonymized\"] \n end\n client\n end\n end",
"def show\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @client }\r\n end\r\n end",
"def get_client_id\n @client_id\n end",
"def tenant_get(tenant_id)\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\t#TODO -- it's working when you pass it an id in the url...figure out how to make it work when passed just the name???\n\t\tputs \"invoking tenant-get...\"\n\t\t\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def get_champion_data(patch_number)\n response_string = RestClient.get(\"http://ddragon.leagueoflegends.com/cdn/#{patch_number}/data/en_US/champion.json\")\n response_hash = JSON.parse(response_string)\n champion_data = response_hash[\"data\"]\nend",
"def find id\n DynamicModel.new perform_request api_url \"summoners/#{id}\"\n end",
"def get_client\n @client = Ethereum::Client.create(@url) if @client.nil?\n @client\n end",
"def retrieve(id)\n @client.make_request(:get, \"parcels/#{id}\", MODEL_CLASS)\n end",
"def find summoner_id\n perform_uncached_request api_url \"third-party-code/by-summoner/#{summoner_id}\"\n end",
"def get_random_pokemon(number)\n uri = URI(\"https://pokeapi.co/api/v2/pokemon/#{number}\")\n res = Net::HTTP.get_response(uri)\n JSON.parse(res.body)\nend",
"def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def show\n @player_client = PlayerClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_client }\n end\n end",
"def client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def getMerchants\n\tbegin\n\t\tresponse = RestClient.get('http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40')\n\trescue\n\t\tputs \"error retrieving response...\"\n\tend\n\n\tmerchants = JSON.parse(response)\n\treturn merchants\nend",
"def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/tags/#{id}\", options: options)).first, client: client)\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def load_poke url\n output = JSON.parse(RestClient.get(url))\n if Poke.find_by(id: output['id'])\n Poke.update(output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n else\n Poke.create(id: output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n end\n print 'p' + output['id'].to_s + ' ' if VERBOSE==1\nend",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n spread_type = @tenant.tenant_details.pluck(:spread_type).uniq.join(\",\") unless @tenant.tenant_details.nil?\n\n @spread = JSON.parse RestClient.get(\"#{$pim_core_service}/pimcore/api/FoodRecepie/SpreadName?id=\"+spread_type)\n\n \n end",
"def find encrypted_id\n DynamicModel.new perform_request api_url \"summoners/#{encrypted_id}\"\n end",
"def getContract( contract_id)\n params = Hash.new\n params['contract_id'] = contract_id\n return doCurl(\"get\",\"/contract\",params)\n end",
"def client_id\n return @client_id\n end",
"def show\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blocking_client }\n end\n end",
"def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end",
"def show\n @client = User.find(params[:id])\n end",
"def get_client\n @client\n end",
"def byuser\n @evclient = Evclient.find(:first, :conditions => [ \"userid = ?\", params[:userid]])\n #@evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end",
"def id\n @json['id']\n end",
"def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end",
"def client_id; end",
"def client\n @client\n end",
"def client\n @client\n end",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def find(vendor_id)\n @client.get(\"/#{@model}/#{vendor_id}\")\n end",
"def find_client_corporation_by_id(id)\n message = { session: @session, entity_name: 'ClientCorporation', id: id, \n attributes!: { id: { 'xsi:type' => \"xsd:int\" } } }\n soap_response = @client.call(:find, message: message)\n response = soap_response.body[:find_response][:return]\n Bullhorn::ClientCorporation.from_soap_message(response[:dto])\n end"
] |
[
"0.7090033",
"0.6448273",
"0.64082104",
"0.63319725",
"0.6240005",
"0.6225158",
"0.61930263",
"0.61827374",
"0.612321",
"0.60829383",
"0.6053361",
"0.60049856",
"0.597459",
"0.5973641",
"0.5966523",
"0.5965348",
"0.5952586",
"0.593579",
"0.59046054",
"0.589576",
"0.5886216",
"0.58680737",
"0.5864928",
"0.5862564",
"0.58344746",
"0.58344746",
"0.5833355",
"0.58330727",
"0.5808857",
"0.5807912",
"0.5807316",
"0.5805049",
"0.5800062",
"0.57982594",
"0.57974565",
"0.57728535",
"0.5762582",
"0.57544994",
"0.57435536",
"0.5742142",
"0.5735624",
"0.57340187",
"0.57340187",
"0.57340187",
"0.57340187",
"0.57235175",
"0.5661306",
"0.564171",
"0.56177515",
"0.5608445",
"0.5603644",
"0.55969614",
"0.55964386",
"0.55964386",
"0.55964386",
"0.55964386",
"0.55964386",
"0.55964386",
"0.55964386",
"0.5595996",
"0.5591098",
"0.55892354",
"0.5588866",
"0.5574209",
"0.55722827",
"0.5549154",
"0.5544692",
"0.5531456",
"0.5514499",
"0.55087256",
"0.5492863",
"0.54832953",
"0.5479463",
"0.54778534",
"0.5474613",
"0.5455043",
"0.5447725",
"0.5447725",
"0.5442634",
"0.5440971",
"0.5437558",
"0.543249",
"0.5430548",
"0.54241467",
"0.5418288",
"0.54105276",
"0.5394859",
"0.5387528",
"0.53838265",
"0.53799796",
"0.5379648",
"0.5378979",
"0.53762925",
"0.5348756",
"0.5348616",
"0.53444564",
"0.53444564",
"0.53443086",
"0.53442276",
"0.53437126"
] |
0.6550511
|
1
|
get tasks list of the jobs from json using job id and returning it
|
def get_task_list_by_job_id(job_id)
list_tasks = []
for task in get_data("tasks")
if job_id == task["job_id"]
list_tasks.push(task)
end
end
return list_tasks
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def get_tasks_in_project(project_id)\n body = get_json_data(\"https://app.asana.com/api/1.0/tasks?project=#{project_id}&assignee=me\")\n tasks = {}\n body[\"data\"].each do |element|\n tasks[element[\"id\"]] = element[\"name\"].gsub(\"'\", '').gsub(\"\\n\", '')\n end\n\n tasks\n end",
"def get_jobs_by_client_id(client_id)\n jobs = []\n for job in get_data(\"jobs\")\n if client_id == job[\"client_id\"]\n jobs.push(job)\n end\n end\n\n return jobs\n end",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def getExecutionsForAJob(job_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/job/' + job_id + '/executions')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\nend",
"def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend",
"def multiget(*jids)\n results = JSON.parse(@client.call('multiget', *jids))\n results.map do |data|\n Job.new(@client, data)\n end\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end",
"def get_job(uuid, username, password)\n jobs = get_json('jobs.json', username, password)\n job = jobs['jobs'].find { |j| j['uuid'] == uuid }\n\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n\n fail \"Could not find job with UUID=#{uuid}\" unless job\n job\nend",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def get_job(job_id)\n client = IotHubApiClient.new(@options)\n res = client.get(jobs_path(job_id), @api_version_param)\n JobResponse.new(response_json(res))\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def get_jobs_list(status = :all, page = 1, reload = false)\n Bitmovin::Job.list(status, page, reload)\n end",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def getIngest_job( job_id)\n params = Hash.new\n params['job_id'] = job_id\n return doCurl(\"get\",\"/ingest_job\",params)\n end",
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end",
"def tasks(tasklist_id = '@default')\n get gtasks_tasks_url(tasklist_id)\n end",
"def job_results(jobid)\r\n wait_on_status(jobid)\r\n puts \"Retrieving results for job [#{jobid}]\"\r\n uri = URI(\"http://api.idolondemand.com/1/job/result/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n return JSON.parse(res.body)['actions']\r\nend",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end",
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def getTask(response)\r\n\t\t\t\ttasks_json = JSON.parse response\r\n\t\t\t\ttasks_array = tasks_json[\"tasks\"]\r\n\t\t\t\treturn jsonToTask(tasks_array[0])\r\n\t\t\tend",
"def public_api_get_job_task_with_http_info(job_id, task_id, api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: JobsApi.public_api_get_job_task ...\"\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling JobsApi.public_api_get_job_task\"\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_validation && task_id.nil?\n fail ArgumentError, \"Missing the required parameter 'task_id' when calling JobsApi.public_api_get_job_task\"\n end\n # verify the required parameter 'api_key' is set\n if @api_client.config.client_side_validation && api_key.nil?\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling JobsApi.public_api_get_job_task\"\n end\n # resource path\n local_var_path = \"/api/pub/v1/jobs/{jobId}/tasks/{taskId}\".sub('{' + 'jobId' + '}', job_id.to_s).sub('{' + 'taskId' + '}', task_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\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'])\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 => 'PublicApiGetTaskResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: JobsApi#public_api_get_job_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def task id\n Task.new(self, JSON.parse(request :get, \"tasks/#{id}\"))\n end",
"def jsonToTasklist(jsonObject)\r\n\t\t\t\ttasklist = Tasklist.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\ttasklist.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\ttasklist.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn tasklist\r\n\t\t\tend",
"def jobs\n self.ListJobs.first.map { |j| map_job(j) }\n end",
"def show\n @tasks = Task.where(:job => @job)\n @paginated_tasks = @tasks.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end",
"def batched_jobs(id)\n bid = batch(id)\n regexp = /\\A\\{\\\"class\\\":\\\"#{self.name}\\\",\\\"args\\\":\\[/\n redis.lrange(bid, 0, redis.llen(bid)-1).grep(regexp).map do |string|\n payload = Resque.decode(string)\n payload['args'].unshift(id)\n Resque::Job.new(@queue, payload)\n end\n end",
"def getCurrentJobs\n getJobs('0/')\n end",
"def job_executions(id, options = {})\n r = get(\"/job/#{id}/executions\", options)['result']['executions']\n objectify r\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def tasklists\n get gtasks_tasklists_url\n end",
"def list_jobs_with_http_info(project_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QcApi.list_jobs ...\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling QcApi.list_jobs\"\n end\n # resource path\n local_var_path = \"/projects/{project_id}/jobs.json\".sub('{' + 'project_id' + '}', project_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'JobsCollection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QcApi#list_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"def get_job (job_id)\n\n @cron_jobs[job_id] || @non_cron_jobs[job_id]\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def getTasks(response)\r\n\t\t\t\ttasks_all_json = JSON.parse response\r\n\t\t\t\ttasks_all_array = tasks_all_json[\"tasks\"]\r\n\t\t\t\ttasks_class_array = Array.new\r\n\t\t\t\tfor i in 0...tasks_all_array.length\r\n\t\t\t\t\ttasks_class_array.push(jsonToTask(tasks_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn tasks_class_array\r\n\t\t\tend",
"def get( name )\n @jobs.each { |job| return job if job[:name] == name }\n nil\n end",
"def show\n @job = Job.find(params[:id])\n @tasks = @job.tasks\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def parse_jobids response\n begin\n JSON.parse(response)['Lb_Job_List']['jobIds']\n rescue => e\n @logger.warn \"Got exception parsing response: #{e.message}\"\n @logger.debug \"Backtrace:\\n#{e.backtrace.join \"\\n\"}\"\n @logger.debug \"Response:\\n#{response}\"\n []\n end\n end",
"def filter_jobs_id_by_artifacts(jobs)\n job_ids = []\n jobs.each do |job|\n if job['artifacts_file'] && job['artifacts_file']['filename']\n puts \"artifact found for job #{job['id']}\"\n job_ids << job['id']\n end\n end\n\n job_ids\nend",
"def task(task_id, tasklist_id = '@default')\n get gtasks_task_url(task_id, tasklist_id)\n end",
"def getDeadJobs\n getJobs('1/')\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def get_tasklists\n @tasklists = []\n array = @client.execute(@api.tasklists.list).data.to_hash[\"items\"]\n array.each { |h|\n @tasklists.push Tasklist[h]\n }\n end",
"def tasks\n task_list.tasks\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def fetch_job\n @job = Job.find(params.require(:id))\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def public_api_get_job_task(job_id, task_id, api_key, opts = {})\n data, _status_code, _headers = public_api_get_job_task_with_http_info(job_id, task_id, api_key, opts)\n return data\n end",
"def find_job(job_id)\n find_users.each do |user|\n user.find_jobs.each do |job|\n return job if job.id == job_id\n end\n end\n\n return nil\n end",
"def find(id)\n plan_data = with_redis { |redis| redis.get(id) }\n # If found, return the job, otherwise raise NoSuchJob\n if plan_data.nil?\n raise NoSuchJob.new \"No Such DeferredJob: #{id}\"\n else\n plan = MultiJson.decode(plan_data)\n new(id, plan.first, *plan.last)\n end\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('exporttask', 'get', 'KalturaExportTask', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"def job_items\n job_arguments(1)\n end",
"def job_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CoreApi#job_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling job_id_get\" if id.nil?\n \n # resource path\n local_var_path = \"/job/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\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']\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 => 'JobWrapper')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CoreApi#job_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def jobs\n\t\t# ...\n\tend",
"def index \n render :json => Project.find(11).tasks\n end",
"def read(id)\n rows = @pgsql.exec('SELECT log FROM job WHERE id = $1', [id])\n raise WTS::UserError, \"Job #{id} not found\" if rows.empty?\n rows[0]['log']\n end",
"def list(status = :all, page = 1, reload = false)\n var_name = :\"@#{status}_list#{ page }\"\n\n val = instance_variable_get var_name\n\n return val if val && !reload\n\n get = Net::HTTP::Get.new \"/api/jobs/#{ page }/#{ status }\", initheaders = headers\n\n response = Bitmovin.http.request get\n\n json = prepare_response_json(response.body)\n \n value_to_set = json[:jobs].map { |p| Bitmovin::Job.new(p) }\n\n instance_variable_set var_name, value_to_set\n end",
"def list_jobs project_id:, location:\n # [START transcoder_list_jobs]\n # project_id = \"YOUR-GOOGLE-CLOUD-PROJECT\" # (e.g. \"my-project\")\n # location = \"YOUR-JOB-LOCATION\" # (e.g. \"us-central1\")\n\n # Require the Transcoder client library.\n require \"google/cloud/video/transcoder\"\n\n # Create a Transcoder client.\n client = Google::Cloud::Video::Transcoder.transcoder_service\n\n # Build the resource name of the parent.\n parent = client.location_path project: project_id, location: location\n\n # Get the list of jobs.\n response = client.list_jobs parent: parent\n\n puts \"Jobs:\"\n # Print out all jobs.\n response.each do |job|\n puts job.name\n end\n # [END transcoder_list_jobs]\nend",
"def all_jobs\n\n find_jobs()\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def public_api_get_jobs(modified, api_key, opts = {})\n data, _status_code, _headers = public_api_get_jobs_with_http_info(modified, api_key, opts)\n return data\n end",
"def get_completed(projectid)\n get(\"projects/#{projectid}/todolists/completed.json\")\n end",
"def [](key)\n @jobs[key]\n end",
"def read_tasks\n JSON.parse(File.read(\"tasks.json\"))\nend",
"def where(options = {})\n _, _, root = @client.get(\"/tasks\", options)\n\n root[:items].map{ |item| Task.new(item[:data]) }\n end",
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def tasks(project_id, reload = false)\n self.cache(CostAgent::Task, project_id, reload) do\n (self.api(\"projects/#{project_id}/tasks\")/\"task\").collect do |task|\n # Find the project for this task\n project = self.project((task/\"project-id\").text.to_i)\n # Calculate rates\n billing_rate = (task/\"billing-rate\").text.to_f\n billing_period = (task/\"billing-period\").text\n hourly_rate = (billing_period == \"hour\" ? billing_rate : billing_rate / project.hours_per_day)\n daily_rate = (billing_period == \"hour\" ? billing_rate * project.hours_per_day : billing_rate)\n # Build the task out using the task data and the project it's tied to\n Task.new(\n :id => (task/\"id\").text.to_i,\n :name => (task/\"name\").text,\n :project_id => project.id,\n :project => project,\n :hourly_billing_rate => hourly_rate,\n :daily_billing_rate => daily_rate,\n :billable => (task/\"is-billable\").text == \"true\")\n end\n end\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def get_tasks_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_tasks ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_tasks\" if id.nil?\n \n # resource path\n path = \"/Projects/{id}/Tasks\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\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\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_job\n json = Server.redis { |c| c.brpop(Server.keys[:perform_list]) }\n Job.new(JSON.parse(json.last))\n rescue => e\n raise ServerError, e.message\n end",
"def retrieve_tasks_for_person(p_id)\n assignments = @db_base.query_assignments_for_person(p_id)\n results = Array.new()\n assignments.each { |result|\n results << result[\"T_Id\"]\n }\n return results\n end",
"def retrieve_job(job_id)\n raise Spear::ParametersRequired.new('JobID') if job_id.blank?\n\n Spear::Request.new(:get, Spear.uri_job_retrieve, {:query => {:DID => job_id}}).execute\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def find_jobs(import_type)\n current_user.created_projects\n .includes(:import_state)\n .where(import_type: import_type)\n .to_json(only: [:id], methods: [:import_status])\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def get_scheduled_job_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_scheduled_job ...'\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling InboxControllerApi.get_scheduled_job\"\n end\n # resource path\n local_var_path = '/inboxes/scheduled-jobs/{jobId}'.sub('{' + 'jobId' + '}', CGI.escape(job_id.to_s))\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(['*/*'])\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] || 'ScheduledJobDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\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: InboxControllerApi#get_scheduled_job\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_job job_id, location: nil\n # The get operation is considered idempotent\n execute backoff: true do\n service.get_job @project, job_id, location: location\n end\n end"
] |
[
"0.70621973",
"0.70516574",
"0.7019634",
"0.6913135",
"0.6864184",
"0.68169725",
"0.6705907",
"0.6658707",
"0.660234",
"0.65161216",
"0.6499095",
"0.6459582",
"0.6438981",
"0.64238316",
"0.640044",
"0.6377937",
"0.63242865",
"0.63006",
"0.6291554",
"0.62880915",
"0.6284512",
"0.62279004",
"0.6163691",
"0.6074881",
"0.60667074",
"0.6049768",
"0.60459304",
"0.60029596",
"0.59868467",
"0.5981788",
"0.5981788",
"0.59700024",
"0.59592766",
"0.59273475",
"0.5924577",
"0.5893792",
"0.58851665",
"0.58817714",
"0.5874378",
"0.5870739",
"0.5858063",
"0.5843474",
"0.5838324",
"0.5835671",
"0.58322716",
"0.5831847",
"0.5824844",
"0.5814392",
"0.57989025",
"0.57910925",
"0.5756994",
"0.5743663",
"0.5733599",
"0.5728376",
"0.5727198",
"0.5725024",
"0.5710798",
"0.5709963",
"0.5707501",
"0.5697209",
"0.56944895",
"0.56944895",
"0.56944895",
"0.5686865",
"0.56846887",
"0.5683446",
"0.56758773",
"0.5658111",
"0.5653684",
"0.56485146",
"0.56401163",
"0.56376344",
"0.56363577",
"0.5630318",
"0.562714",
"0.5614328",
"0.56101924",
"0.5606054",
"0.5600642",
"0.55959046",
"0.55936754",
"0.5591781",
"0.5590845",
"0.5590007",
"0.5589493",
"0.5589464",
"0.5588201",
"0.55847925",
"0.5584057",
"0.55830145",
"0.55770534",
"0.55662787",
"0.5547907",
"0.55378395",
"0.553722",
"0.5534091",
"0.55243397",
"0.55141014",
"0.55098325",
"0.549939"
] |
0.8324479
|
0
|
get jobs from json using difference of job date and local date now returning jobs for next 7 days
|
def get_jobs_last_7_days()
@data = get_all()
now = Time.now.to_date
jobs = []
for job in @data["jobs"]
parsed_date = Date.strptime(job["date"], "%d/%m/%Y")
days_difference = (parsed_date - now).to_i
if days_difference <= 7 && days_difference >= 0
jobs.push(job)
end
end
return jobs
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend",
"def jobs\n if params[:start_date] and params[:end_date]\n @jobs = Job.where(\"startdate > :s and enddate < :e and hostname = :h and jobname != :n\", :s=>params[:start_date].to_datetime,:e=>params[:end_date].to_datetime.next,:h=>\"M6650M453\",:n=>'Get Iddrive').order('jobid desc')\n else\n @jobs = latest_jobs\n end\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"def latest_jobs(project_id)\n last_20_jobs(project_id).each_with_object({}) do |job, all_latest_jobs|\n branch = job['ref']\n job_name = job['name']\n all_latest_jobs[branch] = {} if all_latest_jobs[branch].nil?\n all_latest_jobs[branch][job_name] = job if all_latest_jobs[branch][job_name].nil?\n end\nend",
"def scrape_jobs\n @scraper = FreelancerFinder::Scraper.new\n @scraper.scrape_recent_jobs.each do |job_hash|\n FreelancerFinder::Job.new(job_hash) unless FreelancerFinder::Job.all.detect {|job| job.path == job_hash[:path]} # next create a job instance from the data we just scraped unless it exists already\n end\n end",
"def edutor_jobs\n if params[:start_date] and params[:end_date]\n @jobs = Job.where(\"startdate > :s and enddate < :e and hostname = :h\", :s=>params[:start_date].to_datetime,:e=>params[:end_date].to_datetime.next,:h=>\"M6650M453\").order('jobid desc')\n else\n @jobs = edutor_latest_jobs\n end\n end",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def requests(job)\r\n {\r\n :journal_entry_query_rq => {\r\n # :max_returned => 100,\r\n # :xml_attributes => { \"requestID\" =>\"1\", 'iterator' => \"Start\" },\r\n :modified_date_range_filter => {\"from_modified_date\" => qbwc_log_init(WorkerName), \"to_modified_date\" => qbwc_log_end()},\r\n :include_line_items => true\r\n }\r\n }\r\n end",
"def parse_job(listing)\n\n # binding.pry\n\n title = listing.search('a.dice-btn-link')[0].text\n @employer_name = listing.search('li.employer .dice-btn-link')[0].text\n location = listing.search('li.location').text\n \n job_link = listing.search('a.dice-btn-link')[0].attributes[\"href\"].value.to_s\n\n relative_date = listing.search('li.posted').text\n date = parse_absolute_date(relative_date)\n \n employer_id = job_link.split('/')[-2]\n job_id = job_link.split('/')[-1]\n\n [\n date,\n title,\n @employer_name,\n location,\n job_link,\n employer_id,\n job_id\n ].map! { |text| text.gsub(/\\s+/, ' ').strip }\n end",
"def get_pull_requests(days=7)\n update_pull_requests if @pull_requests.nil?\n @pull_requests.take_while do |pr|\n pr.created_at.to_date > Date.today - days\n end\n end",
"def requests(job)\r\n {\r\n :list_deleted_query_rq => {\r\n :xml_attributes => { \"requestID\" =>\"1\"},\r\n :list_del_type => [\"Account\", \"Customer\", \"InventorySite\", \"ItemDiscount\", \"ItemFixedAsset\", \"ItemGroup\", \"ItemInventory\", \"ItemInventoryAssembly\", \"ItemNonInventory\", \"ItemOtherCharge\", \"ItemPayment\", \"ItemService\", \"ItemSubtotal\", \"Vendor\"],\r\n :deleted_date_range_filter => {\"from_deleted_date\" => qbwc_log_init(WorkerName), \"to_deleted_date\" => qbwc_log_end()}\r\n }\r\n }\r\n end",
"def parse_schedule_response(response)\n dates_of_games = []\n parsed_response = JSON.parse(response)\n games = parsed_response['fullgameschedule']['gameentry']\n\n games.each do |game|\n unless dates_of_games.include?(game['date'])\n dates_of_games << game['date']\n end\n end\n\n dates_of_games\n end",
"def client_tasks_upcoming\n today = Time.zone.now\n self.find_all {|e| (e.completed.nil? or !e.completed) and (e.complete_by >= today and e.complete_by <= (today + 6.days)) }\n end",
"def run_job(job)\r\n @log = Logger.new(File.expand_path(\"#{Rails.root}/log/scraper_job.log\", __FILE__))\r\n @log.info(\"Job started\")\r\n \r\n # initial job parameters\r\n region_list = JSON.parse(self.target_region_list)\r\n days_to_gather = self.days_to_gather\r\n size_of_a_day = 86400 # epoch time units (86400 is equal to 24 hours)\r\n size_of_a_time_slice = 10800 # epoch time units (10800 is equal to 3 hours)\r\n \r\n # start gathering from the beginning of the current day\r\n initial_start_time = Time.new(Time.now.year, Time.now.month, Time.now.day).to_i\r\n number_of_time_slices = ((days_to_gather * size_of_a_day) / size_of_a_time_slice).to_i\r\n \r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > #{self.class} started (id:#{self.id})\")\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The Epoch Start Time: #{initial_start_time}\")\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The Formatted Start Time: #{Time.at(initial_start_time).strftime(\"%c\")}\")\r\n job.save\r\n \r\n # iterate each region\r\n region_list.each {|region_name,region_lookup| \r\n #validate a region exists\r\n region = Region.find_by name: region_name\r\n if region\r\n \r\n # run the channel scraper\r\n encoded_uri = URI.encode(\"https://www.foxtel.com.au/webepg/ws/foxtel/channels?regionId=\" + region_lookup)\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The encoded URI for #{region_name} is #{encoded_uri}\")\r\n #job.save\r\n raw_channels_created = 0\r\n raw_channels_skipped = 0\r\n\r\n # access the file and the data_hash\r\n file = URI.parse(encoded_uri)\r\n get_file_count = 0\r\n begin\r\n data_hash = JSON.parse(file.read)\r\n rescue Errno::ECONNRESET => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n rescue OpenSSL::SSL::SSLError => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n end\r\n\r\n # populate an array of times from the data hash\r\n #@log.debug(\"#{data_hash.inspect}\") \r\n data_hash[\"channels\"].each {|channel_hash|\r\n #@log.debug(\"#{channel_hash.inspect}\")\r\n raw_channel = RawChannel.create_from_channel_hash(region, channel_hash)\r\n if raw_channel.new_record?\r\n raw_channels_skipped += 1\r\n else\r\n raw_channels_created += 1\r\n end\r\n }\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Raw Channels Created: #{raw_channels_created}, Skipped: #{raw_channels_skipped}, Total: #{raw_channels_skipped + raw_channels_created} for #{region_name}(#{region_lookup.to_s}).\")\r\n job.save\r\n \r\n # run the program scraper\r\n raw_programs_created = 0\r\n raw_programs_skipped = 0\r\n \r\n number_of_time_slices.times do |i|\r\n start_time = Time.at(initial_start_time + (i* size_of_a_time_slice))\r\n end_time = Time.at(start_time.to_i + size_of_a_time_slice)\r\n encoded_uri = URI.encode(\"https://www.foxtel.com.au/webepg/ws/foxtel/grid/events?startDate=\" + start_time.to_i.to_s + \"000&endDate=\" + end_time.to_i.to_s + \"000®ionId=\" + region_lookup)\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The encoded URI is #{encoded_uri}\")\r\n #job.save\r\n \r\n # access the file and the data_hash\r\n file = URI.parse(encoded_uri)\r\n get_file_count = 0\r\n begin\r\n data_hash = JSON.parse(file.read)\r\n rescue Errno::ECONNRESET => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n rescue OpenSSL::SSL::SSLError => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n end\r\n \r\n # populate an array of times from the data hash\r\n #@log.debug(\"#{data_hash.inspect}\")\r\n data_hash[\"channelEventsByTag\"].each {|channel_events|\r\n #@log.debug(\"#{program_array.inspect}\")\r\n channel_tag = channel_events[0]\r\n channel = Channel.find_by_tag(channel_tag)\r\n raw_channel = RawChannel.find_by_channel_tag_and_region_name(channel_tag,region_name)\r\n if channel.nil? and raw_channel.nil?\r\n # no channel or raw channel\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The channel record and raw_channel record for #{channel_tag} in #{region_name} does not exist!\")\r\n job.save\r\n else\r\n # channel is ok\r\n array_of_channel_events = channel_events[1]\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Processing #{array_of_channel_events.length} channel events for channel #{channel.name} for #{region_name}.\")\r\n #job.save \r\n array_of_channel_events.each { |channel_event|\r\n raw_program = RawProgram.create_from_channel_event(region, channel_tag, channel_event)\r\n if raw_program.new_record?\r\n raw_programs_skipped += 1\r\n else\r\n raw_programs_created += 1\r\n end \r\n } \r\n end\r\n }\r\n end\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Raw Programs Created #{raw_programs_created}, Skipped: #{raw_programs_skipped}, Total: #{raw_programs_created + raw_programs_skipped} for #{region_name}(#{region_lookup.to_s}).\")\r\n job.save\r\n else\r\n # no region\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The region record for #{region_name} does not exist!\")\r\n job.save\r\n end\r\n }\r\n \r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > #{self.class} completed (id:#{self.id})\")\r\n job.save\r\n \r\n @log.info(\"#{self.class} completed (id:#{self.id})\")\r\n return true\r\n end",
"def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def index\n url = 'https://api.ziprecruiter.com/jobs/v1'\n zip_params = {}\n zip_params['api_key'] = ENV[\"ZIP_API_KEY\"]\n zip_params['search'] = params['search']\n zip_params['location'] = params['location']\n zip_params['radius_miles'] = 25\n zip_params['page'] = params['page'].present? ? params['page'].to_i : 1\n zip_params['jobs_per_page'] = 10\n zip_params['days_ago'] = params['days_ago']\n zip_params['refine_by_salary'] = params['refine_by_salary']\n \n begin\n response = RestClient.get url, {params: zip_params}\n parsed_response = JSON.parse(response)\n @total_jobs = parsed_response['total_jobs']\n @jobs = []\n parsed_response['jobs'].each do |job_json|\n @jobs << OpenStruct.new(job_json)\n end\n @has_prev = zip_params['page'] != 1\n @has_next = @total_jobs > zip_params['page'] * zip_params['jobs_per_page']\n next_page_params = params.dup\n next_page_params['page'] = zip_params['page'] + 1\n prev_page_params = params.dup\n prev_page_params['page'] = zip_params['page'] - 1\n @next_link = jobs_url(next_page_params.permit!)\n @prev_link = jobs_url(prev_page_params.permit!)\n rescue RestClient::ExceptionWithResponse => e\n render plain: \"e.response\"\n end \n end",
"def requests_for_date(date)\r\n #find all requests in this zip on this date\r\n s = Schedule.for(self.location, date)\r\n puts \"generated schedule\", s\r\n requests = []\r\n s.stops.each do |stop|\r\n puts stop\r\n requests << stop.requests if stop\r\n puts \"requests: \" + requests.to_s\r\n end\r\n requests.flatten.sort_by{|r| r.order.address.addr1}\r\n end",
"def render_jobs_list(jobs)\n workflow_with_jobs = []\n workflow_batch = {}\n\n jobs.each do |job|\n analysis = job&.analysis\n job.current_user = current_user\n workflow = analysis&.workflow\n slot = workflow_with_jobs.last\n\n if slot.nil? || slot[:analysis_dxid] != analysis&.dxid ||\n slot[:workflow]&.dxid != workflow&.dxid\n workflow_with_jobs << { analysis_dxid: analysis&.dxid,\n batch_id: analysis&.batch_id,\n workflow: workflow, jobs: [job] }\n fill_batch_with_workflows(workflow_batch, workflow, analysis)\n else\n slot[:jobs] << job\n end\n end\n\n workflow_with_jobs.map! do |slot|\n if slot[:workflow].nil?\n slot[:jobs].map do |job|\n job_serialized = JobSerializer.new(job)\n job_serialized.launched_on = job.analysis&.created_at || job.created_at\n job_serialized\n end\n else\n slot[:workflow].current_user = current_user\n\n workflow_serialized = WorkflowSerializer.new(slot[:workflow])\n number_workflows_in_batch(workflow_batch[slot[:batch_id]],\n workflow_serialized, slot[:analysis_dxid])\n workflow_serialized.jobs = slot[:jobs].map do |job|\n job_serialized = JobSerializer.new(job)\n\n launched_on = job.analysis&.created_at || job.created_at\n job_serialized.launched_on = launched_on\n if workflow_serialized.launched_on.nil? ||\n launched_on < workflow_serialized.launched_on\n workflow_serialized.launched_on = launched_on\n end\n\n job_serialized\n end\n\n workflow_serialized.launched_on ||= Time.current\n workflow_serialized\n end\n end.flatten!\n\n page_array = paginate_array(sort_array_by_fields(workflow_with_jobs))\n page_meta = pagination_meta(workflow_with_jobs.count)\n page_meta[:count] = page_meta.dig(:pagination, :total_count)\n\n render json: { jobs: page_array, meta: page_meta }, adapter: :json\n end",
"def searchDaysGov\n daysLess = params[:id]\n Rails.logger = Logger.new(STDOUT)\n logger.info \"Date limit is :\" << daysLess.to_i \n now = Date.today\n days_ago = (now - daysLess.to_i)\n logger.info \"Date limit is :\" << days_ago.to_s\n #@opportunities = Opportunity.all\n @opportunities = Opportunity.where(\"updated_at >= ?\", days_ago)\n render json: @opportunities\n end",
"def search_time_sheet_events(options={})\n days = {}\n method = 'search.messages'\n max_cnt = 15\n cnt = 0\n cur_date = options[:start]\n total_hours = 0.0\n\n loop do\n entries = []\n fdate = cur_date.strftime('%Y-%m-%d')\n printf \"\\n>>> processing #{fdate}\"\n \n query = \"in:engineering from:me on:#{fdate} biab\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :off, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n query = \"in:engineering from:me on:#{fdate} brb\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :off, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n \n query = \"in:engineering from:me on:#{fdate} back\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :on, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n \n query = \"in:engineering from:me on:#{fdate} good\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n state = (x['text'] =~ /evening|night/) ? :off : :on\n {state: state, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n entries = entries.sort_by { |h| h[:ts] }\n days[fdate] = {entries: entries}\n\n start_entry = nil\n last_entry = nil\n seconds = 60*15\n total_time_for_day = 0.0\n start = nil\n entries.each do |entry|\n begin\n printf \".\"\n entry[:diff] = 0\n\n if(entry[:state] == :off)\n stop = Time.at((entry[:ts].to_f / seconds).round * seconds)\n start = nil\n entry[:ts] = stop\n next unless start_entry\n\n diff = entry[:ts] - start_entry[:ts]\n start_entry[:diff] = (diff/(60*60))\n\n total_time_for_day += start_entry[:diff]\n start_entry = nil\n else\n time = Time.at((entry[:ts].to_f / seconds).round * seconds)\n entry[:ts] = time\n\n start_entry = entry if start_entry.nil?\n end\n rescue Exception => e\n puts \"Problem with entry: #{entry.inspect}\nstart_entry: #{start_entry.inspect}\n\"\n raise e\n end\n last_entry = entry\n end\n\n if(start_entry)\n today = Time.now.strftime(\"%Y%m%d\")\n process_day = start_entry[:ts].strftime(\"%Y%m%d\")\n\n if(today == process_day)\n time = Time.at((Time.now.to_f / seconds).round * seconds)\n\n diff_work = time - start_entry[:ts]\n start_entry[:diff] = diff_work/(60*60)\n total_time_for_day += start_entry[:diff]\n \n entries << {state: :pending, ts: time, text: \"still working\"}\n\n else\n entries << {state: :off, ts: last_entry[:ts], text: \"good day/evening (you never checked out?)\"}\n end\n end\n\n if entries.length > 0\n entries[entries.length-1][:diff] = 0.0 \n days[fdate][:hours] = total_time_for_day\n total_hours += days[fdate][:hours]\n printf \"=> #{days[fdate][:hours]} for day; #{total_hours} for range\"\n end\n\n break unless(cnt > max_cnt or cur_date < options[:stop])\n\n # go to next day\n cur_date += (60*60*24)\n cnt += 1\n end\n\n days[:hours] = total_hours\n report = {report: days}\n puts \"\\n>>> DONE!\"\n report\n end",
"def filter_messages(json, start_date, end_date)\n return json if start_date.nil? && end_date.nil?\n to_ret = Array.new\n json.each do | message |\n message_date = Date.strptime(message[\"created_at\"].to_s, '%s')\n if message_date >= start_date && message_date <= end_date\n to_ret << message\n end\n end\n return to_ret\nend",
"def dgstore_jobs\n if params[:start_date] and params[:end_date]\n @jobs = Job.where(\"startdate > :s and enddate < :e and hostname = :h\", :s=>params[:start_date].to_datetime,:e=>params[:end_date].to_datetime.next,:h=>\"M6600M284\").order('jobid desc')\n else\n @jobs = Job.where(:hostname=>'M6600M284').order('jobid desc').limit(10)\n end\n render :layout=>'global'\n end",
"def create_job_hash\n input_feed = Feedjira::Feed.fetch_and_parse('https://www.jobsatosu.com/all_jobs.atom ')\n feed_entries = input_feed.entries\n @jobs = Hash.new\n feed_entries.each do |fe|\n discription = ActionView::Base.full_sanitizer.sanitize(fe.content)\n if discription.length > 500\n short_discription = discription[0..500]+\"...\"\n else\n short_discription = discription\n end\n link = fe.links[0]\n @jobs[fe.entry_id] = \n {published: fe.published,\n updated: fe.updated,\n url: fe.url,\n links: link,\n title: fe.title,\n content: short_discription,\n full_content: discription,\n department: fe.author} \n end\n @jobs\n end",
"def get_dates(arr) \ndayDifference = Date.today - 7.days\narr.select do |d| \nif d.created_at.to_date > dayDifference \n d \n end\nend \nend",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def tasks_data_today \n tasks_of_today = self.tasks_due_today\n tasks = []\n tasks_of_today.each do |task|\n task = {\n task_name: task.name, \n completion_value: task.completions.last.completion_value,\n completion_max: task.completion_max,\n completion_unit: task.completion_unit\n }\n tasks << task \n end\n tasks \n end",
"def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biweek[1]].compact.uniq\n\n @schedule.each_with_index do |row, i|\n DAYS.each_with_index do |day, j|\n date = ( i < biweek[1] ? week_1[j] : week_2[j] )\n day_name = day[:day]\n name = row[day[:name]]\n hours = row[day[:hours]]\n if name && hours && name.downcase.include?(@person.downcase)\n work_days.push({\n :name => @person,\n :date => get_date(date, hours)\n })\n end\n end\n end\n puts \"Work days:\\n#{work_days}\"\n return work_days\nend",
"def age_worker(age_date)\n age_time = age_date.to_time\n ARGF.each do |l|\n project, type, age, last_seen = l.split \n last_seen = Time.at(last_seen.to_i)\n age_date = DateTime.parse(last_seen)\n puts l unless last_seen < age_date\n end\nend",
"def test_get_all_jobs\r\n # Create a trigger object with simple recurrence\r\n trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new\r\n trigger.startDate = SOAP::SOAPDateTime.new( \"2010-01-01T00:00:00.0000000+02:00\" )\r\n trigger.occurrenceCount = 1\r\n trigger.recurrenceInterval = 1\r\n trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK\r\n \r\n # Create an mail notification object\r\n email = JasperServer::ReportSchedulerService::JobMailNotification.new\r\n email.toAddresses = \"all4miller@gmail.com\"\r\n email.subject = \"Schedule report execution completed successfully\"\r\n email.messageText = \"Schedule report execution completed successfully\"\r\n email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT\r\n \r\n # Create a repository destination object \r\n repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new\r\n repo_dest.folderURI = '/ContentFiles/pdf'\r\n repo_dest.sequentialFilenames = false \r\n repo_dest.overwriteFiles = true\r\n \r\n # Create a job object \r\n job = JasperServer::ReportSchedulerService::Job.new\r\n job.reportUnitURI = @test_report_no_params['uri']\r\n job.label = @test_report_no_params['output_label'] \r\n job.baseOutputFilename = @test_report_no_params['output_filename']\r\n job.outputFormats = ['PDF']\r\n job.simpleTrigger = trigger\r\n job.mailNotification = email\r\n job.repositoryDestination = repo_dest\r\n \r\n # Create the schedule on the server \r\n job_res = @scheduler_service.scheduleJob( job )\r\n \r\n @test_jobs << job_res.id if !job_res.nil?\r\n \r\n array_of_jobs = @scheduler_service.getAllJobs\r\n assert_not_nil array_of_jobs, 'Failed to retrieve list of jobs' \r\n array_of_jobs.each do |job|\r\n assert_not_nil job, 'Null job returned' \r\n end\r\n end",
"def short_job?\n date = DateTime.new(params[:job][\"deadline(1i)\"].to_i, \n params[:job][\"deadline(2i)\"].to_i, \n params[:job][\"deadline(3i)\"].to_i, \n params[:job][\"deadline(4i)\"].to_i, \n params[:job][\"deadline(5i)\"].to_i) \n date < Time.now + 3.days\n end",
"def get_job(uuid, username, password)\n jobs = get_json('jobs.json', username, password)\n job = jobs['jobs'].find { |j| j['uuid'] == uuid }\n\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n\n fail \"Could not find job with UUID=#{uuid}\" unless job\n job\nend",
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def getDeadJobs\n getJobs('1/')\n end",
"def getCurrentJobs\n getJobs('0/')\n end",
"def getLeasesByDate(date)\n leases = getLeases()\n today_leases = []\n if leases.length !=0\n leases.each do |lease|\n if lease[\"status\"] == \"accepted\"\n #puts \"Gia na assssssssssssss\"\n #puts lease[\"valid_from\"].split('T')[0]\n #puts date\n #puts lease[\"valid_until\"].split('T')[0]\n if lease[\"valid_from\"].split(' ')[0] <= date && lease[\"valid_until\"].split(' ')[0]>=date\n #puts \"mpika\"\n today_leases << lease\n end\n end\n end\n end\n\n return today_leases\n end",
"def future from=7.days\n schedules.where(:when.gte => from.from_now)\n end",
"def latest_unpassing_jobs(project_id)\n latest_jobs(project_id).each_with_object([]) do |(branch, job_names), unpassing_jobs|\n job_names.each do |job_name, job|\n unpassing_jobs << job unless job['status'] == 'success'\n end\n end\nend",
"def calculate!\n # When expanding the application to support multi-week pay periods, this code must be modified\n minutes_this_week = []\n daily_limit = 8 * 60 # in minutes\n weekly_limit = 40 * 60 # in minutes\n\n entries = employee_entries.reload # TODO: sort logic here \n \n entries.each do |e|\n duration = e.duration || 0\n date = e.payroll_worked_date = e.ticket.first_employee_entry\n \n minutes_this_week[e.employee_id] ||= { total: 0 }\n minutes_this_week[e.employee_id][date] ||= 0\n minutes_this_week[e.employee_id][date] += duration\n minutes_this_week[e.employee_id][:total] += duration\n \n overtime_today = minutes_this_week[e.employee_id][date] - daily_limit\n overtime_this_week = minutes_this_week[e.employee_id][:total] - weekly_limit\n overtime_max = [overtime_today, overtime_this_week, 0].max\n \n e.payroll_duration_standard = duration - overtime_max\n e.payroll_duration_standard = 0 if e.payroll_duration_standard < 0\n e.payroll_duration_overtime = duration - e.payroll_duration_standard\n \n e.payroll_bill_to = e.ticket.bill_to\n e.payroll_job_id = e.ticket.job_id\n e.payroll_status = if e.on_the_job? and e.payroll_job_id\n :bill_to_job\n else\n :overhead\n end\n e.payroll_pay_rate = if e.ticket.job\n e.ticket.pay_rate\n else\n :day_pay\n end\n \n e.payroll_category_string = \"#{e.employee_id} - #{e.payroll_bill_to} - #{e.payroll_job_id} - #{e.payroll_pay_rate} - #{e.payroll_status}\"\n \n e.save!\n end\n end",
"def parse_raw_data(result)\n jobs = Array.new\n return jobs if result[:jobs].to_s.empty?\n result[:jobs][:items].each do |offer|\n job = Hash.new\n job[:jobtitle] = offer[:title]\n job[:location] = \"#{offer[:location][:country]}, #{offer[:location][:city]}\"\n job[:company] = offer[:company][:name]\n job[:date] = convert_date_to_format(offer[:published_at], '%d/%m/%y')\n job[:url] = offer[:links][:xing]\n job = convert_empty_to_nil(job)\n jobs << OpenStruct.new(job)\n end\n return jobs\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def get_jobs_by_client_id(client_id)\n jobs = []\n for job in get_data(\"jobs\")\n if client_id == job[\"client_id\"]\n jobs.push(job)\n end\n end\n\n return jobs\n end",
"def search_and_fetch_jobs\n feed = RSS::Parser.parse(open(target_url_with_query))\n feed.items.take(10)\n end",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end",
"def test_get_report_jobs\r\n # Create a trigger object with simple recurrence\r\n trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new\r\n trigger.startDate = SOAP::SOAPDateTime.new( \"2010-01-01T00:00:00.0000000+02:00\" )\r\n trigger.occurrenceCount = 1\r\n trigger.recurrenceInterval = 1\r\n trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK\r\n \r\n # Create an mail notification object\r\n email = JasperServer::ReportSchedulerService::JobMailNotification.new\r\n email.toAddresses = \"all4miller@gmail.com\"\r\n email.subject = \"Schedule report execution completed successfully\"\r\n email.messageText = \"Schedule report execution completed successfully\"\r\n email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT\r\n \r\n # Create a repository destination object \r\n repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new\r\n repo_dest.folderURI = '/ContentFiles/pdf'\r\n repo_dest.sequentialFilenames = false \r\n repo_dest.overwriteFiles = true\r\n \r\n # Create a job object \r\n job = JasperServer::ReportSchedulerService::Job.new\r\n job.reportUnitURI = @test_report_no_params['uri']\r\n job.label = @test_report_no_params['output_label'] \r\n job.baseOutputFilename = @test_report_no_params['output_filename']\r\n job.outputFormats = ['PDF']\r\n job.simpleTrigger = trigger\r\n job.mailNotification = email\r\n job.repositoryDestination = repo_dest\r\n \r\n # Create the schedule on the server \r\n job_res = @scheduler_service.scheduleJob( job )\r\n \r\n @test_jobs << job_res.id if !job_res.nil?\r\n \r\n array_of_jobs = @scheduler_service.getReportJobs( @test_report_no_params['uri'])\r\n assert_not_nil array_of_jobs, 'Failed to retrieve report jobs'\r\n array_of_jobs.each do |job|\r\n assert_not_nil job, 'Null job returned' \r\n end\r\n end",
"def query_by_date\n # find the wdays of the trip\n dates = dates_to_wdays(\n Date.parse(params[:from]),\n Date.parse(params[:to])\n )\n\n # find schedules that fit the wdays of the trip\n schedules = Schedule.where.overlap(wdays: dates)\n\n respond_with TripsBySchedulePresenter.new(schedules).as_json\n end",
"def delayed_jobs\n # The double-checks here are so that we won't blow up if the config stops using redis-namespace\n timestamps = (Array(Resque.redis.zrange(\"resque:delayed_queue_schedule\",0,-1)) + \n Array(Resque.redis.zrange(\"delayed_queue_schedule\",0,-1)))\n raise \"Nothing on delayed schedule\" if timestamps.empty?\n\n timestamps.map { |timestamp|\n [\n Array(Resque.redis.lrange(\"resque:delayed:#{timestamp}\",0,-1)) + Array(Resque.redis.lrange(\"delayed:#{timestamp}\",0,-1)),\n timestamp,\n ]\n }.map { |(job_strings,timestamp)|\n job_strings.map { |job_string|\n JSON.parse(job_string).merge('scheduler_timestamp' => timestamp.to_i)\n }\n }.flatten\n end",
"def get_items_since(query, since_date, until_date)\n url = @server_url+'/items/search.json?q='+query+'&since='+since_date+'&until='+until_date+'&per_page=500'\n json = self.get_json(url)\n results = []\n result = json[\"nyplAPI\"][\"response\"][\"result\"]\n results << result\n totalPages = json[\"nyplAPI\"][\"request\"][\"totalPages\"].to_i\n \n if totalPages >= 2\n puts \"total pages \" + totalPages.to_s if @debug\n (2..totalPages).each do | page |\n puts \"page: \"+page.to_s if @debug\n newurl = url + \"&page=#{page}\"\n json = self.get_json(newurl)\n newresult = json[\"nyplAPI\"][\"response\"][\"result\"]\n results << newresult\n end\n end\n results.flatten!\n \n results\n end",
"def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end",
"def calculate_past\n site_id = params[:id]\n year = DateTime.now.year\n month = DateTime.now.month\n x = 0\n while x < 2 do\n month -= 1\n if month == 0 then \n year -= 1\n month = 12\n end\n x = x+1\n puts \"Calculating\"\n puts site_id\n date_start = Date.new(year, month, 1)\n d = date_start\n d += 42\n date_end = Date.new(d.year, d.month) - 1\n puts date_end.to_s\n puts date_start.to_s\n \n Delayed::Job.enqueue CalculateSite.new(site_id,date_start,date_end)\n end\n render :nothing => true\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def range_from_params(json)\n return ::Time.now,::Time.now if json.empty?\n obj = JSON(json)\n min = ::Time.parse(obj['start'].to_s).at_beginning_of_day\n max = ::Time.parse(obj['end'].to_s).at_end_of_day\n min,max = max,min if min > max\n return min, max\n end",
"def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end",
"def upcoming_meetings(content, opts = {})\n cutoff = opts[:cutoff] || Time.now\n\n doc = Nokogiri::XML(content)\n\n meetings = {}\n\n doc.xpath(\"//item\").each do |item|\n\n # \"Austin City Council - 1/13/2011 10:00 AM\"\n title = item.xpath(\"title\").inner_text\n m = title.match(/(.*) - (.*)/)\n group = m[1]\n meeting_time = Time.strptime(m[2], \"%m/%d/%Y %I:%M %p\")\n\n # Consider only future meetings.\n next unless meeting_time > cutoff\n\n # There are some weird far future meetings in the feed.\n # Cut off stuff more than a year out.\n next if meeting_time > cutoff + (365*24*60*60)\n\n # \"https://austin.siretechnologies.com/sirepub/mtgviewer.aspx?meetid=576&doctype=AGENDA\"\n link = item.xpath(\"link\").inner_text\n m = link.match(/meetid=([\\d]+)/)\n meetid = m[1].to_i\n\n pubdate = Time.parse(item.xpath(\"pubDate\").inner_text)\n\n meetings[meetid] = SireAgenda::Meeting.new(meetid,\n :group => group,\n :meeting_time => meeting_time,\n :last_changed => pubdate,\n :sire => self,\n )\n\n end\n\n meetings\n end",
"def preproc_workexperience_list\n res = []\n #@cur_we_only1empl = true # force to true...\n unless @cur_we_only1empl\n cur_workexperience_list.each do |item|\n item.activities = [item.activities]\n res << item\n end\n return res\n end \n #return cur_workexperience_list\n \n employer = {}\n cur_workexperience_list.each do |item|\n det = employer[item.employer]\n det = [] unless det\n det << item\n employer[item.employer] = det\n end\n employer.each do |k,v|\n if v.size == 1\n #v[0].activities = [v[0].activities]\n #v[0].activities.flatten!\n v[0].set_cumulated_activities([v[0].activities])\n res << v[0]\n else\n #p v\n # we have more that one activity pro employer\n # first get date, min and max\n min_date_item = v.min{|a,b| a.date_from <=> b.date_from }\n max_date_item = v.max{|a,b| a.date_to <=> b.date_to }\n pos = []\n aa = v.sort do |a,b| \n if b.is_date_to_now\n 1\n else\n b.date_from <=> a.date_from\n end\n end\n aa.each do |ele|\n #p ele.from.strftime(\"%d.%m.%Y\")\n pos << ele.position.split(',')\n end\n position = arr_word_list(pos)\n \n activities = []\n aa.each do |ele|\n ele.activities\n #p ele.from\n activities << ele.activities\n end\n sect_arr = []\n aa.each do |ele|\n sect_arr << ele.sector.split(',')\n end\n sector = arr_word_list(sect_arr)\n \n wenew = Workexperience.new\n wenew.date_from = min_date_item.date_from\n wenew.date_to = max_date_item.date_to\n wenew.is_date_to_now = max_date_item.is_date_to_now\n wenew.position = position\n wenew.set_cumulated_activities(activities)\n wenew.sector = sector\n wenew.employer = v[0].employer\n res << wenew \n end\n end\n #res.each{|e| p e}\n return res\n end",
"def active_job_requests\n self.job_requests.joins(:project).where( :is_canceled => false, :project => {\n :is_finished => false ,\n :is_deleted => false \n } ).order(\"deadline_date ASC, is_finished ASC, created_at DESC\")\n end",
"def capture_events\r\n\t\tputs \"--------- Adding last week build info. starts here -------\"\r\n\t\tresponse_job_names = @client.api_get_request(\"\")\r\n\t\tjobs = []\r\n\t\tresponse_job_names[\"jobs\"].each { |job| jobs << job[\"name\"] \r\n\t\t}\r\n\r\n\t\tjobs.each { |job| \r\n\t\tputs \"Job: #{job}\"\r\n\t\tresponse_json_builds = @client.api_get_request(\"/job/#{job}\", \"depth=1&tree=builds[id,duration,number,result,url]\")\r\n\t\tfiltered_jobs = []\r\n\t\tresponse_json_builds[\"builds\"].each do |pastjob|\r\n\t\tbuildtime = pastjob[\"id\"].to_s.split('_')[0] + \" \" + pastjob[\"id\"].to_s.split('_')[1].gsub(\"-\",\":\")\r\n\t\tif !(buildtime.nil?) && !(pastjob[\"number\"].to_s.nil?) && !(pastjob[\"result\"].nil?)\r\n\t\t\t if Time.parse(buildtime) >= pasttime\r\n\t\t\t\tsummary = job + \" build #\" + pastjob[\"number\"].to_s + \" \" + pastjob[\"result\"]\r\n\t\t\t\tcontent = \"Check the status for build #\" + pastjob[\"number\"].to_s + \" here \"+ pastjob[\"url\"]\r\n\t\t\t\tbuilddate = DateTime.parse(pastjob[\"id\"].to_s.split('_')[0]+ \" \" + pastjob[\"id\"].to_s.split('_')[1].gsub(\"-\",\":\"))\r\n\t\t\t\tstarttime = builddate.strftime(config['pasteventsdateformat'])\r\n\t\t\t\tbuildendtime = Time.parse(starttime) + (pastjob[\"duration\"]/(1000))\r\n\t\t\t\tgooglestartdate = builddate.strftime(config['googledateformat'])+'T'+starttime.to_s+'.000Z'\r\n\t\t\t\tgoogleenddate = builddate.strftime(config['googledateformat'])+'T'+buildendtime.strftime(config['pasteventsdateformat'])+'.000Z'\r\n\r\n\t\t\t\tevent = {\r\n\t\t\t\t :title=>summary, \r\n\t\t\t\t :content=>content,\r\n\t\t\t\t :author=>config['author'], \r\n\t\t\t\t :email=>config['email'], \r\n\t\t\t\t :startTime=>googlestartdate,\r\n\t\t\t\t :endTime=>googleenddate}\r\n\t\t\t\tresponse = gcalsession.new_event(event, config['pasteventscalId'])\r\n\t\t\t\tputs 'done'\r\n\t\t\t end\r\n\t\tend\r\n\t\tend\r\n\t\t}\r\n\t\tputs \"--------- Adding last week build info. ends here -------\"\r\n\tend",
"def list_jobs all: nil, token: nil, max: nil, filter: nil, min_created_at: nil, max_created_at: nil,\n parent_job_id: nil\n # The list operation is considered idempotent\n min_creation_time = Convert.time_to_millis min_created_at\n max_creation_time = Convert.time_to_millis max_created_at\n execute backoff: true do\n service.list_jobs @project, all_users: all, max_results: max,\n page_token: token, projection: \"full\", state_filter: filter,\n min_creation_time: min_creation_time, max_creation_time: max_creation_time,\n parent_job_id: parent_job_id\n end\n end",
"def test_get_job\r\n # Create a trigger object with simple recurrence\r\n trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new\r\n trigger.startDate = SOAP::SOAPDateTime.new( \"2010-01-01T00:00:00.0000000+02:00\" )\r\n trigger.occurrenceCount = 1\r\n trigger.recurrenceInterval = 1\r\n trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK\r\n \r\n # Create an mail notification object\r\n email = JasperServer::ReportSchedulerService::JobMailNotification.new\r\n email.toAddresses = \"all4miller@gmail.com\"\r\n email.subject = \"Schedule report execution completed successfully\"\r\n email.messageText = \"Schedule report execution completed successfully\"\r\n email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT\r\n \r\n # Create a repository destination object \r\n repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new\r\n repo_dest.folderURI = '/ContentFiles/pdf'\r\n repo_dest.sequentialFilenames = false \r\n repo_dest.overwriteFiles = true\r\n \r\n # Create a job object \r\n job = JasperServer::ReportSchedulerService::Job.new\r\n job.reportUnitURI = @test_report_no_params['uri']\r\n job.label = @test_report_no_params['output_label'] \r\n job.baseOutputFilename = @test_report_no_params['output_filename']\r\n job.outputFormats = ['PDF']\r\n job.simpleTrigger = trigger\r\n job.mailNotification = email\r\n job.repositoryDestination = repo_dest\r\n \r\n # Create the schedule on the server \r\n job_res = @scheduler_service.scheduleJob( job )\r\n \r\n @test_jobs << job_res.id if !job_res.nil?\r\n \r\n # Fetch job by id \r\n job = @scheduler_service.getJob( job_res.id )\r\n \r\n # Did we get anythign back\r\n assert_not_nil( job, 'Failed to retrieve existing job' )\r\n assert_instance_of( JasperServer::ReportSchedulerService::Job, job,\r\n 'Failed to retrieve existing job' ) \r\n end",
"def schedule_with_periodicity(jobs=parse_jobs())\n # see parse_input.rb\n #jobs = parse_jobs()\n jobs.each do |job|\n unless job.periodicity == 0 or jobs.map{ |j| j.id }.count(job.id) > 1\n # duplicate periodic job and fix arrival and relative_deadline\n periodic_job = job.dup\n periodic_job.arrival = job.periodicity + job.arrival\n periodic_job.relative_deadline = periodic_job.arrival + periodic_job.deadline\n # insert it at the good arrival place in the array of jobs\n i = 0\n jobs.map do |j|\n if periodic_job.arrival > jobs[i].arrival and\n (jobs[i+1].nil? or periodic_job.arrival < jobs[i+1].arrival)\n jobs.insert(i + 1, periodic_job)\n break\n end\n i += 1\n end\n end\n end\n return jobs\nend",
"def get_readings_from_remote_server_for_dates(type, start_date, end_date)\n readings = []\n start_date.upto(end_date) do |date|\n readings += get_readings_from_remote(type, date)\n end\n return readings\nend",
"def index\n #@posts = Post.all\n @posts = Post.getVisible('t')\n all_invisible_posts = Post.getVisible('f')\n @scheduled_posts = []\n\n @invisible_posts = []\n\n all_invisible_posts.each do |inv_post|\n job = @@scheduler.find_by_tag(inv_post.id.to_s)\n puts \"job class: \"+job[0].class.to_s\n\n if !job[0].nil?\n puts \"scheduled job: \"+job[0].inspect\n inv_post.scheduled_job = job[0]\n @scheduled_posts << inv_post\n else\n @invisible_posts << inv_post\n end\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def create_date_field(task, relative_date)\n if task.has_key?('days')\n task['date'] = relative_date + task['days'].to_i\n end\n\n if task.has_key?('subtasks') && task['subtasks'].any?\n task['subtasks'].each { |subtask|\n create_date_field(subtask, relative_date)\n }\n end\nend",
"def remove_distribution_hours_for_user(project_job)\n puts \"coming to remove_distribution_hours_for_user ..........................\"\n past_dates = project_job.job_time_logs.where(\"user_id = ? and log_start_time < ?\",project_job.assigned_to, Date.today).all.map(&:log_start_time).map(&:to_date)\n p past_dates\n if(past_dates.present?)\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).where(\"allotted_date not in (?)\",past_dates).delete_all\n else\n ResourceDistribution.where(:project_job_id=>project_job.id, :user_id=>project_job.assigned_to).delete_all\n end\n end",
"def next_availability\n if job = jobs.detect { |k, v| v['reserved_at'].nil? }\n job.first\n end\n end",
"def job_postings\n @job_postings ||= convert_to_json data \n end",
"def read\n UpdateFeedJob.perform_later\n @entries = current_user.feed_entries.order(sort_date: :desc).page params[:page]\n @first = nil\n unless @entries.empty?\n @first = @entries.first.sort_date.iso8601\n end\n if params[:first]\n @first = Time.parse(params[:first]).iso8601\n @entries = current_user.feed_entries.where('sort_date <= ?', @first).order(sort_date: :desc).page params[:page]\n end\n end",
"def search_trips\n\t\t# Get the current date by turning the provided milliseconds into seconds\n\t\t# then turning it into a datetime object\n\t\t@date = Time.at(trip_params[:date].to_i / 1000).to_datetime\n\t\tputs \"\\n\\n\"\n\t\t@searched_epoch_time = DateTime.parse(@date.to_s).to_time.to_i\n\t\t@current_epoch_time = DateTime.now.strftime('%s').to_i\n\t\tputs \"Searched epoch time: \", @searched_epoch_time\n\t\tputs \"Current epoch time: \", @current_epoch_time\n\t\tputs ((@searched_epoch_time-@current_epoch_time) > -86400)\n\t\tputs (@searched_epoch_time-@current_epoch_time)\n\t\tputs (-200 > -86400)\n\t\t# Check that the date is after today\n\t\tif ((@searched_epoch_time-@current_epoch_time) > -104000)\n\t\t\t# Fetch results up to five days later\n\t\t\t@results = Trip.where(\n\t\t\t\tfrom_city: trip_params[:from_location], \n\t\t\t\tto_city: trip_params[:to_location], \n\t\t\t\t:date.gte => @searched_epoch_time - (5.days+1),\n\t\t\t\t:date.lte => @searched_epoch_time + (10.days-1),\n\t\t\t\tmonth: trip_params[:month],\n\t\t\t\tyear: trip_params[:year],\n\t\t\t\t:spaces.gte => 1\n\t\t\t)\n\t\t\t# Filter out any results that are from before today\n\t\t\t@final_results = @results.where(\n\t\t\t\t:date.gte => Time.now.to_i\n\t\t\t)\n\t\t\t@final_results_with_driver_names = @final_results.map{ |trip|\n\t\t\t\t@driver = User.find_by(_id: trip.driver)\n\t\t\t\ttrip.driver.replace(@driver.first_name + \" \" + @driver.last_name)\n\t\t\t\ttrip\n\t\t\t}\n\t\t\t\n\t\t\trender json: {\n\t\t\t\tresults: @final_results_with_driver_names,\n\t\t\t\tdriver: @driver_name,\n\t\t\t\tnow: Time.now.to_i,\n\t\t\t\tgreater_than_date: DateTime.parse(@date.to_s).to_time.to_i - (3.days+1),\n\t\t\t\tless_than_date: DateTime.parse(@date.to_s).to_time.to_i + (5.days-1),\n\t\t\t\tsearched_date: @searched_epoch_time,\n\t\t\t\tcurrent_time: @current_epoch_time\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'The search date must be after today!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def collect_joblist(data_path,script_path)\n \n # define list of ignored files/dirs\n to_ignore = ['.','..','.DS_Store']\n \n res = []\n \n # open dir\n directory=Dir.open(data_path)\n \n # for each file in dir\n directory.each do |d|\n \n # add if not in ignore list\n if to_ignore.index(d) == nil\n \n # get standard attributes if file exists\n std_attr = {}\n if File.exists?(File.join(data_path,d,STANDARD_ATTR_JSON))\n std_file=get_json_data(File.join(data_path,d,STANDARD_ATTR_JSON))\n \n if !std_file.nil?\n\t std_attr=std_file\n end\n \n #puts \"STDATTR:\"+std_attr.to_yaml\n end\n\t\n \n # id is always current directory\n std_attr['job_id']=d\n \n # there is a script for job info\n if File.exists?(script_path)\n#puts \"populate joblist data\"\n\n # populate data with it\n command = script_path + ' ' + File.join(data_path,d)\n job_text=`#{command}`\n\n if job_text!=''\n\n obj = ActiveSupport::JSON.decode(job_text)\n \n if !obj.empty?\n if !std_attr.empty?\n obj=obj.merge(std_attr)\n end\n # add object\n res.push(obj)\n end\n end\n\n else\n # if there is not a script, then push std_attr\n\n res.push(std_attr)\n end\n \n end\n end\n\n\n\n # close dir\n directory.close\n \n # puts \"joblist:\"+res.to_yaml\n \n return res\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def bra_per_day(date)\n date = date.to_i\n p url = \"https://donneespubliques.meteofrance.fr/donnees_libres/Pdf/BRA/bra.#{date}.json\"\n JSON.parse(open(url).read)\nend",
"def pull_recent_activity!\n earlier_steps_available = steps_available\n pull_activity! Date.current # always fetch today\n\n days_ago = 1\n while days_ago < 7 # only look back a week max\n date = Date.current - days_ago.days\n known = activity_for(date)\n fetched = pull_activity!(date)\n\n # abort if no different from what we thought\n break if (known.steps == fetched.steps) and\n (known.active_minutes == fetched.active_minutes) and\n (known.steps != 0 and known.active_minutes != 0)\n\n days_ago += 1\n end\n\n # return info in a hash for logging\n {\n player_id: self.id,\n player_name: self.name,\n days_fetched: days_ago + 1,\n steps_available: steps_available,\n new_steps_available: (steps_available - earlier_steps_available)\n }\n end",
"def index\n # Get all work days in the actual month\n currentTime = Time.now\n @user = current_user\n @work_days = @user.work_days.order(\"date\").where(date: currentTime.at_beginning_of_month..currentTime.at_end_of_month)\n \n # Gets sum of all the work hours\n @work_days_total_hours = @work_days.inject(0.0){|sum, item| sum+item.work_hours} || 0\n @work_days_extra_hours = @work_days_total_hours - (@work_days.count * @user.daily_hours)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_days }\n end\n end",
"def get_all_scheduled_jobs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_all_scheduled_jobs ...'\n end\n allowable_values = [\"ASC\", \"DESC\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/inboxes/scheduled-jobs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].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(['*/*'])\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] || 'PageScheduledJobs' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\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: InboxControllerApi#get_all_scheduled_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getCompletedItemsByDate(project_id, from_date)\n request_url = create_url('getAllCompletedItems', {:token => @@config['todoist']['token'], :project_id => project_id, :from_date => from_date})\n api_request(request_url)\n end",
"def index\n case current_user.role\n when 'admin'\n @jobs = Job.order(:start_date).select { |j| j.start_date >= Date.today }\n when 'agent'\n @jobs = Job.order(:start_date).select { |j| !j.agents.include?(current_agent) && j.start_date >= Date.today }\n end \n end",
"def search_for_job_in_full_job_list_json(json_summary, job_name, job_status_hash_table)\n json_summary[\"jobs\"].each do |job_entry|\n if (job_entry[\"name\"] == job_name)\n \n #push new entry into hash table\n job_status_entry = {job_entry[\"name\"] => job_entry[\"color\"]}\n job_status_hash_table.merge!(job_status_entry)\n else\n #print \"No match [#{job_entry}]\\n\"\n end\n end\nend",
"def parse_days\n [\n [\n 0,\n params[:page].presence&.to_i || scheduler.days_ahead_with_open_slot\n ].compact.max,\n Rails.configuration.x.schedule_up_to_days\n ].min\n end",
"def parse_days\n [\n [\n 0,\n params[:page].presence&.to_i || scheduler.days_ahead_with_open_slot\n ].compact.max,\n Rails.configuration.x.schedule_up_to_days\n ].min\n end",
"def jobs\n return nil unless @rufus\n return @saved_job_list if !running\n\n @rufus.jobs.collect do |job|\n {\n :job => job,\n :job_spec_id => job.handler.job_spec_id,\n :job_spec_name => job.handler.job_spec_name,\n :launched_job => job.handler.launched_job,\n :running => job.running?,\n :last_time => job.last_time,\n :next_time => job.next_time,\n :opts => job.opts,\n :scheduled_at => job.scheduled_at,\n :unscheduled_at => job.unscheduled_at,\n :id => job.id,\n :tags => job.tags,\n :last_work_time => job.last_work_time,\n :mean_work_time => job.mean_work_time\n }\n end\n end",
"def dates(n = 0, per_page = 10)\n @dates = []\n n.upto(n + per_page) do |n|\n if first_at.wday == wday\n date = first_at + (n * 7).days\n elsif first_at.wday > wday\n date = first_at + (7 - first_at.wday + wday).days + (n * 7).days\n elsif first_at.wday < wday\n date = first_at + (wday - first_at.wday).days + (n * 7).days\n end\n\n @dates << [date, WorkTime.find_by_start_date(date)]\n end\n return @dates\n end",
"def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end",
"def get_jobs\n coll = @db.collection(@coll_scheduled_jobs)\n event_job_map = {}\n jobs = coll.find.map do |entry|\n event_job_map[entry[\"eventId\"]] = entry\n entry\n end\n return jobs, event_job_map\n end",
"def weekly_updates_by_project(since)\n since = Date.new(2000,01,01) if since == :all\n self.weekly_updates.where([\"weekstart > ?\",since]).order(\"project_id, weekstart desc\").group_by {|w| w.project}\n end",
"def refresh\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n @job = @rest.get_rest(@job_uri)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @id ||= job['id']\n @status = job['status']\n @created_at = DateTime.parse(job['created_at'])\n @updated_at = DateTime.parse(job['updated_at'])\n @results = job['nodes']\n end",
"def available_jobs\n @jobs = Job.all.select { |j| !j.agents.include?(current_user) && j.start_date >= Date.today }\n end",
"def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend",
"def search_schedule_work\n @schedule = ScheduleOfWorker.new\n @company = Company.find(session[:company])\n @cost_center = CostCenter.find(get_company_cost_center('cost_center'))\n @inicio = params[:start_date]\n @fin = params[:end_date]\n\n @dias_habiles = range_business_days(@inicio,@fin)\n workers = Array.new\n @arraywo = Array.new\n partworkers = PartWorker.where(\"date_of_creation BETWEEN ? AND ? AND blockweekly = 0 AND cost_center_id = ?\",@inicio,@fin, @cost_center.id)\n partworkers.each do |pw|\n pw.part_worker_details.each do |pwd|\n workers << pwd.worker_id\n end\n end\n\n workers = workers.uniq\n index = 1\n valor = 0\n\n @part_worker_to_block = Array.new\n workers.each do |wo|\n totalworker = 0\n wor = Worker.find(wo)\n contract = WorkerContract.where(\"worker_id = ? AND status = 1\",wo).first\n if !contract.nil?\n cadenita = index.to_s + ';' + contract.article.code.to_s + ';' + contract.article.name.to_s + ';' + wor.entity.dni.to_s + ';' + wor.entity.paternal_surname.to_s + \" \" + wor.entity.maternal_surname.to_s + ', ' + wor.entity.name.to_s + ' ' + wor.entity.second_name.to_s\n @dias_habiles.each do |dh|\n answer = PartWorker.where(\"date_of_creation = '\"+dh.to_s+\"' and blockweekly = 0 AND cost_center_id = \"+ @cost_center.id.to_s).first\n if answer.nil?\n cadenita = cadenita + ';' + '0'\n else\n answer2 = PartWorkerDetail.where(\"part_worker_id = ? AND worker_id = ?\", answer.id, wo)\n if answer2.count == 0\n cadenita = cadenita + ';' + '0'\n end\n answer2.each do |ans2|\n if ans2.assistance == 'si'\n cadenita = cadenita + ';' + '1'\n totalworker +=1\n @part_worker_to_block << answer.id\n else\n cadenita = cadenita + ';' + '0'\n end\n end\n end\n end\n cadenita = cadenita + ';' + totalworker.to_s\n @arraywo << cadenita.split(';')\n index += 1\n end\n end\n @totalperday = Array.new\n totaltotal = 0\n @dias_habiles.each do |dh|\n perday = PartWorker.where(\"date_of_creation = '\"+dh.to_s+\"' and blockweekly = 0 AND cost_center_id = \" + @cost_center.id.to_s).first\n if !perday.nil?\n day = PartWorkerDetail.where(\"part_worker_id = ? AND assistance LIKE 'si'\", perday.id)\n @totalperday << day.count.to_s\n totaltotal = totaltotal + day.count\n else\n @totalperday << 0 \n end\n end\n @totalperday << totaltotal\n @part_worker_to_block = @part_worker_to_block.uniq.join(',')\n render(partial: 'schedule_table', :layout => false)\n end",
"def requests(job)\r\n {\r\n :account_query_rq => {\r\n :active_status => \"ActiveOnly\",\r\n :from_modified_date => qbwc_log_init(WorkerName),\r\n :to_modified_date => qbwc_log_end()\r\n }\r\n }\r\n end",
"def add_and_return_array(data)\n # Create new array\n days = []\n # Loop through dates\n (1.week.ago.to_date..Date.today).each do |date|\n # Set datetime to beginning of day\n date = date.midnight\n # Push to hash into array\n days << { m: date, a: data[date] }\n end\n # return days as array\n days\n end",
"def scraper\n\turl = \"https://www.indeed.com/jobs?q=Ruby%20on%20Rails&l&vjk=ac03f2f61f05d2b8\"\n\tunparsed_page = HTTParty.get(url) if url\n\n\tparsed_page = Nokogiri::HTML(unparsed_page.body)\n\tjobs = Array.new\n\tjob_listings = parsed_page.css('td.resultContent')\n\t\n\t# starting page\n\tpage = 1\n\t# Get # of listings per page\n\tper_page =job_listings.size\n\t# Get total listings. \tsuper fragile clean up of the total\n\ttotalListings = parsed_page.css('div#searchCountPages').text.split(' ')[3].gsub(',','').to_i\n\tlast_page = (totalListings.to_f / per_page).round\n\n\t# Loop through pages see https://www.youtube.com/watch?v=b3CLEUBdWwQ&t=385s 26:30\n\tjob_listings.each do |job_listing|\n\t\tjob = {\n\t\t\ttitle: job_listing.css('div.singleLineTitle').text,\n\t\t\tcompany: job_listing.css('span.companyName').text,\n\t\t\tlocation: job_listing.css('div.companyLocation').text,\n\t\t\trating: job_listing.css('span.ratingsDisplay').text,\n\t\t\tsalary: job_listing.css('.salary-snippet-container').text\n\t\t}\n\t\tjobs << job\n\tend\n\tbyebug\nend",
"def formatRawJob(rjob, is_live)\n job = {}\n job[:rjob] = rjob\n job[:id] = rjob[\"id\"]\n job[:name] = rjob[\"name\"]\n\n if rjob[\"notifyURL\"]\n uri = URI(rjob[\"notifyURL\"])\n path_parts = uri.path.split(\"/\")\n job[:course] = path_parts[2]\n job[:assessment] = path_parts[4]\n end\n\n # Determine whether to expose the job name.\n unless @cud.user.administrator?\n if !@cud.instructor?\n # Students can see only their own job names\n job[:name] = \"*\" unless job[:name].ends_with? \"_#{@cud.user.email}\"\n elsif !rjob[\"notifyURL\"] || !(job[:course].eql? @cud.course.id.to_s)\n job[:name] = \"*\"\n end\n # Instructors can see only their course's job names\n end\n\n # Extract timestamps of first and last trace records\n if rjob[\"trace\"]\n job[:first] = rjob[\"trace\"][0].split(\"|\")[0]\n job[:last] = rjob[\"trace\"][-1].split(\"|\")[0]\n\n # Compute elapsed time. Live jobs show time from submission\n # until now. Dead jobs show end-to-end elapsed time.\n t1 = DateTime.parse(job[:first]).to_time\n if is_live\n snow = Time.now.in_time_zone.to_s\n t2 = DateTime.parse(snow).to_time\n else\n t2 = DateTime.parse(job[:last]).to_time\n end\n job[:elapsed] = t2.to_i - t1.to_i # elapsed seconds\n job[:tlast] = t2.to_i # epoch time when the job completed\n\n # Get status and overall summary of the job's state\n job[:status] = rjob[\"trace\"][-1].split(\"|\")[1]\n end\n\n if is_live\n job[:state] = if job[:status][\"Added job\"]\n \"Waiting\"\n else\n \"Running\"\n end\n else\n job[:state] = \"Completed\"\n job[:state] = \"Failed\" if rjob[\"trace\"][-1].split(\"|\")[1].include? \"Error\"\n end\n\n job\n end",
"def job_data\n fetch_data('https://www.themuse.com/api/public/jobs?&category=Engineering&category=Project+%26+Product+Management&level=Mid+Level&level=Entry+Level&location=Boston%2C+MA&location=New+York%2C+NY&location=San+Francisco%2C+CA&page=1&descending=true')[\"results\"]\nend",
"def getExecutionsForAJob(job_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/job/' + job_id + '/executions')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\nend",
"def perform\n time = Time.zone.now.utc\n\n start_time = (time - 1.hour - 10.minutes).to_s(:time)\n end_time = (time - 1.hour + 10.minutes).to_s(:time)\n\n User\n .includes(:reports)\n .where('work_start_time::time > ? AND work_start_time < ?', start_time, end_time)\n .find_each do |user|\n\n last_reported_report = user.reports.reported.last\n\n user_start_time = time.change(hour: user.work_start_time.hour, min: user.work_start_time.min)\n next if (user_start_time..time).cover?(last_reported_report&.reported_at)\n\n Notifications::UserReportReminderJob.perform_async(user.id)\n end\n end",
"def find\n return nil unless entry_paths.any?\n past_entries = entry_paths.map do |path|\n match = path.match(DATE_PATH_MATCHER)\n Date.parse(match.to_s)\n end.select { |date| date < today }\n\n past_entries.last\n end",
"def fetch_appointments(obj, t_d)\n (z = obj.state.appointments_for_dates[t_d]) ? z : {}\n # x = (z = obj.state.appointment_availabilities[t_d]) ? z : {}\n # begining = Moment.new(t_d).set(hour: 9).format()\n # ending = Moment.new(t_d).set(hour: 19).format()\n # x.each do |k, v|\n # v.each do |av|\n # break if av.map.is_a? Array\n # p_av = JSON.parse(av.map).each_slice(2).to_a.sort {|x, y| x[1] <=> y[1]} unless av.map.length == 1\n # p_av.unshift([begining, begining])\n # p_av.push([ending, ending])\n # _map = []\n # i = 0\n # while i < (p_av.length - 1)\n # first = Moment.new p_av[i][1]\n # second = Moment.new p_av[i + 1][0]\n # d = second.diff(first, \"minutes\")\n # if d > 20\n # _map << [first, second]\n # end\n # i += 1\n # end\n # av.map = _map\n # end\n # end \n # x\n end",
"def find_finished_jobs(profile)\n my_finished_jobs = []\n if profile.user_type == 'teen'\n my_finished_contracts = Contract.where(profile_id: profile.id, accept_status: 3)\n my_finished_contracts.each do |constract_obj|\n my_finished_jobs.push(constract_obj.job)\n end\n else\n my_jobs = profile.jobs\n my_jobs.each do |each_job|\n if Contract.find_by(job_id: each_job.id, accept_status: 3).present?\n my_finished_jobs.push(each_job)\n end\n end\n end\n\n\n return my_finished_jobs\n\n end",
"def find_jobs (tag=nil)\n\n jobs = @cron_jobs.values + @non_cron_jobs.values\n jobs = jobs.select { |job| job.has_tag?(tag) } if tag\n jobs\n end",
"def seven_days\n @transactions = where(\"created_at >= ?\", (Time.now - 7.days))\n end"
] |
[
"0.6125629",
"0.60991776",
"0.59484947",
"0.5701662",
"0.56686306",
"0.56597656",
"0.55676115",
"0.5542194",
"0.5455431",
"0.5447028",
"0.5437113",
"0.54125005",
"0.5384319",
"0.53822505",
"0.5379135",
"0.5376243",
"0.5372504",
"0.52999395",
"0.5286573",
"0.5278726",
"0.5274228",
"0.52725726",
"0.5250423",
"0.52498186",
"0.52378726",
"0.52224034",
"0.5193134",
"0.5182758",
"0.5167652",
"0.5166169",
"0.5163057",
"0.51505345",
"0.5106444",
"0.51028144",
"0.5102562",
"0.509384",
"0.5070579",
"0.50671065",
"0.504697",
"0.5043712",
"0.50307006",
"0.5029154",
"0.5028788",
"0.5027831",
"0.50238657",
"0.5017067",
"0.50139564",
"0.50040334",
"0.49948812",
"0.49937314",
"0.49911717",
"0.4984363",
"0.4979909",
"0.497957",
"0.49779567",
"0.49769118",
"0.4965247",
"0.49596277",
"0.4958999",
"0.49588752",
"0.49522498",
"0.49475598",
"0.4946335",
"0.4925368",
"0.49203253",
"0.491299",
"0.49084195",
"0.4902205",
"0.49000984",
"0.48940784",
"0.4879705",
"0.48759386",
"0.48754796",
"0.48709658",
"0.48681933",
"0.48624",
"0.4856207",
"0.48504144",
"0.48504144",
"0.4846612",
"0.48456052",
"0.48445424",
"0.48358282",
"0.4833108",
"0.482853",
"0.48255414",
"0.4824238",
"0.48236415",
"0.4820317",
"0.4819528",
"0.48163554",
"0.48102775",
"0.4809408",
"0.48077273",
"0.48070055",
"0.47995043",
"0.4793225",
"0.4788458",
"0.47858697",
"0.47725788"
] |
0.7609672
|
0
|
find latest id used and return one more
|
def get_new_id(class_name)
@data = get_all()
# if array is empty return first id 0
if @data[class_name].length == 0
return 0
end
# go to last item of the array, get the id and sum +1
return @data[class_name][-1]["id"] + 1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_id\n # hashs are ordered, so just return the latest entry\n @entries.keys.last\n end",
"def last_id()\n #This is a stub, used for indexing\n end",
"def next_id\n self.latest_id += 1\n end",
"def next_available_id\n last_id = all_ids.map do |key|\n key.sub(\"#{self.name}_\", \"\").to_i\n end.max.to_i\n\n last_id + 1\n end",
"def last_ids(number); end",
"def last\n order(:id).reverse.limit(1)\n end",
"def last\n asc(:id).last\n end",
"def last_id(key, id = nil)\n ids = $configure[:twitter][:last_ids] || {}\n current_id = ids[key]\n # Save last id if id is passed\n ids[key] = id if id\n $configure[:twitter][:last_ids] = ids;\n current_id\nend",
"def previous_id\n self.class.where('id < ?', self.id).pluck(:id).last\n end",
"def check_id\n unless self.id\n maximo= self.class.maximum(:id)\n id = 1 unless maximo\n id ||= maximo.to_i + 1\n self.id = id\n end\n end",
"def next_id\n (all.map(&:id).max || 0) + 1\n end",
"def last_seen_uid\n self.messages.order_by(:uid => :desc).limit(1).first.try(:uid) || 1\n end",
"def last\n find(:first, :conditions => {}, :sort => [[:_id, :asc]])\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def generate_guid\n list = load_data\n\n max = list.max_by{|hash| hash[:guid]}\n max ? max[:guid].next : '1'\nend",
"def lastID\r\n self.conn_exec do |driver|\r\n return driver.lastID\r\n end\r\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def get_last_port\n flist = Fiberstrand.where(\"connection_id = \" + self.id.to_s)\n #binding.pry\n fportid=0\n # binding.pry\n flist.each do |fiber|\n fport = Devport.find_by_id(fiber.portb)\n fportid=fport.id\n break if (fport.fiber_out_id==0)\n fportid=0\n end\n \n fportid\n \n end",
"def next_temp_id\n @id ||= ASSET_GROUP_TEMPORARY_ID.to_i\n @id -= 1\nend",
"def next_messages_id\n messages.max{|a,b| a[:id] <=> b[:id]}[:id] + 1\nend",
"def calculate_last_id tweets_array\n last_id = @last_id\n tweets_array.each do |tweets|\n tweets.each do |t|\n last_id = t['id'] if t['id'] > last_id\n end\n end\n last_id\n end",
"def get_last_id\n return @mysql.last_id\n end",
"def next_id(items)\n max_id = items.map { |item| item[:id] }.max || 0\n max_id + 1\nend",
"def last\n last_mgmt_query ||= MgmtQuery.find_by_device_id( device_id.to_i, :conditions => [\"id < ?\", id], :order => \"timestamp_server DESC\", :limit => 2) unless device_id.blank? || device_id.to_i.zero?\n end",
"def last_post_identifier\n self.posts.\n find(:all, :order => 'published_at DESC, id DESC', :limit => 2).\n last.\n try(:identifier)\n end",
"def get_next_id\r\n id = java.lang.System.nanoTime.to_s\r\n $log.info(\"*** get_next_id: \" + id)\r\n return id\r\n end",
"def find_max_id(db, table)\r\n\t# Get list of ids\r\n\tid_array = db.execute(\"SELECT id FROM #{table}\")\r\n\t# Loop through list, checking for the highest number id\r\n\tmax_id = 0\r\n\tid_array.each do |cur_id|\r\n\t\tif cur_id[\"id\"] > max_id\r\n\t\t\tmax_id = cur_id[\"id\"]\r\n\t\tend\r\n\tend\r\n\t# Return the highest number found\r\n\treturn max_id\r\nend",
"def get_last_guid(file_json)\n file_json['notes'].last['guid'].dup\nend",
"def get_next_id\n id = 0\n contacts = read_contacts\n contacts.each do |contact|\n if id < contact[:id]\n id = contact[:id]\n end\n end\n id + 1\nend",
"def identifier\n @identifier ||= self.revlist.last\n end",
"def get_id\n @id ||= 0\n @id += 1\n @id\n end",
"def fetch id\n each_unread([]) do |m|\n if m.id == id\n return m\n end\n end\n\n nil\n end",
"def assign_new_id\n self.oid ||= (self.class.unscoped.maximum(:oid) || 0 ) + 1\n end",
"def next_id\n self.class.where(\"id > ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).first\n end",
"def get_latest_for(changeable)\n my_id = changeable.id\n self.send(\"find_by_#{self.changeable_fk}\", my_id, {:order => 'updated_at DESC', :limit => 1})\n end",
"def last\n _id, entry = @redis.xrevrange(key, '+', '-', count: 1).first\n entry\n end",
"def id\n Id.new(@head.fetch[2])\n end",
"def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def next\n self.class.where('id > ?', id).first\n end",
"def last\n self.class.where(:id => rid).order('lower(validity)').last\n end",
"def assign_user_id(users)\r\n highest_id = users.ids.max || 100 # reserve first 100 ids for testing\r\n return highest_id + 1\r\nend",
"def find_uniqable(uid)\n where_uniqable(uid).take\n end",
"def latest\n first_one(&:latest)\n end",
"def get_by_id(entry_id)\n fetch(entry_id).shift\n end",
"def assign_id(all_ids)\r\n highest_id = all_ids.max || 10 # reserve first 10 ids for testing\r\n return highest_id + 1\r\n end",
"def find_uniqable!(uid)\n where_uniqable(uid).take!\n end",
"def maximum_id(...)\n end",
"def last\n self.class.where(id: rid).chronological.last\n end",
"def next_list_id(lists)\n max = lists.map { |list| list[:id] }.max || 0\n max + 1\nend",
"def min_erased_id\n e = events.find {|id, ev| ev.erased?}\n (e) ? e[0] : nil\n end",
"def latest!\n latest_order!.first\n end",
"def getid\n @dbtop+=1\n end",
"def latest_inki_object_in_history(id)\n object = ObjectVersion.where(\n :format => 1,\n :model_id => id, \n :inki_model_name => self.to_s\n ).order(\"created_at DESC\").first\n if not object\n return nil \n else\n object.to_inki_object\n\t\t\tend\n\t\tend",
"def last_row_id\n gift.id\n end",
"def read_next_id\n id = nil\n list = current_list\n\n if @co_index <= list.size\n id = list[@co_index - 1][:id]\n end\n\n @co_index += 1\n\n id\n end",
"def previous_id\n self.class.where(\"id < ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).last\n end",
"def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end",
"def get_last_bid\n self.bids.max_by {|bid| bid.created_at}\n end",
"def last_ent\n ed.SelectLast.Value[0].ObjectId\n end",
"def latest\n latest_order.first\n end",
"def find(a) \n until @id[a] == a\n a = @id[a]\n end\n return a\nend",
"def last_task\n @task_list.last.id\n end",
"def most_likely_duplicate\n possible_matching_people.first\n end",
"def latest_version_id\n #in show view the content object contains solr info, so does not have version info - In that case we're going to refetch the object from fedora\n if content.class == FileContentDatastream\n version_content = content\n else\n g = GenericFile.find id\n version_content = g.content\n end\n\n if version_content.respond_to?(:latest_version)\n loris_id = get_full_path_id + '-' + (version_content.latest_version.try(:label) || \"\")\n else\n loris_id = get_full_path_id\n end\n\n #For now we still need to tell it wether to get original of watermarked version\n if requires_watermark?\n loris_id + '-' + 'low_resolution'\n else\n loris_id + '-' + 'content'\n end\n end",
"def get_last_entry\n @entry = FeedEntry.find(:first, :conditions => {:person_id => self.id})\n end",
"def id\n key = self.key\n key.first if key.size == 1\n end",
"def last_revision\n self.revision_model.find(:first, :conditions => { klass + '_id' => self.id }, :order => \"number DESC\")\n end",
"def latest_doc\n self.documents.find_with_deleted(:first, :order => 'id DESC')\n end",
"def get_new_id\n\t\t\n\t\tcount = 0 \t\t# Start at 0\n\n\t\twhile true\n\t\t\tcount += 1 # Increment\n\t\t\t# Break out of loop when ID found\n\t\t\tbreak if @templates[ count.to_s ].is_a? NilClass\n\t\tend\n\n\t\t# Raise error if out of range\n\t\traise RangeError, \"#{count} exceeds the planned range, may cause problems\" if count.to_s.length > 9\n\n\t\t# Return id in String form\n\t\tcount.to_s\n\n\tend",
"def latest_version\n\t\treturn versions.order(\"number DESC\").last\n\tend",
"def last_inserted_id(result)\n @connection.gathered_data[:last_id]\n end",
"def get_id(somegeneID)\n (0..(seed_stock.count-1)).each do |i|\n if mutant_gene_id[i] == somegeneID\n return seed_stock[i] \n elsif seed_stock[i] == somegeneID\n return mutant_gene_id[i]\n end\n end \n end",
"def last_id(table, table_hash)\n\t\t\t\tif (table.length > 0)\n\t\t\t\t\treturn (table[-1][table_hash[\"ID\"]]).to_i\n\t\t\t\telse\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\t\t\tend",
"def last_journal_id\n if new_record?\n nil\n else\n journals.maximum(:id)\n end\n end",
"def last_journal_id\n if new_record?\n nil\n else\n journals.maximum(:id)\n end\n end",
"def last_journal_id\n if new_record?\n nil\n else\n journals.maximum(:id)\n end\n end",
"def previous\n\t self.class.where(\"id < ?\", id).last\n\tend",
"def get_next\n r = nil\n iterator_lock do\n if @iterator <= @last_id\n r = get(@iterator)\n @iterator += 1\n @iterator_file.write(\"#{@iterator.to_s(36)}\\n\")\n r\n else\n nil\n end\n end\n end",
"def latest\n self\n end",
"def last_value_set(xs)\n xs.sort_by {|y| [y[:updated_at], y[:id]] }.last[:new_value]\n end",
"def set_key\n last_key = Issue.find_by_sql('select max(issueId) as maxid from issue')[0].maxid\n self.issueId = last_key.to_i + 1\n end",
"def next_job_id\n new_id = rand(10*5)\n get_job_status(new_id).nil? ? new_id : next_job_id\n end",
"def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end",
"def next_id\n @id ||= 0\n @id += 1\n end",
"def next_uid\n LdapUser.all(limit: 1, sort_by: :uidnumber, order: :desc).first[:uidnumber]+1\n end",
"def first_uid()\n max_uid - max_capacity + 1\n end",
"def find_last_updated_mir\n @max_updated_at = @swimmer.meeting_individual_results.exists? ? @swimmer.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end",
"def last_sequence_id\n #if the last page exists, return its sequence_id otherwise return 0\n last_page ? last_page.sequence_id : 0\n end",
"def next_id\n self[:next_id]\n end",
"def latest_or_version(version_id)\n version = Version.where(id: version_id).first || self.latest_version\n end",
"def keep_only_highest_id\n\t\tdocuments = Document.all\n\n\t\tdocuments.each do |d|\n\t\t\tfid = d.foreign_document_id\n\t\t\t# Find all with same foreign id\n\t\t\tsimilars = Document.where(:foreign_document_id => fid)\n\t\t\thighest_id = 0\n\t\t\t# Find latest record\n\t\t\tsimilars.each do |s|\n\t\t\t\tif s.id > highest_id\n\t\t\t\t\thighest_id = s.id\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Delete all but latest record\n\t\t\tsimilars.each do |s|\n\t\t\t\tunless s.id == highest_id\n\t\t\t\t\ts.destroy\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def next_id\n @next_id = ((start...(start + size)).to_a - leases.map { |l| l.id }).first\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def next_todo_id(todos)\n max = todos.map { |todo| todo[:id] }.max || 0\n max + 1\nend",
"def unique_id\n # check all_data instead of data, as we have to not reuse deleted key\n ids = Set.new(all_data.map { |e| e[:key] })\n id = 1\n loop do\n return id.to_s unless ids.include?(id.to_s)\n id += 1\n end\n end",
"def last_tweet_id\n return @last_tweet_id if @last_tweet_id\n\n begin\n id_str = File.read(File.expand_path('last_tweet_id.txt', @options.data_dir)).chomp\n rescue Errno::ENOENT\n return nil\n end\n\n if id_str =~ /^\\d+$/\n id = id_str.to_i\n @last_tweet_id = id\n return id\n else\n return nil\n end\n end",
"def generate_id\n id = @ids.first[:count]\n @ids.where(:id => 1).update(:count => id + 1)\n id\n end",
"def id\n biggest_fan_campaign.id\n end"
] |
[
"0.6822227",
"0.6787379",
"0.6654494",
"0.6616846",
"0.6608423",
"0.6594121",
"0.6583088",
"0.6534386",
"0.63375986",
"0.6298152",
"0.6265369",
"0.62585557",
"0.6218582",
"0.6213207",
"0.62062615",
"0.61847484",
"0.6178633",
"0.6178633",
"0.6170388",
"0.614789",
"0.6146838",
"0.61306435",
"0.60866654",
"0.60767704",
"0.60231405",
"0.59822714",
"0.5965591",
"0.5952004",
"0.5940405",
"0.59216154",
"0.5917327",
"0.59079695",
"0.5905084",
"0.59037155",
"0.5880433",
"0.58726496",
"0.5860023",
"0.5857094",
"0.5855324",
"0.5851453",
"0.58485854",
"0.5845967",
"0.58459586",
"0.58453286",
"0.58384794",
"0.58339965",
"0.58278143",
"0.5813448",
"0.58008415",
"0.5795575",
"0.57922524",
"0.5779653",
"0.5772341",
"0.57708657",
"0.57655996",
"0.5745984",
"0.5744547",
"0.57431716",
"0.57392746",
"0.57386494",
"0.5736386",
"0.5735926",
"0.57032233",
"0.57023484",
"0.5702139",
"0.5701311",
"0.56998676",
"0.5688267",
"0.5684949",
"0.568163",
"0.56702226",
"0.5667551",
"0.5660664",
"0.56595457",
"0.5656238",
"0.56485116",
"0.56485116",
"0.56485116",
"0.56406766",
"0.5637475",
"0.5636989",
"0.5632652",
"0.5632132",
"0.56316227",
"0.56295645",
"0.56228685",
"0.562165",
"0.5620377",
"0.56128114",
"0.5609019",
"0.560643",
"0.5606006",
"0.56029665",
"0.559902",
"0.5595804",
"0.55955297",
"0.55702984",
"0.556868",
"0.556703",
"0.5560231"
] |
0.5583029
|
96
|
get jobs list from json using client id and returning it
|
def get_jobs_by_client_id(client_id)
jobs = []
for job in get_data("jobs")
if client_id == job["client_id"]
jobs.push(job)
end
end
return jobs
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def multiget(*jids)\n results = JSON.parse(@client.call('multiget', *jids))\n results.map do |data|\n Job.new(@client, data)\n end\n end",
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end",
"def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end",
"def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend",
"def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend",
"def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def getExecutionsForAJob(job_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/job/' + job_id + '/executions')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\nend",
"def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def getCurrentJobs\n getJobs('0/')\n end",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end",
"def list_jobs_with_http_info(project_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QcApi.list_jobs ...\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling QcApi.list_jobs\"\n end\n # resource path\n local_var_path = \"/projects/{project_id}/jobs.json\".sub('{' + 'project_id' + '}', project_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].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 # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'JobsCollection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QcApi#list_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_task_list_by_job_id(job_id)\n list_tasks = []\n for task in get_data(\"tasks\")\n if job_id == task[\"job_id\"]\n list_tasks.push(task)\n end\n end\n\n return list_tasks\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def index\n @client_ids = Client.for_user(current_user.id).pluck(:ClientId)\n @clients = Client.where(ClientId: @client_ids).includes(:jobs)\n @hosts = current_user.hosts.not_baculized\n fetch_jobs_info\n get_charts\n end",
"def job_results(jobid)\r\n wait_on_status(jobid)\r\n puts \"Retrieving results for job [#{jobid}]\"\r\n uri = URI(\"http://api.idolondemand.com/1/job/result/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n return JSON.parse(res.body)['actions']\r\nend",
"def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end",
"def get_jobs_list(status = :all, page = 1, reload = false)\n Bitmovin::Job.list(status, page, reload)\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def listJobsForProject(project_mame)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/jobs')\n params = { 'project' => project_mame }\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n connection = Excon.new('http://build01:4440/api/1/jobs')\n return connection.get(:query => { 'project' => project_mame },:headers => {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}).body.force_encoding(\"UTF-8\")\n\nend",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def public_api_get_jobs(modified, api_key, opts = {})\n data, _status_code, _headers = public_api_get_jobs_with_http_info(modified, api_key, opts)\n return data\n end",
"def sample_list_jobs project_id, tenant_id, filter\n # [START job_search_list_jobs]\n require \"google/cloud/talent\"\n\n # Instantiate a client\n job_service = Google::Cloud::Talent.job_service\n\n # project_id = \"Your Google Cloud Project ID\"\n # tenant_id = \"Your Tenant ID (using tenancy is required)\"\n formatted_parent = job_service.tenant_path project: project_id, tenant: tenant_id\n\n # Iterate over all results.\n # filter = \"companyName=\\\"projects/my-project/companies/company-id\\\"\"\n job_service.list_jobs(parent: formatted_parent, filter: filter).each do |element|\n puts \"Job name: #{element.name}\"\n puts \"Job requisition ID: #{element.requisition_id}\"\n puts \"Job title: #{element.title}\"\n puts \"Job description: #{element.description}\"\n end\n # [END job_search_list_jobs]\nend",
"def parse_jobids response\n begin\n JSON.parse(response)['Lb_Job_List']['jobIds']\n rescue => e\n @logger.warn \"Got exception parsing response: #{e.message}\"\n @logger.debug \"Backtrace:\\n#{e.backtrace.join \"\\n\"}\"\n @logger.debug \"Response:\\n#{response}\"\n []\n end\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def jobs\n\t\t@jobs = Job.where(user_id: @company.user_id)\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def get_job(uuid, username, password)\n jobs = get_json('jobs.json', username, password)\n job = jobs['jobs'].find { |j| j['uuid'] == uuid }\n\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n\n fail \"Could not find job with UUID=#{uuid}\" unless job\n job\nend",
"def search(*args)\n\t\t\targs = args[0] if args.is_a?(Array) && args.count == 1\n\n\t \tcb_response = self.api_get(Cb.configuration.uri_job_search, :query => args)\n\t \tjson_hash = JSON.parse(cb_response.response.body)\n\n\t \tpopulate_from json_hash, \"ResponseJobSearch\"\n\n\t \tjobs = []\n\t \tjson_hash[\"ResponseJobSearch\"][\"Results\"][\"JobSearchResult\"].each do |cur_job|\n\t \t\tjobs << CbJob.new(cur_job)\n\t \tend\n\n\t \treturn jobs\n\t\tend",
"def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end",
"def list_jobs\n @glue_client.list_jobs\n rescue Aws::Glue::Errors::GlueException => e\n @logger.error(\"Glue could not list jobs: \\n#{e.message}\")\n raise\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"def list(status = :all, page = 1, reload = false)\n var_name = :\"@#{status}_list#{ page }\"\n\n val = instance_variable_get var_name\n\n return val if val && !reload\n\n get = Net::HTTP::Get.new \"/api/jobs/#{ page }/#{ status }\", initheaders = headers\n\n response = Bitmovin.http.request get\n\n json = prepare_response_json(response.body)\n \n value_to_set = json[:jobs].map { |p| Bitmovin::Job.new(p) }\n\n instance_variable_set var_name, value_to_set\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def render_jobs_list(jobs)\n workflow_with_jobs = []\n workflow_batch = {}\n\n jobs.each do |job|\n analysis = job&.analysis\n job.current_user = current_user\n workflow = analysis&.workflow\n slot = workflow_with_jobs.last\n\n if slot.nil? || slot[:analysis_dxid] != analysis&.dxid ||\n slot[:workflow]&.dxid != workflow&.dxid\n workflow_with_jobs << { analysis_dxid: analysis&.dxid,\n batch_id: analysis&.batch_id,\n workflow: workflow, jobs: [job] }\n fill_batch_with_workflows(workflow_batch, workflow, analysis)\n else\n slot[:jobs] << job\n end\n end\n\n workflow_with_jobs.map! do |slot|\n if slot[:workflow].nil?\n slot[:jobs].map do |job|\n job_serialized = JobSerializer.new(job)\n job_serialized.launched_on = job.analysis&.created_at || job.created_at\n job_serialized\n end\n else\n slot[:workflow].current_user = current_user\n\n workflow_serialized = WorkflowSerializer.new(slot[:workflow])\n number_workflows_in_batch(workflow_batch[slot[:batch_id]],\n workflow_serialized, slot[:analysis_dxid])\n workflow_serialized.jobs = slot[:jobs].map do |job|\n job_serialized = JobSerializer.new(job)\n\n launched_on = job.analysis&.created_at || job.created_at\n job_serialized.launched_on = launched_on\n if workflow_serialized.launched_on.nil? ||\n launched_on < workflow_serialized.launched_on\n workflow_serialized.launched_on = launched_on\n end\n\n job_serialized\n end\n\n workflow_serialized.launched_on ||= Time.current\n workflow_serialized\n end\n end.flatten!\n\n page_array = paginate_array(sort_array_by_fields(workflow_with_jobs))\n page_meta = pagination_meta(workflow_with_jobs.count)\n page_meta[:count] = page_meta.dig(:pagination, :total_count)\n\n render json: { jobs: page_array, meta: page_meta }, adapter: :json\n end",
"def index\n render json: {:jobs => Job.where('branch_id = ?', current_user.branch_id).order(id: :desc),\n :branch_id => current_user.branch_id }\n end",
"def get_job(job_id)\n client = IotHubApiClient.new(@options)\n res = client.get(jobs_path(job_id), @api_version_param)\n JobResponse.new(response_json(res))\n end",
"def print_jobs_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PrintJobsApi.print_jobs_list ...'\n end\n # resource path\n local_var_path = '/print-jobs/'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'created_after'] = opts[:'created_after'] if !opts[:'created_after'].nil?\n query_params[:'created_before'] = opts[:'created_before'] if !opts[:'created_before'].nil?\n query_params[:'modified_after'] = opts[:'modified_after'] if !opts[:'modified_after'].nil?\n query_params[:'modified_before'] = opts[:'modified_before'] if !opts[:'modified_before'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'exclude_line_items'] = opts[:'exclude_line_items'] if !opts[:'exclude_line_items'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].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']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PrintJobsApi#print_jobs_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n do_authorize_class(:index, AnalysisJobsItem)\n do_get_opts\n\n do_get_analysis_job\n @analysis_jobs_items, opts = Settings.api_response.response_advanced(\n api_filter_params,\n get_query,\n AnalysisJobsItem,\n AnalysisJobsItem.filter_settings(@is_system_job)\n )\n\n show_items_as_results(request.head?, @analysis_jobs_items, opts)\n end",
"def jobs\n self.ListJobs.first.map { |j| map_job(j) }\n end",
"def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end",
"def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end",
"def find_jobs(import_type)\n current_user.created_projects\n .includes(:import_state)\n .where(import_type: import_type)\n .to_json(only: [:id], methods: [:import_status])\n end",
"def list_jobs project_id:, location:\n # [START transcoder_list_jobs]\n # project_id = \"YOUR-GOOGLE-CLOUD-PROJECT\" # (e.g. \"my-project\")\n # location = \"YOUR-JOB-LOCATION\" # (e.g. \"us-central1\")\n\n # Require the Transcoder client library.\n require \"google/cloud/video/transcoder\"\n\n # Create a Transcoder client.\n client = Google::Cloud::Video::Transcoder.transcoder_service\n\n # Build the resource name of the parent.\n parent = client.location_path project: project_id, location: location\n\n # Get the list of jobs.\n response = client.list_jobs parent: parent\n\n puts \"Jobs:\"\n # Print out all jobs.\n response.each do |job|\n puts job.name\n end\n # [END transcoder_list_jobs]\nend",
"def job_items\n job_arguments(1)\n end",
"def retrieve_job\n json = Server.redis { |c| c.brpop(Server.keys[:perform_list]) }\n Job.new(JSON.parse(json.last))\n rescue => e\n raise ServerError, e.message\n end",
"def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end",
"def index\n @job_ids = Mugen::Jobs.all\n if @job_ids\n @jobs = @job_ids.collect {|j| \n Mugen::Job.find(j['job_id']).merge('comments' => Mugen::Job.comments(j['job_id']))\n }\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n else\n redirect_to mygengo_account_index_path\n end \n end",
"def jobs\n\t\t# ...\n\tend",
"def jobs\n command('.jobs').split(\"\\n\")\n end",
"def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end",
"def list_clients(json_payload={})\n conn = @client.get do |req|\n req.url \"/api/v2/client/list?\"\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def get_projects\n @params=task_params\n @client=current_user.clients.find(@params[:client_id])\n counter=0\n @res=[]\n @client.projects.each do |c|\n if c.users.include? current_user\n @res[counter]={\n project_id: c.id, \n name: c.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def public_api_get_jobs_with_http_info(modified, api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: JobsApi.public_api_get_jobs ...\"\n end\n # verify the required parameter 'modified' is set\n if @api_client.config.client_side_validation && modified.nil?\n fail ArgumentError, \"Missing the required parameter 'modified' when calling JobsApi.public_api_get_jobs\"\n end\n # verify the required parameter 'api_key' is set\n if @api_client.config.client_side_validation && api_key.nil?\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling JobsApi.public_api_get_jobs\"\n end\n # resource path\n local_var_path = \"/api/pub/v1/jobs/recent\"\n\n # query parameters\n query_params = {}\n query_params[:'modified'] = modified\n query_params[:'api_key'] = api_key\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'take'] = opts[:'take'] if !opts[:'take'].nil?\n query_params[:'salesWorkflowItemStatusId'] = opts[:'sales_workflow_item_status_id'] if !opts[:'sales_workflow_item_status_id'].nil?\n query_params[:'workflowName'] = opts[:'workflow_name'] if !opts[:'workflow_name'].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', 'text/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 => 'PublicApiGetJobListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: JobsApi#public_api_get_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def print_job_sample(client)\n response = client[\"jobs/#{$job_id}/print\"].put nil\n\n p ''\n p 'Print a job'\n p response\nend",
"def list\n puts \"\\n\\n#{Job.count} job postings found\\n\\n\"\n Job.list.map do |job|\n puts \"#{job.id}. #{job.firstline}\"\n end\n puts menu\n end",
"def index\n do_authorize_class\n do_get_opts\n\n do_get_analysis_job\n @analysis_jobs_items, opts = Settings.api_response.response_advanced(\n api_filter_params,\n get_query,\n AnalysisJobsItem,\n AnalysisJobsItem.filter_settings(@is_system_job)\n )\n\n respond_index(opts)\n end",
"def projects_for_client\n @tasksheet = Tasksheet.new\n @key = params[:id]\n #find the project based on the client id\n @projects = Project.where(client_id: \"#{params[:client][\"#{params[:id]}\"]}\").collect{ |u| [u.name, u.id] }\n end",
"def getIngest_job( job_id)\n params = Hash.new\n params['job_id'] = job_id\n return doCurl(\"get\",\"/ingest_job\",params)\n end",
"def index\n @jobs = PeriodicJob.list params[:page], current_user.row_limit\n end",
"def collect_joblist(data_path,script_path)\n \n # define list of ignored files/dirs\n to_ignore = ['.','..','.DS_Store']\n \n res = []\n \n # open dir\n directory=Dir.open(data_path)\n \n # for each file in dir\n directory.each do |d|\n \n # add if not in ignore list\n if to_ignore.index(d) == nil\n \n # get standard attributes if file exists\n std_attr = {}\n if File.exists?(File.join(data_path,d,STANDARD_ATTR_JSON))\n std_file=get_json_data(File.join(data_path,d,STANDARD_ATTR_JSON))\n \n if !std_file.nil?\n\t std_attr=std_file\n end\n \n #puts \"STDATTR:\"+std_attr.to_yaml\n end\n\t\n \n # id is always current directory\n std_attr['job_id']=d\n \n # there is a script for job info\n if File.exists?(script_path)\n#puts \"populate joblist data\"\n\n # populate data with it\n command = script_path + ' ' + File.join(data_path,d)\n job_text=`#{command}`\n\n if job_text!=''\n\n obj = ActiveSupport::JSON.decode(job_text)\n \n if !obj.empty?\n if !std_attr.empty?\n obj=obj.merge(std_attr)\n end\n # add object\n res.push(obj)\n end\n end\n\n else\n # if there is not a script, then push std_attr\n\n res.push(std_attr)\n end\n \n end\n end\n\n\n\n # close dir\n directory.close\n \n # puts \"joblist:\"+res.to_yaml\n \n return res\n end",
"def jobs(params={})\n @radius = params[:radius] if params[:radius]\n @zipcode = params[:zipcode] if params[:zipcode]\n return @jobs if (@jobs && !params[:force])\n page = params[:page] || 1\n per_page = params[:per_page] || 100\n @jobs = get_jobs(page,per_page)\n end",
"def index\n @job_requests = JobRequest.all\n end",
"def list_jobs(args)\n Morpheus::Cli::BackupJobsCommand.new.list(args)\n end",
"def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end",
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def index\n if pmg_super? || admin?\n @jobs = Job.paginate :per_page => 15, :include => [:versions, :client],\n :page => params[:page], \n :order => sort_order('created_at')\n\n elsif pmg_user?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id IN (?)', current_user.clients.map{|x| x.id}],\n :order => sort_order('job_name')\n\n elsif client_su?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id IN (?)', current_user.employer.subclients.map{|x| x.id}],\n :order => sort_order('job_name')\n\n elsif client?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id = ?', current_user.client_id],\n :order => sort_order('job_name')\n\n end\n \n # error messages\n if current_user.level == :admin\n @messages = Message.find(:all, :order => \"updated_at desc\")\n end\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @jobs.to_xml }\n end\n end",
"def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end",
"def all_jobs\n\n find_jobs()\n end",
"def index\n #@jobs = Job.all\n @jobs = Job.all(:order => 'updated_at DESC')\n #@jobs = @user.jobs.all(:order => 'updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def fetch_jobs!(cluster, jobusrid)\n if jobusrid==nil\n @logger.warn \"monitor{#@id} - At least one job or user id must be specified, aborting\"\n return\n end\n if @root == nil \n @logger.warn \"monitor{#@id} - It seems API connection was not made \"\n return\n end \n puts \"monitor{#@id} - Looking for #{jobusrid} on #{cluster}\" if $dbug \n @logger.info \"Looking for #{jobusrid} on #{cluster}\"\n (j_ids = [] << jobusrid).flatten! #Convert to array\n size= j_ids.length\n #puts \"Size : #{size} & 0 : #{j_ids[0]}\"\n s_sites = ((cluster.to_s!=\"all\") && (cluster!=nil)) ? 1 : root.sites.length\n i=0\n root.sites.each do |site|\n begin \n next unless ((site['uid']==cluster.to_s) || (cluster.to_s == \"all\") || (cluster == nil))\n i+=1\n puts \"monitor{#@id} - \" + i.to_s+\"/\"+s_sites.to_s+\" \" + site['description'] + \" connecting...\" \n @logger.info \"monitor{#@id} - \" + i.to_s+\"/\"+s_sites.to_s+\" \" + site['description'] + \" connecting...\" \n site.jobs.each do |job|\n j_ids.each do |t_id|\n if (t_id.kind_of? Integer)\n if job['uid'].to_i==t_id\n @logger.info \"monitor{#@id} - #{t_id} found on #{site['description']}\" \n puts \"#{t_id} found on #{site['description']}\" if $dbug\n @jobs << job\n updateHash(site['uid'], job['uid'])\n if size == 1 # Job id is unique\n return\n end\n end\n elsif (t_id.kind_of? String)\n if job['user'].to_s == t_id\n @logger.info \"monitor{#@id} - '#{t_id}' found on '#{site['description']}' jobid #{job['uid']}\" \n puts \"monitor{#@id} - '#{t_id}' found on '#{site['description']}' jobid #{job['uid']}\" if $dbug\n @jobs << job\n updateHash(site['uid'], job['uid'])\n end\n else\n @logger.warn \"Unknown input for #{t_id}, skipping\" \n puts \"monitor{#@id} - Unknown input for #{t_id}, skipping\"\n end\n end\n end\n rescue\n @logger.warn \"monitor{#@id} - could not connect to '#{site['description']}'\"\n puts \"monitor{#@id} - could not connect to '#{site['description']}'\"\n end\n end\n if jobs.length >0\n @logger.info \"monitor{#@id} - scan completed\"\n return\n else\n @logger.warn \"#{jobusrid} not found on #{cluster}\" \n puts \"monitor{#@id} - #{jobusrid} not found on #{cluster}\"\n return\n end\n end",
"def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def getDeadJobs\n getJobs('1/')\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def jobs_api_listings(query, location, number, from, additional_options={})\n from ||= \"0\"\n location_query = \"in #{location}\" if (!location.nil? && !location.empty?)\n params = {\n query:\n {\n query: \"#{query} jobs #{location_query}\", size: number, from: from\n }.merge(additional_options.reject{|k,v| !v.present?})\n }\n jobs_api_response = JobsApi.new.search(params)\n if jobs_api_response.code == 200\n JSON.parse(jobs_api_response.body)\n else\n []\n end\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def jobs\n return nil unless @rufus\n return @saved_job_list if !running\n\n @rufus.jobs.collect do |job|\n {\n :job => job,\n :job_spec_id => job.handler.job_spec_id,\n :job_spec_name => job.handler.job_spec_name,\n :launched_job => job.handler.launched_job,\n :running => job.running?,\n :last_time => job.last_time,\n :next_time => job.next_time,\n :opts => job.opts,\n :scheduled_at => job.scheduled_at,\n :unscheduled_at => job.unscheduled_at,\n :id => job.id,\n :tags => job.tags,\n :last_work_time => job.last_work_time,\n :mean_work_time => job.mean_work_time\n }\n end\n end",
"def find_jobs(project, jobs_dxids)\n @user_api.system_find_jobs(\n includeSubjobs: false,\n id: jobs_dxids,\n project: project,\n parentJob: nil,\n parentAnalysis: nil,\n describe: true,\n )[\"results\"]\n end",
"def jobs\n @jobs || {}\n end",
"def show\n render json: @job\n end",
"def show\n render json: @job\n end",
"def requests(job)\r\n {\r\n :list_deleted_query_rq => {\r\n :xml_attributes => { \"requestID\" =>\"1\"},\r\n :list_del_type => [\"Account\", \"Customer\", \"InventorySite\", \"ItemDiscount\", \"ItemFixedAsset\", \"ItemGroup\", \"ItemInventory\", \"ItemInventoryAssembly\", \"ItemNonInventory\", \"ItemOtherCharge\", \"ItemPayment\", \"ItemService\", \"ItemSubtotal\", \"Vendor\"],\r\n :deleted_date_range_filter => {\"from_deleted_date\" => qbwc_log_init(WorkerName), \"to_deleted_date\" => qbwc_log_end()}\r\n }\r\n }\r\n end",
"def index\n validate_arguments!\n\n options[:limit] ||= '10'\n options[:skip] ||= '0'\n jobs = api.get_jobs(options[:skip], options[:limit]).body['jobs']\n jobs.each do |job|\n if job['start_timestamp']\n job['start_timestamp'] = Time.parse(job['start_timestamp']).strftime('%A, %B %e, %Y, %l:%M %p')\n end\n end\n headers = [ 'job_id', 'script' , 'status' , 'start_date' , 'elapsed_time' , 'cluster_size' , 'cluster_id']\n columns = [ 'job_id', 'display_name', 'status_description', 'start_timestamp', 'duration', 'cluster_size', 'cluster_id']\n display_table(jobs, columns, headers)\n end",
"def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end",
"def index\n @job_managers = JobManager.where(job_id: @job.id)\n end",
"def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend",
"def index\n @distance = 3\n listers = Adult.near(current_user.lat_long, @distance, units: :km)\n @jobs = listers.map(&:jobs).flatten.uniq\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n @inventories = current_company.inventories.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml{ render :xml => @inventories }\n format.json{ render :json => @inventories }\n end\n end",
"def index\n @parts = Part.where(job_id: params[:job_id])\n @job_id = params[:job_id]\n end"
] |
[
"0.75944084",
"0.7242146",
"0.7060586",
"0.7045959",
"0.697496",
"0.6934144",
"0.687525",
"0.687062",
"0.68623453",
"0.68386525",
"0.68298477",
"0.6782991",
"0.66781485",
"0.6672076",
"0.66154945",
"0.65406626",
"0.64549214",
"0.6443678",
"0.64298946",
"0.63978434",
"0.63910764",
"0.63895315",
"0.63652796",
"0.6357485",
"0.63523495",
"0.6340368",
"0.63240844",
"0.63104886",
"0.6296671",
"0.6236296",
"0.6233932",
"0.6226156",
"0.622543",
"0.62119275",
"0.62082875",
"0.6205358",
"0.6186652",
"0.6159427",
"0.6156641",
"0.6150404",
"0.60797787",
"0.60687095",
"0.6046614",
"0.6042929",
"0.60290295",
"0.6027183",
"0.6005155",
"0.59866273",
"0.59758997",
"0.5953616",
"0.59353834",
"0.5911828",
"0.590047",
"0.5894773",
"0.58819264",
"0.58626825",
"0.58354443",
"0.5826529",
"0.5814575",
"0.5806611",
"0.5786035",
"0.5765681",
"0.5743521",
"0.57429034",
"0.5730395",
"0.57235986",
"0.5708905",
"0.5706385",
"0.56953347",
"0.5692542",
"0.56905067",
"0.56869835",
"0.5682981",
"0.5672063",
"0.5671877",
"0.5662624",
"0.5642984",
"0.5636967",
"0.5631303",
"0.56297374",
"0.5624904",
"0.56234",
"0.56231385",
"0.5620468",
"0.5609457",
"0.56082356",
"0.56051314",
"0.56009674",
"0.5589678",
"0.5567755",
"0.5558071",
"0.5558071",
"0.5556391",
"0.55551916",
"0.555079",
"0.55381495",
"0.55358243",
"0.55339414",
"0.5529629",
"0.5528709"
] |
0.81782615
|
0
|
GET /maps GET /maps.json
|
def index
f = File.open(Rails.root.join("datas","map2.yml"))
globalMap = Array.new
f.each_line {|line| globalMap << line.split(' ')}
x0 = Integer(params["x0"])
y0 = Integer(params["y0"])
width = Integer(params["width"])
height = Integer(params["height"])
x1 = x0 + width
y1 = y0 + height
@map = Array.new
@poisMap = Array.new
globalMap[y0...y1].each do |line|
lineZE = Array.new
width.times do
lineZE << 0
end
@poisMap << lineZE
@map << line[x0...x1]
end
@pois = Array.new
Poi.all.each do |poi|
if poi.x == nil
continue
end
if poi.y == nil
continue
end
if poi.x > (x0+1) && poi.x < (x1-3) && poi.y < y1 && poi.y > (y0+3)
level = Integer((poi.lvl)/5)
puts level
begin
arbres = Array.new
arbres[0] = [[202,203],[210,211],[218,219]]
arbres[1] = [[204,205],[212,213],[220,221]]
arbres[2] = [[206,207],[214,215],[222,223]]
arbres[3] = [[208,209],[216,217],[224,225]]
#@poisMap[poi.y][poi.x] = 1 + level*5
#@poisMap[poi.y][poi.x+1] = 2 + level*5
#@poisMap[poi.y-1][poi.x] = 3 + level*5
#@poisMap[poi.y-1][poi.x+1] = 4 + level*5
#@poisMap[poi.y-2][poi.x] = 5 + level*5
#@poisMap[poi.y-2][poi.x+1] = 6 + level*5
@poisMap[poi.y-1][poi.x+1] = arbres[level][0][1]
@poisMap[poi.y][poi.x] = arbres[level][0][0]
@poisMap[poi.y][poi.x+2] = arbres[level][1][1]
@poisMap[poi.y+1][poi.x+1] = arbres[level][1][0]
@poisMap[poi.y+1][poi.x+3] = arbres[level][2][1]
@poisMap[poi.y+2][poi.x+2] = arbres[level][2][0]
rescue
end
#@pois << poi
end
end
respond_to do |format|
format.json { render :json => @map }
format.xml {}
format.html {}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def search\n @maps = Map.find_map_by_input(@maps, params[:name])\n render json: @maps\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 get_mapping\n request :get, \"_mapping\"\n end",
"def get_mapping\n request :get, \"_mapping\"\n end",
"def index\n @maps = Map.all\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def show\n @locationmap = Locationmap.find(params[:id])\n @json=@locationmap.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locationmap }\n end\n end",
"def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\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 map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def show\n @map = Map.find(params[:id], :include => \"tiles\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def map\n @locations = Gig.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def map\n @locations = CyclingEvent.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n\n countries = {\n ru: 'RU',\n cs: 'CZ',\n it: 'IT',\n ko: 'SK',\n }\n\n config = params.permit(:q, :country)\n config[:locale] = I18n.locale unless I18n.locale == :en\n config[:theme] = 'wemeditate'\n config[:country] ||= countries[I18n.locale]\n @atlas_url = \"https://atlas.sydevelopers.com/map/embed.js?key=#{ENV.fetch('ATLAS_KEY')}&#{config.to_query}\"\n @atlas_enabled = ENV['ATLAS_LOCALES'].split(',').include?(I18n.locale.to_s)\n \n render layout: 'minimal'\n end",
"def map\n if params[:mapid] == 'index'\n map_data = []\n projects = Project.where(user_id: current_user.id)\n projects.each do |project|\n if project.coordinates\n project_hash = {\n path: project_path(project),\n title: project.title.titleize,\n date: DateCreator.stringify(project.date),\n coordinates: project.coordinates\n }\n map_data << project_hash\n end\n end\n respond_to do |format|\n format.json { render :json => map_data }\n end\n end\n end",
"def map\n @locations = MonzoTransaction.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def map_view\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def map\n add_breadcrumb :map\n @map_opt = {\n :zoom => 2,\n :auto_adjust => true,\n :auto_zoom => false,\n :center_on_user => true,\n :detect_location => true\n }\n @users = User.search do\n with :published, true\n fulltext params[:q] do\n fields(:bio, :name => 2.0)\n end\n order_by :id, :desc\n end.results\n\n @markers = @users.to_gmaps4rails do |user, marker|\n marker.infowindow render_to_string(:partial => \"/users/marker_template\", :locals => {:usr => user})\n marker.json({:id => user.id})\n end\n end",
"def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end",
"def maps\n paginate_params = {\n :page => params[:page],\n :per_page => 50\n }\n\n show_warped = params[:show_warped]\n unless show_warped == \"0\"\n lmaps = @layer.maps.warped.order(:map_type).paginate(paginate_params)\n else\n lmaps = @layer.maps.order(:map_type).paginate(paginate_params)\n end\n respond_to do |format|\n #format.json {render :json =>lmaps.to_json(:stat => \"ok\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail])}\n format.json {render :json =>{:stat => \"ok\",\n :current_page => lmaps.current_page,\n :per_page => lmaps.per_page,\n :total_entries => lmaps.total_entries,\n :total_pages => lmaps.total_pages,\n :items => lmaps.to_a}.to_json(:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]), :callback => params[:callback] }\n\n format.xml {render :xml => lmaps.to_xml(:root => \"maps\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]) {|xml|\n xml.tag!'total-entries', lmaps.total_entries\n xml.tag!'per-page', lmaps.per_page\n xml.tag!'current-page',lmaps.current_page} }\n end\n end",
"def map(data_version = nil)\n map = get(resource_path('map'), @version, version: data_version)\n RiotGamesApi::LOL::Model::StaticData::Map.new map\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end",
"def index\n @maps = Map.order(name: :asc)\n @title = 'Maps'\n @page_class = 'maps'\n end",
"def show\n @event = Event.find_by_url(params[:id])\n @json = Location.where(id: @event.location_id).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def locations(place)\n get :loc => place\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 show\n @map = Map.find_by_id(params[:id])\n @saved_locations = @map.points.for_editing.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end",
"def show\n #TODO\n @map = Map.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def getMapList(baseURL, mapID=nil)\n url = URI(baseURL.to_s+'maps.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n json = JSON.parse(data)\n if (mapID == nil)\n return json\n else\n json.each do |e|\n if (e['id'] == mapID) then return [ e ] end\n end\n end\n end",
"def new\n @map = current_user.maps.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def new\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @map_marker = MapMarker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map_marker }\n end\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def index\n @gmaps = Gmap.all\n end",
"def locations\n get('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 show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def map_location\n @landmark = Landmark.find(params[:id])\n @hash = Gmaps4rails.build_markers(@landmark) do |landmark, marker|\n marker.lat(landmark.latitude)\n marker.lng(landmark.longitude)\n marker.picture({\n :url => ActionController::Base.helpers.asset_path('map-icon.png'),\n :height => 36,\n :width => 36\n });\n marker.infowindow(\"<em>\" + landmark.address + \"</em>\")\n end\n render json: @hash.to_json\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def show\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_site_map }\n end\n end",
"def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end",
"def index\n # @places = Place.get_nearby_places(params[:lat], params[:lon]).paginate(:page => get_page)\n @places = Kaminari.paginate_array(Place.get_close_places(params[:lat], params[:lon], params[:radius])).page(get_page)\n render :json => \n { \n :places => @places.as_json(:lean_list => true),\n :page_info => \n { \n :page => get_page,\n :per_page => Place.per_page,\n :total_entries => @places.total_count \n }\n }\n end",
"def index\n @map = Map.find(params[:map_id])\n # @markers = Marker.all\n @markers = Marker.where(map_id: @map)\n # @map = params[:map_id]\n end",
"def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end",
"def maps\n @facilities = Facility.joins(:city).where(city_id: params[:search][:city_id])\n @facilities = @facilities.joins(:category).where(\"categories.id = ?\", params[:search][:category_id]) if params[:search][:category_id].present?\n @markers = []\n @facilities.each do |f|\n @markers << {\n lat: f.latitude,\n lng: f.longitude,\n image_url: helpers.asset_url('placemarker.png')\n }\n end\n # @markers = @facilities.map do |f|\n # {\n # lat: f.latitude,\n # lng: f.longitude,\n # image_url: helpers.asset_url('placemarker.png')\n # }\n authorize :facility, :map?\n # end\n end",
"def show_map(lat, long, path)\n map_params = {\n :settings => {:map_type => \"standard\",:region => [lat, long, 0.2, 0.2],\n :zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,\n :api_key => GOOGLE_MAPS_API_KEY},\n \n :annotations => [{\n :latitude => lat, \n :longitude => long, \n :title => Localization::Request[:address], \n :subtitle => \"I am here\",\n :url => url_for(:action => :request_rental)\n }]\n }\n MapView.create map_params\n WebView.navigate url_for :action => :request\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def map\n \tif(params[:nombre])\n\t @salas = Sala.search(params[:nombre])\n\t else\n \t@salas = Sala.all\n \tend\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @salas }\n end\n end",
"def index\n @profiles = Profile.page(params[:page]).order(:updated_at => 'DESC')\n @json = @profiles.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def index\n @places = Place\n .all\n .includes(:words)\n .order(:name)\n .paginate(page: params[:page], per_page: 50)\n .load\n\n # Set @map_places to a hash with data for the map with all places\n @map_places = map_places\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end",
"def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def index\n render json: @places\n end",
"def show\n @profile = Profile.find(params[:id])\n @json = @profile.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def show\n @admin_route = Admin::Route.find(params[:id])\n\t\t@route_markers = @admin_route.route_markers\n\t\t@markers = @admin_route.route_markers.to_gmaps4rails do |object, marker|\n\t\t\tmarker.infowindow \"<h4>#{object.name}</h4><p>#{object.city}#{' - ' unless object.quarter.blank?}#{object.quarter}</p>\"\n\t\t\t#marker.picture({:picture => view_context.image_path(\"shared/#{object.kind.parameterize}.png\"), :width => 40, :height => 40})\n\t\t\tmarker.title object.name\n\t\t\tmarker.json({:id => \"#{object.id}\"})\n\t\tend\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end",
"def show\n @place = Place.find(params[:id])\n @comment = Comment.new(place_id: @place.id)\n @json = Place.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def load_map(map_name)\n if File.file?(\"assets/maps/#{map_name}\") == true\n file = File.read(\"assets/maps/#{map_name}\")\n else \n file = File.read(\"assets/save/#{map_name}\")\n end\n\n begin\n return JSON.parse(file)\n rescue \n puts \"Error parsing the map file\"\n end\n end",
"def index\r\n markers = Marker.all\r\n render json: markers\r\n end",
"def show\n @event = Event.find(params[:id])\n @json=Event.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def new\n @map = Map.new\n @map.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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 @mapURL = map_url(@location.address)\n render :show\n end",
"def map\n @data = {}\n\n sheet = Sheet.where(:map_id => params[:map_id]).first\n\n if sheet != nil\n @data[:sheet] = sheet\n @data[:layer] = sheet.layer\n polys = sheet.polygons\n @data[:polygons] = polys.count\n @data[:addresses] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"address\").count\n @data[:colors] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"color\").count\n @data[:fixes] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"polygonfix\").count\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @data\n }\n end\n end",
"def edit\n find_map\n respond_with @map, :include => :waypoints\n end",
"def map\n @site = Site.find(params[:id])\n\n @max_lat = 0\n @max_lng = 0\n @min_lat = 0\n @min_lng = 0\n @center_lat = 0\n @center_lng = 0\n\n @markers = []\n\n render layout: \"map\"\n end",
"def show\n @reading = Reading.find(params[:id])\n @json = @reading.to_gmaps4rails\n end",
"def show\n lat = @airport.latitude_deg\n lng = @airport.longitude_deg\n \n @map_markers = Gmaps4rails.build_markers(@airport) do |airport,marker|\n marker.lat lat\n marker.lng lng\n end\n response = RestClient.get \"http://api.openweathermap.org/data/2.5/weather\", :params => {:lat => lat, :lon => lng}\n @weather = Crack::JSON.parse(response.body) \n end",
"def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end",
"def index\n @properties = Property.all\n @json = @properties.to_gmaps4rails\n end",
"def static_map(resource, options={})\n # config\n api_key = \"\"\n\n # high trafficked maps require maps to be signed by\n # Google, enable signing and add the secret to sort \n # it all out for you\n api_secret = \"\"\n signed = false\n\n # settings for this map\n location = \"#{resource.latitude},#{resource.longitude}\"\n pin_path = \"https://www.example.com.au/assets/\"\n pin = \"#{pin_path}pin.png\"\n zoom = options[:zoom] || 17\n size = options[:size] || \"470x215\"\n markers = \"\"\n markers += \"markers=icon:#{pin}%7C#{location}\"\n\n # keys and address\n url = \"https://maps.googleapis.com/maps/api/staticmap?center=#{location}&zoom=#{zoom}&size=#{size}&maptype=roadmap&#{markers}&key=#{api_key}\"\n if signed\n encoded_signature = ornament_google_signer(url, api_key, api_secret)\n url += \"&signature=#{encoded_signature}\"\n end\n\n url\n end",
"def index\n @fw_baidu_maps = current_user.baidu_maps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fw_baidu_maps }\n end\n end",
"def get_map_names\n\t\tidMapas = params[:idMaps].split(\"|\")\n\t\tmapas = DecisionMap.where(id: idMapas)\n\n\t\tcontent = []\n\n\t\tmapas.each do |mapa|\n\t\t\tcontent.push(mapa.name << ' - ' << mapa.description)\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\t# ES: Envia el texto:\n\t\t\t# EN: Send the text\n\t\t\tformat.json {render json: content}\n\t end\n\tend",
"def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end",
"def show\n @tieu_chi = TieuChi.find(params[:id])\n @truongs=Truong.all\n @map=showmap(@truongs)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tieu_chi }\n end\n end",
"def show\n @concept_map = ConceptMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@concept_map }\n end\n end",
"def show\n @spot = Spot.visible.find(params[:id])\n @json = [@spot].to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot }\n end\n end",
"def show\n @role_map = RoleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_map }\n end\n end",
"def index\n @maplocations = Maplocation.all\n end",
"def show\n @google_map = GoogleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @google_map }\n end\n end",
"def show\n @geopoint = Geopoint.find(params[:id])\n @json = @geopoint.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geopoint }\n end\n end",
"def index\n latMin = params[:latMin]\n latMax = params[:latMax]\n lngMin = params[:lngMin]\n lngMax = params[:lngMax]\n @posts = Post.where([\"latitude > ?\", latMin])\n .where([\"latitude < ?\", latMax])\n .where([\"longitude > ?\", lngMin])\n .where([\"longitude < ?\", lngMax])\n respond_to do |format|\n format.html\n @post_markers = @posts.map do |post|\n {\n time: \"#{helpers.distance_of_time_in_words(Time.current - post.created_at)} ago\",\n title: post.title,\n content: post.content,\n post_photo: post.photo.url(:small_card),\n id: post.id,\n url: post_path(post),\n latitude: post.latitude,\n longitude: post.longitude,\n user: {\n name: post.user.username,\n photo: post.user.photo\n }\n }\n end\n format.json { render json: @post_markers }\n end\n end",
"def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def show\n @character = Character.find(params[:id])\n @json = Character.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def show\n @user = User.find(params[:id])\n @map = @user.map\n end"
] |
[
"0.7427695",
"0.7178213",
"0.7178213",
"0.70878315",
"0.6988663",
"0.68295646",
"0.68295646",
"0.68179923",
"0.6803804",
"0.67981774",
"0.67656773",
"0.67599326",
"0.67171216",
"0.6691221",
"0.6691221",
"0.6672195",
"0.6645913",
"0.66430634",
"0.6585168",
"0.65780514",
"0.6532543",
"0.64530873",
"0.6449259",
"0.6367191",
"0.63468766",
"0.634169",
"0.63384145",
"0.6337812",
"0.6318006",
"0.63168585",
"0.63132787",
"0.6307494",
"0.63031965",
"0.629613",
"0.62892574",
"0.62843955",
"0.6269314",
"0.6260901",
"0.62564117",
"0.6241017",
"0.62350374",
"0.6232259",
"0.62318534",
"0.62128896",
"0.6204138",
"0.62005424",
"0.61939245",
"0.6185547",
"0.6161972",
"0.6152674",
"0.614308",
"0.6141121",
"0.61305755",
"0.61213684",
"0.6118787",
"0.61157465",
"0.61020166",
"0.6098797",
"0.6094252",
"0.60928184",
"0.60909367",
"0.60853577",
"0.6076678",
"0.606091",
"0.6059976",
"0.60542256",
"0.60345477",
"0.6034147",
"0.6008284",
"0.6004113",
"0.60031533",
"0.59960437",
"0.5985476",
"0.5978251",
"0.59776074",
"0.59733737",
"0.59675527",
"0.59557754",
"0.5955586",
"0.5950077",
"0.5949472",
"0.59472585",
"0.5945387",
"0.5943458",
"0.5939426",
"0.59353477",
"0.59345746",
"0.59338766",
"0.5921046",
"0.5918428",
"0.59081674",
"0.589738",
"0.5895472",
"0.5891797",
"0.5869383",
"0.5868789",
"0.5867866",
"0.58635783",
"0.5862994",
"0.5860207",
"0.58588827"
] |
0.0
|
-1
|
GET /maps/1 GET /maps/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def search\n @maps = Map.find_map_by_input(@maps, params[:name])\n render json: @maps\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 show\n @map = Map.find(params[:id], :include => \"tiles\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @locationmap = Locationmap.find(params[:id])\n @json=@locationmap.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locationmap }\n end\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\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 @maps = Map.all\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\n end",
"def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end",
"def show\n #TODO\n @map = Map.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\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 show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def get_mapping\n request :get, \"_mapping\"\n end",
"def get_mapping\n request :get, \"_mapping\"\n end",
"def show\n @event = Event.find_by_url(params[:id])\n @json = Location.where(id: @event.location_id).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @map = Map.find_by_id(params[:id])\n @saved_locations = @map.points.for_editing.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def map\n @locations = CyclingEvent.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def map\n @locations = Gig.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end",
"def show\n @map_marker = MapMarker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map_marker }\n end\n end",
"def map\n if params[:mapid] == 'index'\n map_data = []\n projects = Project.where(user_id: current_user.id)\n projects.each do |project|\n if project.coordinates\n project_hash = {\n path: project_path(project),\n title: project.title.titleize,\n date: DateCreator.stringify(project.date),\n coordinates: project.coordinates\n }\n map_data << project_hash\n end\n end\n respond_to do |format|\n format.json { render :json => map_data }\n end\n end\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 new\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n\n countries = {\n ru: 'RU',\n cs: 'CZ',\n it: 'IT',\n ko: 'SK',\n }\n\n config = params.permit(:q, :country)\n config[:locale] = I18n.locale unless I18n.locale == :en\n config[:theme] = 'wemeditate'\n config[:country] ||= countries[I18n.locale]\n @atlas_url = \"https://atlas.sydevelopers.com/map/embed.js?key=#{ENV.fetch('ATLAS_KEY')}&#{config.to_query}\"\n @atlas_enabled = ENV['ATLAS_LOCALES'].split(',').include?(I18n.locale.to_s)\n \n render layout: 'minimal'\n end",
"def show\n @domain_map = DomainMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def map\n @locations = MonzoTransaction.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def show\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_site_map }\n end\n end",
"def map_view\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end",
"def index\n @maps = Map.order(name: :asc)\n @title = 'Maps'\n @page_class = 'maps'\n end",
"def new\n @map = current_user.maps.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def geo(id)\n get \"/geo/id/#{id}.json\"\n end",
"def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end",
"def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def show\n @place = Place.find(params[:id])\n @comment = Comment.new(place_id: @place.id)\n @json = Place.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def index\n @map = Map.find(params[:map_id])\n # @markers = Marker.all\n @markers = Marker.where(map_id: @map)\n # @map = params[:map_id]\n end",
"def getMapList(baseURL, mapID=nil)\n url = URI(baseURL.to_s+'maps.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n json = JSON.parse(data)\n if (mapID == nil)\n return json\n else\n json.each do |e|\n if (e['id'] == mapID) then return [ e ] end\n end\n end\n end",
"def show\n @maps = MapsService.new\n @listing.depart_maps_id = @maps.get_address(@listing.depart_maps_id)\n @listing.dest_maps_id = @maps.get_address(@listing.dest_maps_id)\n end",
"def show\n @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @map_state }\n end\n end",
"def maps\n paginate_params = {\n :page => params[:page],\n :per_page => 50\n }\n\n show_warped = params[:show_warped]\n unless show_warped == \"0\"\n lmaps = @layer.maps.warped.order(:map_type).paginate(paginate_params)\n else\n lmaps = @layer.maps.order(:map_type).paginate(paginate_params)\n end\n respond_to do |format|\n #format.json {render :json =>lmaps.to_json(:stat => \"ok\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail])}\n format.json {render :json =>{:stat => \"ok\",\n :current_page => lmaps.current_page,\n :per_page => lmaps.per_page,\n :total_entries => lmaps.total_entries,\n :total_pages => lmaps.total_pages,\n :items => lmaps.to_a}.to_json(:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]), :callback => params[:callback] }\n\n format.xml {render :xml => lmaps.to_xml(:root => \"maps\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]) {|xml|\n xml.tag!'total-entries', lmaps.total_entries\n xml.tag!'per-page', lmaps.per_page\n xml.tag!'current-page',lmaps.current_page} }\n end\n end",
"def show_map(lat, long, path)\n map_params = {\n :settings => {:map_type => \"standard\",:region => [lat, long, 0.2, 0.2],\n :zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,\n :api_key => GOOGLE_MAPS_API_KEY},\n \n :annotations => [{\n :latitude => lat, \n :longitude => long, \n :title => Localization::Request[:address], \n :subtitle => \"I am here\",\n :url => url_for(:action => :request_rental)\n }]\n }\n MapView.create map_params\n WebView.navigate url_for :action => :request\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def map\n add_breadcrumb :map\n @map_opt = {\n :zoom => 2,\n :auto_adjust => true,\n :auto_zoom => false,\n :center_on_user => true,\n :detect_location => true\n }\n @users = User.search do\n with :published, true\n fulltext params[:q] do\n fields(:bio, :name => 2.0)\n end\n order_by :id, :desc\n end.results\n\n @markers = @users.to_gmaps4rails do |user, marker|\n marker.infowindow render_to_string(:partial => \"/users/marker_template\", :locals => {:usr => user})\n marker.json({:id => user.id})\n end\n end",
"def locations(place)\n get :loc => place\n end",
"def show\n @google_map = GoogleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @google_map }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n @json = @profile.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end",
"def show\n @event = Event.find(params[:id])\n @json=Event.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def map(data_version = nil)\n map = get(resource_path('map'), @version, version: data_version)\n RiotGamesApi::LOL::Model::StaticData::Map.new map\n end",
"def show\n @geopoint = Geopoint.find(params[:id])\n @json = @geopoint.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geopoint }\n end\n end",
"def show\n @admin_route = Admin::Route.find(params[:id])\n\t\t@route_markers = @admin_route.route_markers\n\t\t@markers = @admin_route.route_markers.to_gmaps4rails do |object, marker|\n\t\t\tmarker.infowindow \"<h4>#{object.name}</h4><p>#{object.city}#{' - ' unless object.quarter.blank?}#{object.quarter}</p>\"\n\t\t\t#marker.picture({:picture => view_context.image_path(\"shared/#{object.kind.parameterize}.png\"), :width => 40, :height => 40})\n\t\t\tmarker.title object.name\n\t\t\tmarker.json({:id => \"#{object.id}\"})\n\t\tend\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end",
"def index\n @gmaps = Gmap.all\n end",
"def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end",
"def map_location\n @landmark = Landmark.find(params[:id])\n @hash = Gmaps4rails.build_markers(@landmark) do |landmark, marker|\n marker.lat(landmark.latitude)\n marker.lng(landmark.longitude)\n marker.picture({\n :url => ActionController::Base.helpers.asset_path('map-icon.png'),\n :height => 36,\n :width => 36\n });\n marker.infowindow(\"<em>\" + landmark.address + \"</em>\")\n end\n render json: @hash.to_json\n end",
"def show\n @mapURL = map_url(@location.address)\n render :show\n end",
"def find(id)\n new(GeoIQ.get(\"/maps/#{id}.json\"))\n end",
"def show\n\th = Hostmap.new()\n\t@map = h.map_single(params[:id])\n end",
"def show\n @concept_map = ConceptMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@concept_map }\n end\n end",
"def show\n @reading = Reading.find(params[:id])\n @json = @reading.to_gmaps4rails\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def show\n @map = Map.find(@marker.map_id)\n end",
"def show\n @event = Event.find(params[:id])\n @json = Event.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def show\n @character = Character.find(params[:id])\n @json = Character.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end",
"def show\n @spot = Spot.visible.find(params[:id])\n @json = [@spot].to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot }\n end\n end",
"def index\n @profiles = Profile.page(params[:page]).order(:updated_at => 'DESC')\n @json = @profiles.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def show\n lat = @airport.latitude_deg\n lng = @airport.longitude_deg\n \n @map_markers = Gmaps4rails.build_markers(@airport) do |airport,marker|\n marker.lat lat\n marker.lng lng\n end\n response = RestClient.get \"http://api.openweathermap.org/data/2.5/weather\", :params => {:lat => lat, :lon => lng}\n @weather = Crack::JSON.parse(response.body) \n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def new\n @map = Map.new\n @map.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @shiftmap = Shiftmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shiftmap }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n map_type = GMapType::G_HYBRID_MAP\n coords = @provider.locations.first.fetch_coordinates()\n @map = GMap.new(\"map\")\n @map.control_init(:large_map => true, :map_type => true, :street_view_control => true)\n @map.center_zoom_init(coords,14)\n @map.overlay_init(GMarker.new(coords,:title => \"#{@provider.full_name}\", :info_window => \"Provider Location\"))\n @map.set_map_type_init(map_type)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider }\n format.json { }\n end\n end",
"def edit\n find_map\n respond_with @map, :include => :waypoints\n end",
"def get(geo_place)\n url = \"http://geocode-maps.yandex.ru/1.x/?format=json&geocode=#{URI.escape( geo_place )}&key=#{@api_key}\" \n #url = \"http://geocode-maps.yandex.ru/1.x/?format=json\" \n @json = open(url).read\n end",
"def index\n render json: @places\n end",
"def show\n @fw_baidu_map = current_user.baidu_maps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fw_baidu_map }\n end\n end",
"def load_map(map_name)\n if File.file?(\"assets/maps/#{map_name}\") == true\n file = File.read(\"assets/maps/#{map_name}\")\n else \n file = File.read(\"assets/save/#{map_name}\")\n end\n\n begin\n return JSON.parse(file)\n rescue \n puts \"Error parsing the map file\"\n end\n end",
"def index\n\n current_location = Image.nearby( 0.2, 121.52847610518472, 25.04476753094792).first\n @hash = Gmaps4rails.build_markers(current_location) do |location, marker|\n marker.lat 25.04476753094792\n marker.lng 121.52847610518472\n end\n\n end",
"def map\n @site = Site.find(params[:id])\n\n @max_lat = 0\n @max_lng = 0\n @min_lat = 0\n @min_lng = 0\n @center_lat = 0\n @center_lng = 0\n\n @markers = []\n\n render layout: \"map\"\n end",
"def show\n @maps_json = @event.to_gmaps4rails do |event, marker|\n marker.title event.name \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n #@location = Location.find(params[:id])\n @user=User.find_by_id(params[:user_id])\n @location = Location.find_by_id(params[:id])\n a = @location.address \n \n \n @array_rest = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_amusementpark_camp= Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_shopping = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n\n @json = @array_rest.to_json\n #@json = array_rest.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n \n end \n \n end",
"def map\n \tif(params[:nombre])\n\t @salas = Sala.search(params[:nombre])\n\t else\n \t@salas = Sala.all\n \tend\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @salas }\n end\n end",
"def locations\n get('locations')\n end",
"def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.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 @tieu_chi = TieuChi.find(params[:id])\n @truongs=Truong.all\n @map=showmap(@truongs)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tieu_chi }\n end\n end",
"def show\n @role_map = RoleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_map }\n end\n end"
] |
[
"0.73820543",
"0.73820543",
"0.7327266",
"0.70087975",
"0.69374716",
"0.6908471",
"0.68881756",
"0.68755263",
"0.68641496",
"0.6743594",
"0.66934305",
"0.6665792",
"0.6614371",
"0.658524",
"0.6571455",
"0.6547247",
"0.6526637",
"0.6526637",
"0.6526531",
"0.64916086",
"0.64783365",
"0.6476252",
"0.64652455",
"0.6450052",
"0.64164853",
"0.64076245",
"0.6401159",
"0.6389396",
"0.6379183",
"0.6379141",
"0.6379141",
"0.6376814",
"0.6376548",
"0.63315576",
"0.6313001",
"0.6303573",
"0.62958544",
"0.62901884",
"0.6278686",
"0.6276942",
"0.62747586",
"0.6273604",
"0.62708074",
"0.62551713",
"0.6247658",
"0.62464845",
"0.6244821",
"0.6235191",
"0.6229065",
"0.6226852",
"0.62232816",
"0.6221991",
"0.62219626",
"0.62209576",
"0.621868",
"0.6215513",
"0.62141174",
"0.62109464",
"0.6201778",
"0.6200736",
"0.61971426",
"0.61897206",
"0.61887884",
"0.61865854",
"0.61836475",
"0.6170396",
"0.6167824",
"0.6158462",
"0.6155591",
"0.6146921",
"0.61450523",
"0.61408347",
"0.6127649",
"0.6116848",
"0.61092997",
"0.6107846",
"0.6101102",
"0.60794634",
"0.60755014",
"0.6062759",
"0.6058319",
"0.6047762",
"0.60410273",
"0.60336775",
"0.60330373",
"0.60300565",
"0.60169846",
"0.6008028",
"0.5998598",
"0.598893",
"0.59841025",
"0.59831274",
"0.5981605",
"0.5974835",
"0.5972989",
"0.5956118",
"0.5955888",
"0.5946092",
"0.5943428",
"0.5922381",
"0.59206885"
] |
0.0
|
-1
|
POST /maps POST /maps.json
|
def create
@map = Map.new(map_params)
respond_to do |format|
if @map.save
format.html { redirect_to @map, notice: 'Map was successfully created.' }
format.json { render action: 'show', status: :created, location: @map }
else
format.html { render action: 'new' }
format.json { render json: @map.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n else\n format.html { redirect_to maps_url }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n map = Map.new;\n map.user_id = session[:user]['id']\n map.name = params['name']\n map.map_json = params['map_json']\n\n if map.save\n render json: {save: true, message: 'zapisano poprawnie mapę', callback: 'map'}\n else\n render json: {save: false, message: 'błąd podczas zapisu mapy', callback: 'map'}\n end\n end",
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @map.mapable, notice: 'Map added!' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = current_user.maps.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.name = \"Map Created #{Time.now.strftime('at %I:%M%p')}\" if @map.name.blank?\n @map.description = \"No Description Provided\" if @map.description.blank?\n if points = params['markers']\n points.each do |marker_identifier, point|\n @map.points.build(:lat => point['lat'].to_f,:lng => point['lng'].to_f,:description =>point['description'], :marker_identifier => marker_identifier)\n end\n end\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n #FIXME check\n @map = Map.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n format.xml { render :xml => @map, :status => :created, :location => @map }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @map = @kanzume.maps.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id), notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id) }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @world_map = WorldMap.new(params[:world_map])\n\n respond_to do |format|\n if @world_map.save\n\n format.html { redirect_to @world_map, notice: 'World map was successfully created.' }\n format.json { render json: @world_map, status: :created, location: @world_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @world_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_params\n params.require(:map).permit(:address, :latitude, :longitude, :kanzume_id)\n end",
"def create\n @locationmap = Locationmap.new(params[:locationmap])\n\n respond_to do |format|\n if @locationmap.save\n format.html { redirect_to @locationmap, notice: 'Locationmap was successfully created.' }\n format.json { render json: @locationmap, status: :created, location: @locationmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @locationmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_params\n params.require(:map).permit(:latitude, :longitude, :name, :formatted_address, :formatted_phone_number, :rating, :url, :website, :map_ref, :photos_url)\n end",
"def create\n @moretinymap = Moretinymap.new(params[:moretinymap])\n\n respond_to do |format|\n if @moretinymap.save\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully created.' }\n format.json { render json: @moretinymap, status: :created, location: @moretinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usermap = Usermap.new(usermap_params)\n\n respond_to do |format|\n if @usermap.save\n format.html { redirect_to @usermap, notice: 'Usermap was successfully created.' }\n format.json { render :show, status: :created, location: @usermap }\n else\n format.html { render :new }\n format.json { render json: @usermap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_params\n params.require(:map).permit(:engineer_id, :instrument_id, :operation_id, :status_id)\n end",
"def new\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def create\n @location_url_map = LocationUrlMap.new(params[:location_url_map])\n\n respond_to do |format|\n if @location_url_map.save\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully created.' }\n format.json { render json: @location_url_map, status: :created, location: @location_url_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(map_params)\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sasmap = Sasmap.new(params[:sasmap])\n\n respond_to do |format|\n if @sasmap.save\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully created.' }\n format.json { render json: @sasmap, status: :created, location: @sasmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_params\n params.require(:map).permit(:title, :subtitle, :meta_data, :file, :state, :kind)\n end",
"def create\n @smallmap = Smallmap.new(params[:smallmap])\n\n respond_to do |format|\n if @smallmap.save\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully created.' }\n format.json { render json: @smallmap, status: :created, location: @smallmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @process_map = ProcessMap.new(process_map_params)\n\n respond_to do |format|\n if @process_map.save\n format.html { redirect_to process_maps_path, notice: 'Process map was successfully created.' }\n format.json { render :show, status: :created, location: @process_map }\n else\n format.html { render :new }\n format.json { render json: @process_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n\n countries = {\n ru: 'RU',\n cs: 'CZ',\n it: 'IT',\n ko: 'SK',\n }\n\n config = params.permit(:q, :country)\n config[:locale] = I18n.locale unless I18n.locale == :en\n config[:theme] = 'wemeditate'\n config[:country] ||= countries[I18n.locale]\n @atlas_url = \"https://atlas.sydevelopers.com/map/embed.js?key=#{ENV.fetch('ATLAS_KEY')}&#{config.to_query}\"\n @atlas_enabled = ENV['ATLAS_LOCALES'].split(',').include?(I18n.locale.to_s)\n \n render layout: 'minimal'\n end",
"def create\n @empathy_map = EmpathyMap.find_or_create_by(id: empathy_map_record_params[:empathy_map_id])\n @empathy_map_record = EmpathyMapRecord.new(empathy_map_record_params.merge(empathy_map_id: @empathy_map.id))\n\n respond_to do |format|\n if @empathy_map_record.save\n format.html { redirect_to @empathy_map_record, notice: 'Empathy map record was successfully created.' }\n format.json { render :show, status: :created, location: @empathy_map_record }\n else\n format.html { render :new }\n format.json { render json: @empathy_map_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @map = current_user.maps.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def create\n @estate_map = EstateMap.new(estate_map_params)\n\n respond_to do |format|\n if @estate_map.save\n format.html { redirect_to @estate_map, notice: 'Estate map was successfully created.' }\n format.json { render :show, status: :created, location: @estate_map }\n else\n format.html { render :new }\n format.json { render json: @estate_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place.user = current_user\n\n @select_markers = return_markers\n\n puts params[:map_marker]\n\n\n respond_to do |format|\n if @place.save\n Log.logit!(:places, :notice, \"User created place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_params\n params[:map]\n end",
"def create\n @map = CampaignMap.new(map_params)\n if is_dungeon_master?\n @map.campaign = @campaign\n if @map.save\n render json: @map, status: :created\n else\n render json: @map.errors, status: :unprocessable_entity\n end\n else\n render json: @map.errors, status: :forbidden\n end\n end",
"def save(params)\n @map = params[:id] ? Map.find(params[:id]) : Map.new(params[:map])\n \n if params[:id]\n expire_page :action=>'show', :id=>params[:id], :format=>'json'\n end\n\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.json { render :json => @map }\n else\n format.json { render :json => @map.errors }\n end\n end\n end",
"def create\n @post_code_electorate_map = PostCodeElectorateMap.new(post_code_electorate_map_params)\n\n respond_to do |format|\n if @post_code_electorate_map.save\n format.html { redirect_to @post_code_electorate_map, notice: 'Post code electorate map was successfully created.' }\n format.json { render :show, status: :created, location: @post_code_electorate_map }\n else\n format.html { render :new }\n format.json { render json: @post_code_electorate_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search\n @maps = Map.find_map_by_input(@maps, params[:name])\n render json: @maps\n end",
"def new\n @map = Map.new\n\n puts @saved_locations\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def create\n @mosttinymap = Mosttinymap.new(params[:mosttinymap])\n\n respond_to do |format|\n if @mosttinymap.save\n format.html { redirect_to @mosttinymap, notice: 'Mosttinymap was successfully created.' }\n format.json { render json: @mosttinymap, status: :created, location: @mosttinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maplocation = Maplocation.new(maplocation_params)\n\n respond_to do |format|\n if @maplocation.save\n format.html { redirect_to @maplocation, notice: 'Maplocation was successfully created.' }\n format.json { render :show, status: :created, location: @maplocation }\n else\n format.html { render :new }\n format.json { render json: @maplocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map\n if params[:mapid] == 'index'\n map_data = []\n projects = Project.where(user_id: current_user.id)\n projects.each do |project|\n if project.coordinates\n project_hash = {\n path: project_path(project),\n title: project.title.titleize,\n date: DateCreator.stringify(project.date),\n coordinates: project.coordinates\n }\n map_data << project_hash\n end\n end\n respond_to do |format|\n format.json { render :json => map_data }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @gmap = Gmap.new(params[:gmap])\n\n respond_to do |format|\n if @gmap.save\n format.html { redirect_to @gmap, notice: 'Gmap was successfully created.' }\n format.json { render json: @gmap, status: :created, location: @gmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @map = Map.new\n @map.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def create\n #@map = Map.new(params[:map])\n if !params[:type].nil?\n #update the map info: height and width\n @map = Map.find(params[:map_id])\n height_scale = (params[:height]).to_f/@map.height\n width_scale = (params[:width]).to_f/@map.width\n respond_to do |format|\n if @map.update_attributes(height: params[:height], width: params[:width])\n format.html { redirect_to @map, notice: 'Node was successfull y updated.' }\n format.json { render json: @map, status: :created, location: @map }\n #update the node info when the map info changed...\n @map.nodes.each do |node|\n new_x = node.x * width_scale\n new_y = node.y * height_scale\n node.update_attributes(x: new_x, y:new_y)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n else\n @map = Map.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def map\n @locations = CyclingEvent.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def map(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/map\", options: params.compact)\n end",
"def create\n @mind_map = MindMap.new(mind_map_params)\n @mind_map.user_id = current_user.id \n if @mind_map.save\n render :show, status: :created\n else\n render json: @mind_map.errors, status: :unprocessable_entity\n end\n end",
"def map\n @locations = MonzoTransaction.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def create\n @roadmap = Roadmap.new(roadmap_params)\n\n respond_to do |format|\n if @roadmap.save\n format.html { redirect_to @roadmap, notice: 'Roadmap wurde erfolgreich angelegt' }\n format.json { render :show, status: :created, location: @roadmap }\n else\n format.html { render :new }\n format.json { render json: @roadmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map\n @data = {}\n\n sheet = Sheet.where(:map_id => params[:map_id]).first\n\n if sheet != nil\n @data[:sheet] = sheet\n @data[:layer] = sheet.layer\n polys = sheet.polygons\n @data[:polygons] = polys.count\n @data[:addresses] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"address\").count\n @data[:colors] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"color\").count\n @data[:fixes] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"polygonfix\").count\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @data\n }\n end\n end",
"def usermap_params\n params.require(:usermap).permit(:title, :description, :address, :latitude, :longitude)\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 create\n @map_node = Map::Node.new(params[:map_node])\n\n respond_to do |format|\n if @map_node.save\n format.html { redirect_to @map_node, notice: 'Node was successfully created.' }\n format.json { render json: @map_node, status: :created, location: @map_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @system_site_map = SystemSiteMap.new(params[:system_site_map])\n\n respond_to do |format|\n if @system_site_map.save\n format.html { redirect_to @system_site_map, notice: 'System site map was successfully created.' }\n format.json { render json: @system_site_map, status: :created, location: @system_site_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @system_site_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end",
"def create\n @google_map = GoogleMap.new(params[:google_map])\n\n respond_to do |format|\n if @google_map.save\n format.html { redirect_to(@google_map, :notice => 'Google map was successfully created.') }\n format.xml { render :xml => @google_map, :status => :created, :location => @google_map }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @google_map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mapuser = Mapuser.new(mapuser_params)\n\n respond_to do |format|\n if @mapuser.save\n format.html { redirect_to @mapuser, notice: 'Mapuser was successfully created.' }\n format.json { render :show, status: :created, location: @mapuser }\n else\n format.html { render :new }\n format.json { render json: @mapuser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maplocation_params\n params.require(:maplocation).permit(:address, :latitude, :longitude)\n end",
"def update\n @map = Map.find_by_id(params[:id])\n new_points = []\n if points = params['markers']\n points.each do |marker_identifier,point|\n new_points << @map.points.build(:marker_identifier => marker_identifier, :lat => point['lat'], :lng => point['lng'],:description =>point['description'])\n end\n end\n @map.points = new_points \n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to(@map, :notice => 'Map was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def map_upload\n unless params[:uploaded_map].blank?\n require 'fileutils'\n\n # Ensure public/maps exists\n FileUtils::mkdir_p \"public/maps\"\n\n directory = \"public/maps.tmp\"\n # Ensure a blank maps.tmp directory exists\n FileUtils.rm_rf directory\n FileUtils::mkdir_p directory\n\n # Copy the existing maps into that directory\n # (to support the case where the user is updating maps and doesn't specify\n # all of the existing maps.)\n FileUtils.cp_r 'public/maps/.', directory\n\n # Copy uploaded files to maps.tmp, overriding any old maps that were\n # just copied in the line above.\n params[:uploaded_map].each do |map|\n path = File.join(directory, \"floor\" + map[0].to_s + \".svg\")\n File.open(path, \"wb\") { |f| f.write(map[1].read) }\n end\n\n notice = \"Maps were successfully uploaded.\"\n $MAP_DATE = Time.now.to_i\n else\n error = \"Error uploading SVG map\"\n end # unless uploaded_map.blank?\n\n respond_to do |format|\n format.html {\n redirect_to action: \"index\",\n error: error,\n notice: notice\n }\n end\n end",
"def map_view\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def create\n @map_state = MapState.new(params[:map_state])\n\n respond_to do |format|\n if @map_state.save\n format.html { redirect_to @map_state, :notice => 'Map state was successfully created.' }\n format.json { render :json => @map_state, :status => :created, :location => @map_state }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @audio_map = AudioMap.new(audio_map_params)\n\n respond_to do |format|\n if @audio_map.save\n format.html { redirect_to @audio_map, notice: 'Audio map was successfully created.' }\n format.json { render :show, status: :created, location: @audio_map }\n else\n format.html { render :new }\n format.json { render json: @audio_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @indication_generic_map = IndicationGenericMap.new(indication_generic_map_params)\n\n respond_to do |format|\n if @indication_generic_map.save\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully created.' }\n format.json { render :show, status: :created, location: @indication_generic_map }\n else\n format.html { render :new }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gmap = Gmap.new(gmap_params)\n\n respond_to do |format|\n if @gmap.save\n format.html { redirect_to @gmap, notice: 'Gmap was successfully created.' }\n format.json { render :show, status: :created, location: @gmap }\n else\n format.html { render :new }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shiftmap = Shiftmap.new(params[:shiftmap])\n\n respond_to do |format|\n if @shiftmap.save\n format.html { redirect_to @shiftmap, notice: 'Shiftmap was successfully created.' }\n format.json { render json: @shiftmap, status: :created, location: @shiftmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shiftmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_student = MapStudent.new(map_student_params)\n\n respond_to do |format|\n if @map_student.save\n format.html { redirect_to @map_student, notice: 'Map student was successfully created.' }\n format.json { render :show, status: :created, location: @map_student }\n else\n format.html { render :new }\n format.json { render json: @map_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role_map = RoleMap.new(params[:role_map])\n\n respond_to do |format|\n if @role_map.save\n format.html { redirect_to @role_map, notice: 'Role map was successfully created.' }\n format.json { render json: @role_map, status: :created, location: @role_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n get_map\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n @config = params.permit(:q, :latitude, :longitude, :type, :west, :east, :south, :north)\n @config[:theme] = 'wemeditate'\n render layout: 'minimal'\n end",
"def new\n @map = Map.find(params[:map_id])\n\n #@node = Node.new\n @node = @map.nodes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map\n @locations = Gig.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def create\n \n @marker = Marker.new(marker_params)\n @map = Map.find(@marker.map_id)\n @markers = Marker.where(map_id: @map)\n gon.place_id = params[:place_id]\n respond_to do |format|\n if @marker.save\n format.html { redirect_to map_url }\n format.js\n format.json { render action: 'show', status: :created, location: @markers }\n else\n format.html { render action: 'new' }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location_mapping = LocationMapping.new(location_mapping_params)\n\n respond_to do |format|\n if @location_mapping.save\n format.html { redirect_to @location_mapping, notice: 'Location mapping was successfully created.' }\n format.json { render :show, status: :created, location: @location_mapping }\n else\n format.html { render :new }\n format.json { render json: @location_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def create\n @map_marker = MapMarker.new(params[:map_marker])\n @map_marker.group_map_id = params[:group_map_id]\n\n respond_to do |format|\n if @map_marker.save\n format.html { redirect_to @map_marker, notice: 'Map marker was successfully created.' }\n format.json { render json: @map_marker, status: :created, location: @map_marker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def v1_map_params\n params.require(:v1_map).permit(:title, :slug, :description)\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def new\n @sasmap = Sasmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def create\n @category_map = CategoryMap.new(category_map_params)\n\n respond_to do |format|\n if @category_map.save\n format.html { redirect_to @category_map, notice: 'Category map was successfully created.' }\n format.json { render :show, status: :created, location: @category_map }\n else\n format.html { render :new }\n format.json { render json: @category_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mapuser_params\n params.require(:mapuser).permit(:title, :description, :address, :latitude, :longitude)\n end",
"def create\n @my_map = current_my_map\n place = Place.find(params[:place_id])\n @way_point = @my_map.add_place(place.id)\n\n respond_to do |format|\n if @way_point.save\n format.html { redirect_to @way_point.my_map, notice: 'マイマップに追加しました。' }\n format.json { render action: 'show', status: :created, location: @way_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end",
"def create\n @artwork_image_map = ArtworkImageMap.new(artwork_image_map_params)\n\n respond_to do |format|\n if @artwork_image_map.save\n format.html { redirect_to @artwork_image_map, notice: 'Artwork image map was successfully created.' }\n format.json { render :show, status: :created, location: @artwork_image_map }\n else\n format.html { render :new }\n format.json { render json: @artwork_image_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #TODO\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def test_post_invalid\n header 'Content-Type', 'application/json'\n\n json = JSON.generate [{ latitude: 'wrong', longitude: 'wrong' }]\n post('/traces', json, 'CONTENT_TYPE': 'application/json')\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 index\n @maps = Map.all\n end",
"def new\n @moretinymap = Moretinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moretinymap }\n end\n end",
"def create\n @mapimage = Mapimage.new(mapimage_params)\n\n respond_to do |format|\n if @mapimage.save\n format.html { redirect_to @mapimage, notice: 'Mapimage was successfully created.' }\n format.json { render :show, status: :created, location: @mapimage }\n else\n format.html { render :new }\n format.json { render json: @mapimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @csv_map = CsvMap.new(csv_map_params)\n\n respond_to do |format|\n if @csv_map.save\n format.html { redirect_to @csv_map, notice: 'Csv map was successfully created.' }\n format.json { render :show, status: :created, location: @csv_map }\n else\n format.html { render :new }\n format.json { render json: @csv_map.errors, status: :unprocessable_entity }\n end\n end\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 new\n @map_marker = MapMarker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_marker }\n end\n end"
] |
[
"0.7212553",
"0.7138659",
"0.6951056",
"0.6834763",
"0.6787495",
"0.6705789",
"0.6688713",
"0.66695493",
"0.64213216",
"0.6291679",
"0.62671787",
"0.626585",
"0.6244168",
"0.6213005",
"0.617959",
"0.6146989",
"0.61075234",
"0.60626465",
"0.60482705",
"0.6043759",
"0.60301626",
"0.60063803",
"0.60024863",
"0.5999697",
"0.59671646",
"0.5946937",
"0.5907336",
"0.59002614",
"0.5881994",
"0.58475226",
"0.581854",
"0.58066773",
"0.57937866",
"0.5786396",
"0.5775565",
"0.57631576",
"0.57625955",
"0.5739605",
"0.5730623",
"0.5726661",
"0.5721849",
"0.57186973",
"0.57175165",
"0.57064915",
"0.57042164",
"0.57042164",
"0.5693797",
"0.5691213",
"0.5682549",
"0.5672901",
"0.56709594",
"0.5660241",
"0.56456715",
"0.5640766",
"0.5636874",
"0.5632042",
"0.56290406",
"0.5627977",
"0.5615819",
"0.5607276",
"0.559419",
"0.559314",
"0.55918425",
"0.55792505",
"0.5574873",
"0.5552129",
"0.5540938",
"0.55252045",
"0.552086",
"0.55191994",
"0.55147856",
"0.5508625",
"0.54894",
"0.5480972",
"0.54792875",
"0.5472989",
"0.5472227",
"0.5470659",
"0.54701173",
"0.5465456",
"0.5458091",
"0.54561657",
"0.5451399",
"0.5451399",
"0.5451399",
"0.54471886",
"0.5446603",
"0.54444456",
"0.5436239",
"0.54301775",
"0.5414732",
"0.5413635",
"0.5403999",
"0.54036474",
"0.54005986",
"0.5388984",
"0.53735846",
"0.5360707",
"0.53598493",
"0.53591657"
] |
0.69105744
|
3
|
PATCH/PUT /maps/1 PATCH/PUT /maps/1.json
|
def update
respond_to do |format|
if @map.update(map_params)
format.html { redirect_to @map, notice: 'Map was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @map.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n get_map\n\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #TODO cool2\n @map = Map.find(params[:id])\n\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to(@map, :notice => 'Map was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map = Map.find_by_id(params[:id])\n new_points = []\n if points = params['markers']\n points.each do |marker_identifier,point|\n new_points << @map.points.build(:marker_identifier => marker_identifier, :lat => point['lat'], :lng => point['lng'],:description =>point['description'])\n end\n end\n @map.points = new_points \n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to(@map, :notice => 'Map was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n if @smallmap.update_attributes(params[:smallmap])\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @locationmap = Locationmap.find(params[:id])\n\n respond_to do |format|\n if @locationmap.update_attributes(params[:locationmap])\n format.html { redirect_to @locationmap, notice: 'Locationmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @locationmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map = Map.find(params[:id])\n\n respond_to do |format|\n #if @map.update_attributes(params[:map])\n if @map.update_attributes(height: params[:height], width: params[:width])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id), notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id) }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n if @location_url_map.update_attributes(params[:location_url_map])\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @map.update(map_params)\n redirect_to @map, notice: 'Map was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def update\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n if @tinymap.update_attributes(params[:tinymap])\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n if @gmap.update_attributes(params[:gmap])\n format.html { redirect_to @gmap, notice: 'Gmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n find_map\n respond_with @map, :include => :waypoints\n end",
"def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n if @sasmap.update_attributes(params[:sasmap])\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map_marker = MapMarker.find(params[:id])\n\n respond_to do |format|\n if @map_marker.update_attributes(params[:map_marker])\n format.html { redirect_to @map_marker, notice: 'Map marker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map_marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update\n if is_dungeon_master?\n if @map.update(map_params)\n head :no_content\n else\n render json: @map.errors, status: :unprocessable_entity\n end\n else\n render json: @map.errors, status: :forbidden\n end\n end",
"def update\n if @mind_map.update(mind_map_params)\n render :show, status: :ok\n else\n render json: @mind_map.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group_map.update_attributes(params[:group_map])\n format.html { redirect_to @group_map, notice: 'Group map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moretinymap = Moretinymap.find(params[:id])\n\n respond_to do |format|\n if @moretinymap.update_attributes(params[:moretinymap])\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @requirement_map = RequirementMap.find(params[:id])\n\n respond_to do |format|\n if @requirement_map.update_attributes(params[:requirement_map])\n format.html { redirect_to(@requirement_map, :notice => 'Requirement map was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @requirement_map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @process_map.update(process_map_params)\n format.html { redirect_to process_maps_path, notice: 'Process map was successfully updated.' }\n format.json { render :show, status: :ok, location: @process_map }\n else\n format.html { render :edit }\n format.json { render json: @process_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map = Map.find(@marker.map_id)\n @markers = Marker.where(map_id: @map)\n respond_to do |format|\n if @marker.update_attributes(marker_params)\n format.html { redirect_to map_url(@map), notice: 'Marker was successfully updated.' }\n format.js\n\n else\n format.html { render :edit }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\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 @localmap = Localmap.find(params[:id])\n\n respond_to do |format|\n if @localmap.update_attributes(params[:localmap])\n flash[:notice] = 'Localmap was successfully updated.'\n format.html { redirect_to(@localmap) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @localmap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shiftmap = Shiftmap.find(params[:id])\n\n respond_to do |format|\n if @shiftmap.update_attributes(params[:shiftmap])\n format.html { redirect_to @shiftmap, notice: 'Shiftmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shiftmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @google_map = GoogleMap.find(params[:id])\n\n respond_to do |format|\n if @google_map.update_attributes(params[:google_map])\n format.html { redirect_to(@google_map, :notice => 'Google map was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @google_map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gmap.update(gmap_params)\n format.html { redirect_to @gmap, notice: 'Gmap was successfully updated.' }\n format.json { render :show, status: :ok, location: @gmap }\n else\n format.html { render :edit }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roadmap.update(roadmap_params)\n format.html { redirect_to @roadmap, notice: 'Roadmap wurde erfolgreich aktualisiert' }\n format.json { render :show, status: :ok, location: @roadmap }\n else\n format.html { render :edit }\n format.json { render json: @roadmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @indication_generic_map.update(indication_generic_map_params)\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully updated.' }\n format.json { render :show, status: :ok, location: @indication_generic_map }\n else\n format.html { render :edit }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @estate_map.update(estate_map_params)\n format.html { redirect_to @estate_map, notice: 'Estate map was successfully updated.' }\n format.json { render :show, status: :ok, location: @estate_map }\n else\n format.html { render :edit }\n format.json { render json: @estate_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n place = Place.find(params[:id])\n map = Map.find(params[:map_id])\n #place.update(place_params)\n place_attrs = place_params\n #binding.pry\n map.adjust_place(place, place_attrs)\n redirect_to edit_map_path(map)\n end",
"def patch!\n request! :patch\n end",
"def update\n put :update\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @usermap.update(usermap_params)\n format.html { redirect_to @usermap, notice: 'Usermap was successfully updated.' }\n format.json { render :show, status: :ok, location: @usermap }\n else\n format.html { render :edit }\n format.json { render json: @usermap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maplocation.update(maplocation_params)\n format.html { redirect_to @maplocation, notice: 'Maplocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @maplocation }\n else\n format.html { render :edit }\n format.json { render json: @maplocation.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 @mosttinymap = Mosttinymap.find(params[:id])\n\n respond_to do |format|\n if @mosttinymap.update_attributes(params[:mosttinymap])\n format.html { redirect_to @mosttinymap, notice: 'Mosttinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mosttinymap.errors, status: :unprocessable_entity }\n end\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!(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 @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n if @map_state.update_attributes(params[:map_state])\n format.html { redirect_to @map_state, :notice => 'Map state was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @audio_map.update(audio_map_params)\n format.html { redirect_to @audio_map, notice: 'Audio map was successfully updated.' }\n format.json { render :show, status: :ok, location: @audio_map }\n else\n format.html { render :edit }\n format.json { render json: @audio_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roadmap = Roadmap.find(@roadmap_step.roadmap_id)\n\n respond_to do |format|\n if @roadmap_step.update(roadmap_step_params)\n format.html { redirect_to @roadmap, notice: 'Roadmap step was successfully updated.' }\n format.json { render :show, status: :ok, location: @roadmap_step }\n else\n format.html { render :edit }\n format.json { render json: @roadmap_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map_render = MapRender.find(params[:id])\n\n respond_to do |format|\n if @map_render.update_attributes(params[:map_render])\n format.html { redirect_to(@map_render, :notice => 'Map render was successfully updated.') }\n format.xml { head :ok }\n format.txt { render :text => 'OK' }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_render.errors, :status => :unprocessable_entity }\n format.txt { render :text => 'ERR: ' + @map_render.errors.full_messages.to_sentence }\n end\n end\n end",
"def update\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n if @system_site_map.update_attributes(params[:system_site_map])\n format.html { redirect_to @system_site_map, notice: 'System site map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_site_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_map\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n group_id = params[:group_id]\n SqlHelper.validate_token([group_id])\n\n @office_map = OfficeMap.get_for_group(group_id, true)\n\n params[:office_map].delete(:group_id)\n\n @office_map.update_attributes(params.require(:office_map).permit(OfficeMap::PERMIT_BASE))\n\n params.delete(:office_map)\n\n flash[:notice] = t('msg.update_success')\n render(:partial => 'groups/ajax_group_map', :layout => false)\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\n respond_to do |format|\n if @empathy_map_record.update(empathy_map_record_params)\n format.html { redirect_to @empathy_map_record, notice: 'Empathy map record was successfully updated.' }\n format.json { render :show, status: :ok, location: @empathy_map_record }\n else\n format.html { render :edit }\n format.json { render json: @empathy_map_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n place = Place.find(params[:id])\n\n if place.update_attributes(params[:place])\n head :no_content\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end",
"def update\n @view_mapping = ViewMapping.find(params[:id])\n\n respond_to do |format|\n if @view_mapping.update_attributes(params[:view_mapping])\n format.html { redirect_to @view_mapping, notice: 'View mapping was successfully updated.' }\n format.json { render :json =>@view_mapping, :status=>:ok, :location=>@view_mapping.dojo_url }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @view_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n @place.apply_geo(params[:coordinates])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: I18n.t('views.messages.places.notifications.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend",
"def update\n @role_map = RoleMap.find(params[:id])\n\n respond_to do |format|\n if @role_map.update_attributes(params[:role_map])\n format.html { redirect_to @role_map, notice: 'Role map was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_mapping.update(location_mapping_params)\n format.html { redirect_to @location_mapping, notice: 'Location mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_mapping }\n else\n format.html { render :edit }\n format.json { render json: @location_mapping.errors, status: :unprocessable_entity }\n end\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(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update!(**args)\n @duplicate = args[:duplicate] if args.key?(:duplicate)\n @maps_url = args[:maps_url] if args.key?(:maps_url)\n end",
"def update_worldmap\n if data = (@environment[\"gps\"] || @environment[\"network\"])\n worldmap_request \"PUT\", \"/hoc\", data.to_json\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 @marker.update(marker_params)\n format.html { redirect_to @marker, notice: 'Marker was successfully updated.' }\n format.json { render :show, status: :ok, location: @marker }\n else\n format.html { render :edit }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @marker.update(marker_params)\n format.html { redirect_to @marker, notice: 'Marker was successfully updated.' }\n format.json { render :show, status: :ok, location: @marker }\n else\n format.html { render :edit }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @marker.update(marker_params)\n format.html { redirect_to @marker, notice: 'Marker was successfully updated.' }\n format.json { render :show, status: :ok, location: @marker }\n else\n format.html { render :edit }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map_node = Map::Node.find(params[:id])\n\n respond_to do |format|\n if @map_node.update_attributes(params[:map_node])\n format.html { redirect_to @map_node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:domain_map][:domain].blank?\n @req_error = \"req_error\"\n end\n @domain_map = DomainMap.find(params[:id])\n params[:domain_map][:verified] = false\n if params[:domain_map][:map_type] == \"organisation\" \n params[:domain_map][:organisation_id] = current_organisation.id\n params[:domain_map][:program_id] = nil\n elsif\n params[:domain_map][:organisation_id] = nil\n end\n respond_to do |format|\n if @domain_map.update_attributes(params[:domain_map])\n format.html { redirect_to domain_maps_url, notice: 'Domain map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @domain_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\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_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @openmapa = Openmapa.find(params[:id])\n\n respond_to do |format|\n if @openmapa.update_attributes(params[:openmapa])\n flash[:notice] = 'Openmapa was successfully updated.'\n format.html { redirect_to(@openmapa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @openmapa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mapuser.update(mapuser_params)\n format.html { redirect_to @mapuser, notice: 'Mapuser was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapuser }\n else\n format.html { render :edit }\n format.json { render json: @mapuser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fw_baidu_map = current_user.baidu_maps.find(params[:id])\n\n respond_to do |format|\n if @fw_baidu_map.update_attributes(params[:fw_baidu_map])\n format.html { redirect_to @fw_baidu_map, notice: 'Baidu map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fw_baidu_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n if @place.update(place_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Update failed.\"]}\n end\n end",
"def update\n @roadmap = Roadmap.find(params[:id])\n \n if not validate_permission(@roadmap)\n return\n end\n \t\t \n\t\trespond_to do |format|\n\t\t if @roadmap.update_attributes(params[:roadmap])\n\t\t flash[:notice] = 'Roteiro atualizado com sucesso.'\n\t\t format.html { redirect_to(@roadmap) }\n\t\t format.xml { head :ok }\n\t\t else\n \t\t# Recarrega os estados e as cidades se possivel\n\t\t\t\tload_states_and_cities(@roadmap)\n\n\t\t format.html { render :action => \"edit\" }\n\t\t format.xml { render :xml => @roadmap.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n \t\t\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 @map_student.update(map_student_params)\n format.html { redirect_to @map_student, notice: 'Map student was successfully updated.' }\n format.json { render :show, status: :ok, location: @map_student }\n else\n format.html { render :edit }\n format.json { render json: @map_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @empresa = Empresa.find(params[:id])\n @empresa.setLatLong\n respond_to do |format|\n if @empresa.update_attributes(params[:empresa])\n format.html { redirect_success(\"Empresa alterada com sucesso!\",:empresas, :index)}\n format.json { head :no_content }\n else\n format.html { redirect_error(\"Nao foi possivel editar a empresa!\",:empresas, :index)}\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update\n respond_to do |format|\n if @mapimage.update(mapimage_params)\n format.html { redirect_to @mapimage, notice: 'Mapimage was successfully updated.' }\n format.json { render :show, status: :ok, location: @mapimage }\n else\n format.html { render :edit }\n format.json { render json: @mapimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n @chef_mapping = ChefMapping.find(params[:id])\n\n respond_to do |format|\n if @chef_mapping.update_attributes(params[:chef_mapping])\n format.html { redirect_to @chef_mapping, notice: 'Chef mapping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chef_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @osm.update(osm_params)\n format.html { redirect_to @osm, notice: 'Osm was successfully updated.' }\n format.json { render :show, status: :ok, location: @osm }\n else\n format.html { render :edit }\n format.json { render json: @osm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n if @map_layer.update_attributes(params[:map_layer])\n flash[:notice] = 'MapLayer was successfully updated.'\n format.html { redirect_to(@map_layer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_layer.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 @artwork_image_map.update(artwork_image_map_params)\n format.html { redirect_to @artwork_image_map, notice: 'Artwork image map was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork_image_map }\n else\n format.html { render :edit }\n format.json { render json: @artwork_image_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @street.update(street_params)\n format.html { redirect_to @street, notice: 'Street was successfully updated.' }\n format.json { render :show, status: :ok, location: @street }\n else\n format.html { render :edit }\n format.json { render json: @street.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_code_electorate_map.update(post_code_electorate_map_params)\n format.html { redirect_to @post_code_electorate_map, notice: 'Post code electorate map was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_code_electorate_map }\n else\n format.html { render :edit }\n format.json { render json: @post_code_electorate_map.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.70746547",
"0.6998199",
"0.6817516",
"0.67588663",
"0.66274744",
"0.65701574",
"0.6525709",
"0.6506678",
"0.64493203",
"0.63272375",
"0.6307453",
"0.6298193",
"0.6294906",
"0.6251651",
"0.624511",
"0.6242917",
"0.62242275",
"0.6203368",
"0.6198653",
"0.61868566",
"0.61809415",
"0.6173647",
"0.6150092",
"0.6143588",
"0.6140763",
"0.61392754",
"0.61199087",
"0.61055684",
"0.60821754",
"0.6082025",
"0.6079271",
"0.60654724",
"0.606264",
"0.6024009",
"0.60117114",
"0.5985908",
"0.59428096",
"0.5939821",
"0.59388953",
"0.5909519",
"0.59036154",
"0.5894307",
"0.5887828",
"0.58797467",
"0.587378",
"0.5871932",
"0.58452845",
"0.5842711",
"0.5839435",
"0.5829458",
"0.58246744",
"0.58202827",
"0.5813302",
"0.5799337",
"0.5797342",
"0.57908523",
"0.57749474",
"0.57721585",
"0.57624674",
"0.57616997",
"0.5752218",
"0.57381326",
"0.5737161",
"0.5736409",
"0.57319903",
"0.57304424",
"0.57304424",
"0.57304424",
"0.57150966",
"0.5712201",
"0.57071996",
"0.56944525",
"0.56937265",
"0.56826323",
"0.567612",
"0.5676008",
"0.567416",
"0.5669971",
"0.5669249",
"0.56384593",
"0.56380916",
"0.5630085",
"0.56298125",
"0.56298125",
"0.56283146",
"0.5626949",
"0.56223875",
"0.56203234",
"0.56194586",
"0.5612023",
"0.56050986",
"0.56050986",
"0.559488",
"0.5586206",
"0.55705017",
"0.5568349",
"0.55661947",
"0.55661947",
"0.55650187",
"0.5545822"
] |
0.68956316
|
2
|
DELETE /maps/1 DELETE /maps/1.json
|
def destroy
@map.destroy
respond_to do |format|
format.html { redirect_to maps_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n get_map\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map = Map.find_by_id(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @map.mapable, notice: 'Map removed!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url, notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url, notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smallmap = Smallmap.find(params[:id])\n @smallmap.destroy\n\n respond_to do |format|\n format.html { redirect_to smallmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n\n head :no_content\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 @tinymap = Tinymap.find(params[:id])\n @tinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to tinymaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sasmap = Sasmap.find(params[:id])\n @sasmap.destroy\n\n respond_to do |format|\n format.html { redirect_to sasmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moretinymap = Moretinymap.find(params[:id])\n @moretinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to moretinymaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @world_map = WorldMap.find(params[:id])\n @world_map.destroy\n\n respond_to do |format|\n format.html { redirect_to world_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to kanzume_maps_path(kanzume_id: @kanzume.id), notice: 'Map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_url_map = LocationUrlMap.find(params[:id])\n @location_url_map.destroy\n\n respond_to do |format|\n format.html { redirect_to location_url_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gmap = Gmap.find(params[:id])\n @gmap.destroy\n\n respond_to do |format|\n format.html { redirect_to gmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @map.destroy\n flash[:notice] = \"Map deleted!\"\n else\n flash[:notice] = \"Map wasnt deleted\"\n end\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @google_map = GoogleMap.find(params[:id])\n @google_map.destroy\n\n respond_to do |format|\n format.html { redirect_to(google_maps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mosttinymap = Mosttinymap.find(params[:id])\n @mosttinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinymaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @localmap = Localmap.find(params[:id])\n @localmap.destroy\n\n respond_to do |format|\n format.html { redirect_to(localmaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group_map.destroy\n\n respond_to do |format|\n format.html { redirect_to group_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @domain_map = DomainMap.find(params[:id])\n @domain_map.destroy\n\n respond_to do |format|\n format.html { redirect_to domain_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadmap.destroy\n respond_to do |format|\n format.html { redirect_to roadmaps_url, notice: 'Roadmap wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indication_generic_map.destroy\n respond_to do |format|\n format.html { redirect_to indication_generic_maps_url, notice: 'Indication generic map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estate_map.destroy\n respond_to do |format|\n format.html { redirect_to estate_maps_url, notice: 'Estate map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gmap.destroy\n respond_to do |format|\n format.html { redirect_to gmaps_url, notice: 'Gmap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @process_map.destroy\n respond_to do |format|\n format.html { redirect_to process_maps_url, notice: 'Process map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio_map.destroy\n respond_to do |format|\n format.html { redirect_to audio_maps_url, notice: 'Audio map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fw_baidu_map = current_user.baidu_maps.find(params[:id])\n @fw_baidu_map.destroy\n\n respond_to do |format|\n format.html { redirect_to fw_baidu_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_site_map = SystemSiteMap.find(params[:id])\n @system_site_map.destroy\n\n respond_to do |format|\n format.html { redirect_to system_site_maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usermap.destroy\n respond_to do |format|\n format.html { redirect_to usermaps_url, notice: 'Usermap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shiftmap = Shiftmap.find(params[:id])\n @shiftmap.destroy\n\n respond_to do |format|\n format.html { redirect_to shiftmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requirement_map = RequirementMap.find(params[:id])\n @requirement_map.destroy\n\n respond_to do |format|\n format.html { redirect_to(requirement_maps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @map.destroy\n flash[:notice] = t('.flash')\n else\n flash[:notice] = t('.error')\n end\n respond_to do |format|\n if params[:redirect_back] \n format.html { redirect_to :back}\n else\n format.html { redirect_to(maps_url) }\n end\n format.xml { head :ok }\n end\n end",
"def destroy\n @maplocation.destroy\n respond_to do |format|\n format.html { redirect_to maplocations_url, notice: 'Maplocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_marker = MapMarker.find(params[:id])\n @map_marker.destroy\n\n respond_to do |format|\n format.html { redirect_to map_markers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n NamedMap.stats_aggregator.timing('named-map.delete') do\n response = self.class.http_client.delete( url + '?api_key=' + @parent.api_key,\n {\n headers: @parent.headers,\n ssl_verifypeer: @parent.verify_cert,\n ssl_verifyhost: @parent.verify_host,\n followlocation: true,\n connecttimeout: HTTP_CONNECT_TIMEOUT,\n timeout: HTTP_REQUEST_TIMEOUT\n } )\n raise HTTPResponseError, \"DELETE:#{response.code} #{response.request.url} #{response.body}\" unless response.code == 204\n end\n end",
"def destroy\n @map_version.destroy\n respond_to do |format|\n format.html { redirect_to admin_map_versions_url, notice: 'Map version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_state = MapState.find(params[:id])\n @map_state.destroy\n\n respond_to do |format|\n format.html { redirect_to map_states_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @empathy_map_record.destroy\n respond_to do |format|\n format.html { redirect_to empathy_map_records_url, notice: 'Empathy map record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @csv_map.destroy\n respond_to do |format|\n format.html { redirect_to csv_maps_url, notice: 'Csv map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_code_electorate_map.destroy\n respond_to do |format|\n format.html { redirect_to post_code_electorate_maps_url, notice: 'Post code electorate map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geo.destroy\n respond_to do |format|\n format.html { redirect_to geos_url, notice: 'Geo was successfully destroyed.' }\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 @role_map = RoleMap.find(params[:id])\n @role_map.destroy\n\n respond_to do |format|\n format.html { redirect_to role_maps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @openmapa = Openmapa.find(params[:id])\n @openmapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(openmapas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @concept_map = ConceptMap.find(params[:id])\n @concept_map.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to conecpt_maps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end",
"def delete_map\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n group_id = params[:group_id]\n SqlHelper.validate_token([group_id])\n\n @office_map = OfficeMap.get_for_group(group_id, false)\n\n begin\n @office_map.destroy\n rescue => evar\n Log.add_error(request, evar)\n end\n\n @office_map = OfficeMap.get_for_group(group_id, false)\n\n flash[:notice] = t('msg.delete_success')\n render(:partial => 'groups/ajax_group_map', :layout => false)\n end",
"def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sessionmap = Sessionmap.find(params[:id])\n @sessionmap.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessionmaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mind_map.destroy\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @roadmap = Roadmap.find(params[:id])\n\t\t \n\t\tif not validate_permission(@roadmap)\n return\n end\n\n\t\t@roadmap.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to(roadmaps_url) }\n\t\t format.xml { head :ok }\n\t\tend\n\n\tend",
"def destroy\n @url_mapper.destroy\n respond_to do |format|\n format.html { redirect_to url_mappers_url, notice: 'Url mapper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mapimage.destroy\n respond_to do |format|\n format.html { redirect_to mapimages_url, notice: 'Mapimage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_mapping.destroy\n respond_to do |format|\n format.html { redirect_to location_mappings_url, notice: 'Location mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @abstractnmap = Abstractnmap.find(params[:id])\n @abstractnmap.destroy\n\n respond_to do |format|\n format.html { redirect_to(abstractnmaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @my_map = current_my_map\n if @way_point.my_map_id == @my_map.id\n @way_point.destroy\n session[:my_map_id] = nil\n respond_to do |format|\n format.html { redirect_to @my_map }\n format.json { head :no_content }\n end\n else\n redirect_to @my_map\n end\n end",
"def destroy\n @view_mapping = ViewMapping.find(params[:id])\n @view_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to view_mappings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_map.destroy\n respond_to do |format|\n format.html { redirect_to category_maps_url, notice: 'Category map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_map.destroy\n respond_to do |format|\n format.html { redirect_to category_maps_url, notice: 'Category map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @osm.destroy\n respond_to do |format|\n format.html { redirect_to osms_url, notice: 'Osm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artwork_image_map.destroy\n respond_to do |format|\n format.html { redirect_to artwork_image_maps_url, notice: 'Artwork image map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_mapping.destroy\n respond_to do |format|\n format.html { redirect_to item_mappings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position_mapper = PositionMapper.find(params[:id])\n @position_mapper.destroy\n\n respond_to do |format|\n format.html { redirect_to position_mappers_url }\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 @map = Map.find(@marker.map_id)\n respond_to do |format|\n if @marker.destroy\n format.html { redirect_to map_path(@map), notice: 'Marker was successfully destroyed.' }\n else\n format.html { redirect_to map_url, notice: 'Marker was Not successfully destroyed.' }\n end\n end\n end",
"def destroy\n @mapuser.destroy\n respond_to do |format|\n format.html { redirect_to mapusers_url, notice: 'Mapuser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geo_datum.destroy\n respond_to do |format|\n format.html { redirect_to geo_data_url, notice: 'Geo datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_geo = current_user.post_geos.find(params[:id])\n @post_geo.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_geos] }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_image = MapImage.find(params[:id])\n @map_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @key_indicate_map_indicator.destroy\n respond_to do |format|\n format.html { redirect_to key_indicate_map_indicators_url, notice: 'Indicator was successfully destroyed.' }\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 geolocation_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bemap = Bemap.find(params[:id])\n @bemap.destroy\n\n respond_to do |format|\n format.html { redirect_to bemaps_url }\n format.json { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @map_student.destroy\n respond_to do |format|\n format.html { redirect_to map_students_url, notice: 'Map student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lat_lon.destroy\n respond_to do |format|\n format.html { redirect_to lat_lons_url, notice: 'Lat lon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_mapping = EntityMapping.find(params[:id])\n @entity_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_mappings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @key_indicate_map_indicator_key.destroy\n respond_to do |format|\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @mapping = Mapping.find(params[:id])\n @mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to mappings_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\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 @geoname = Geoname.find(params[:id])\n @geoname.destroy\n\n respond_to do |format|\n format.html { redirect_to(geonames_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @geocoded_location = GeocodedLocation.find(params[:id])\n @geocoded_location.destroy\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Geocoded location was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy\n @geometry.destroy\n respond_to do |format|\n format.html { redirect_to geometries_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7911548",
"0.79039186",
"0.78826916",
"0.78655976",
"0.7747663",
"0.77391475",
"0.7611366",
"0.75712115",
"0.75712115",
"0.75580025",
"0.7534935",
"0.75003856",
"0.74753237",
"0.74296445",
"0.7412231",
"0.7392506",
"0.7362247",
"0.73536247",
"0.732479",
"0.7284501",
"0.72634727",
"0.7250534",
"0.7233185",
"0.72318685",
"0.72201735",
"0.7210993",
"0.71673614",
"0.713368",
"0.710373",
"0.7089493",
"0.7078998",
"0.7065585",
"0.7057178",
"0.70129734",
"0.6987883",
"0.69816035",
"0.69466245",
"0.694144",
"0.6934263",
"0.6928603",
"0.6917016",
"0.68837297",
"0.6858373",
"0.68449926",
"0.6835371",
"0.682997",
"0.6814872",
"0.680843",
"0.6802458",
"0.6795131",
"0.6795097",
"0.6781889",
"0.6781889",
"0.67710876",
"0.67668325",
"0.676389",
"0.6742017",
"0.6741151",
"0.6741151",
"0.6734049",
"0.67311335",
"0.67221814",
"0.6715987",
"0.6697422",
"0.66941607",
"0.66874075",
"0.668516",
"0.6682786",
"0.6670685",
"0.6661715",
"0.6661715",
"0.66543543",
"0.66535723",
"0.66490966",
"0.6623323",
"0.66200364",
"0.66106933",
"0.65823674",
"0.65778875",
"0.6565535",
"0.65501064",
"0.65500325",
"0.65497035",
"0.6521811",
"0.6497703",
"0.64922696",
"0.6471803",
"0.64703304",
"0.64684564",
"0.6458491",
"0.6422202",
"0.64197135",
"0.64152753",
"0.6403617",
"0.63954335",
"0.63952786",
"0.638958",
"0.63846374"
] |
0.78474283
|
6
|
Use callbacks to share common setup or constraints between actions.
|
def set_map
@map = Map.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 map_params
params[:map]
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
|
In production this route kicks in, and in dev we load /assets/modejson.js from the /app/assets/javascripts/modejson.js location..
|
def mode_json
path = 'node_modules/ace-builds/src-min-noconflict/mode-json.js'
file_contents = File.read(path)
render js: file_contents, content_type: Mime::Type.lookup('application/javascript')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def config_js\n [\n src_config_path.join('routes.js').to_s,\n src_config_path.join('router.js').to_s,\n src_config_path.join('app.js').to_s\n ]\n end",
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def ext\n respond_to do |format|\n format.js {\n render :text => Netzke::Core::DynamicAssets.ext_js\n }\n\n format.css {\n render :text => Netzke::Core::DynamicAssets.ext_css\n }\n end\n end",
"def asset_handler\n tags = String.new\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/icons.css\")\n if controller_name == \"rich_subscriptions\"\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('map')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet-slider.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/L.Control.Locate.min.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('map')}.css\")\n else\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('application')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('application')}.css\")\n end\n tags.html_safe\n end",
"def app\n render json: {app_load: true}\n #@location_path = \"/#{params[:path]}\"\n end",
"def javascript_path; end",
"def require_js_asset_path(path)\n # Digging into the jekyll-assets internals here, since we can't invoke\n # the Filter directly. https://github.com/jekyll/jekyll-help/issues/97\n r = ::Jekyll::AssetsPlugin::Renderer.new @context, path\n path = r.render_asset_path\n path.end_with? '.js' and path[0..-('.js'.length + 1)] or path\n end",
"def serve_assets\n if @serve_assets.nil?\n ENV['RACK_ENV'] == 'production' ? (@serve_assets = 'remote') : (@serve_assets = 'local_dynamic')\n end\n @serve_assets\n end",
"def show\n headers['Content-Type'] = \"application/javascript\"\n path = normalize_path(params[:js_path])\n p path\n return head(:forbidden) unless can_render_path?(path)\n compiled = Barista.compile_file!(path)\n compiled.nil? ? head(:not_found) : render(:text => compiled.to_s)\n end",
"def assets; end",
"def assets; end",
"def assets; end",
"def javascript_path(path, options={})\n asset_path(path, :type => :javascript)\n end",
"def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n AssetManager.include_local_library [ 'ckeditor/init']\n\n AssetManager.include_css [:blog_global]\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end",
"def show\n respond_to do |format|\n format.html\n format.xml { render :xml => @mode.to_xml }\n\t\t\tformat.js { render :text => @mode.to_json }\n end\n end",
"def javascript_global_config\n {\n development: Rails.env.development?,\n railsRoot: Rails.root.to_s,\n liveFeedWsUrl: live_feed_ws_url,\n eventPath: event_path(path: 'PATH'),\n }\n end",
"def min_js_file\n build_path.join('scripts.min.js')\n end",
"def output_path\n ::ManageIQ::UI::Classic::Engine.root.join('app/javascript/oldjs/locale')\n end",
"def active_scaffold_javascripts(frontend = :default)\r\n ActiveScaffold::Config::Core.javascripts(frontend).collect do |name|\r\n ActiveScaffold::Config::Core.asset_path(name, frontend)\r\n end\r\n end",
"def generate\n return {} if config.empty?\n assets = {}\n config.each do |key, value|\n next if key == \"widgets\" # Widgets are handled separately.\n assets[key] = Array(value).map { |v|\n {\n \"url\" => url(v),\n \"id\" => File.join(@ruhoh.paths.theme, \"javascripts\", v)\n }\n }\n end\n \n assets\n end",
"def javascript_folder(path)\n if use_cache? \n return javascript(\"min/#{path}.js\")\n else\n result = []\n Dir[\"#{Rails.public_path}/javascripts/#{path}/**/*.js\"].each do |item|\n result << item.gsub(\"#{Rails.public_path}/javascripts/\", \"\")\n end\n return javascript(result)\n end\n end",
"def assets\n {\n css: css_assets,\n js: js_assets,\n image: image_assets\n }\n end",
"def add_compressed_routes!\n assets.packages.each do |name, package|\n get package.route_regex do\n if defined?(settings.assets.app.clear_tilt_cache) && settings.assets.app.clear_tilt_cache\n AssetPack.clear_tilt_cache!(@template_cache, settings.assets.app)\n end\n\n mtime, contents = @template_cache.fetch(package.path) {\n [ package.mtime, package.minify ]\n }\n\n content_type package.type\n last_modified mtime\n assets_expires\n contents\n end\n end\n end",
"def touch\n respond_to do |format|\n format.js {\n render :text => Netzke::Core::DynamicAssets.touch_js\n }\n\n format.css {\n render :text => Netzke::Core::DynamicAssets.touch_css\n }\n end\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 set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end",
"def compile_coffee_to_js\n files = ['level_core', 'path_core', 'deadlock_core']\n files.each do |file|\n if File.exist?(\"lib/assets/#{file}.js\")\n File.delete(\"lib/assets/#{file}.js\")\n end\n compile_file_coffee_to_js(\"app/assets/javascripts/game/models/#{file}.js.coffee\", \"lib/assets/#{file}.js\")\n end\nend",
"def handlebars_file\n # don't want to force the user to serve my handlebars.js from sprockets so...\n @handlebars_file ||= File.expand_path('../../../vendor/assets/javascripts/mutton/handlebars.js', __FILE__)\n end",
"def assets_manifest; end",
"def assets_manifest; end",
"def assets\n\n javascript={}\n css={}\n\n Dir.glob(bower_asset_path+'/production/*.html').each { |path|\n next if files_omit.include?(File.basename(path))\n page = Nokogiri::HTML(open(path))\n javascript[path]=[]\n css[path]=[]\n page.css('script').each { |st|\n javascript[path] << st.attr('src').sub('../vendors/', '') if st.attr('src') && st.attr('src').start_with?('../')\n }\n page.css('link').each { |st|\n css[path] << st.attr('href').sub('../vendors/', '') if st.attr('rel') && st.attr('rel') == 'stylesheet'\n }\n }\n\n# Merge the lists of script and css references using array union\n javascript_src=[]\n javascript.values.map { |s| javascript_src = javascript_src | s }\n javascript_src.uniq!\n\n# Omit the references that we won't include in the gem\n javascript_omit.each { |s| javascript_src.delete(s) }\n\n css_src=[]\n css.values.map { |s| css_src = css_src | s }\n css_src.uniq!\n\n css_omit.each { |s| css_src.delete(s) }\n\n {\n javascript: javascript_src,\n css: css_src,\n }\n\nend",
"def test_asset_app_js\n get '/assets/app.js'\n refute_empty_response\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 to_production_html\n \"<script type='text/javascript' src='%s?%s'></script>\" % [path, mtime.to_i]\n end",
"def cache_action_index?\n Rails.env.production? && site.public && !(request.format.json? || request.format.js?)\n end",
"def javascript(path_name = 'wedge', options = {}, url = false)\n path_name = path_name.to_s\n\n if server?\n javascript_cache[path_name] ||= begin\n build(path_name, options).to_s\n end\n else\n trigger_javascript_loaded path_name, options\n end\n end",
"def sync_js\n if self.sync_js_dir(💎.engine.dir('services/web_assets/src/'), \"#{@path_base}src/\")\n self.build_js(true)\n self._sync_js(true)\n end\n\n end",
"def copy_javascripts\n if ::Rails.version[0..2].to_f >= 3.1\n #puts \"The javascripts do not need to be installed since Rails 3.1\"\n else\n copy_file \"../../../../../app/assets/javascripts/on_the_spot_code.js\", \"public/javascripts/on_the_spot.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.js\", \"public/javascripts/jquery.jeditable.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.checkbox.js\", \"public/javascripts/jquery.jeditable.checkbox.js\"\n copy_file \"../../../../../app/assets/stylesheets/on_the_spot.css\", \"public/stylesheets/on_the_spot.css\"\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @modes.to_xml }\n\t\t\tformat.js { render :text => @modes.to_json }\n end\n end",
"def prepare_for_production\n root_glob = combined_app_root_glob(false)\n root_re = combined_app_root_regexp(false)\n\n # Load application modules\n path_re = /#{root_re}(?<path>.*)/\n Dir.glob(File.join(root_glob, '**/*')) do |file|\n if File.directory? file\n file.match(path_re) do |m|\n mod = File.join(file, File.basename(file)) << '.rb'\n if File.file? mod\n require_for_production mod\n else\n Object.const_set_recursive(m[:path].camelize, Module.new)\n end\n end # match\n end # if\n end\n\n # Load templates\n file_re = /#{root_re}(?<path>.*)\\/.*\\.(?<template>.*)\\./\n Dir.glob(File.join(root_glob, \"**/*#{TEMPLATE_EXT}\")) do |file|\n file.match(file_re) do |m|\n ios = StringIO.new\n TemplateCompiler.compile_template(\n ios, File.read(file), m[:path].camelize, m[:template],\n false, @context.timers\n )\n m[:path].camelize.constantize.class_eval(ios.string)\n end # match\n end # glob\n\n # Load CSS\n css = CssCompressor.compress(compile_css(StringIO.new).string)\n Application.use(Rack::FrozenRoute, %r{/bundle.css}, 'text/css', css)\n Application.pull_down(Rack::StaticDir)\n end",
"def resolve_asset; end",
"def resolve_asset; end",
"def show\n @javascript = @site.javascripts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @javascript }\n end\n end",
"def show\n respond_to do |format|\n format.css {\n if File.file?(stylesheet_filename = theme_public_stylesheets_path(filename))\n send_file stylesheet_filename, :disposition => 'inline', :stream => false, :type => 'text/css'\n elsif File.file?(stylesheet_filename = theme_stylesheets_path(File.join(dirname, \"#{basename}.sass\")))\n render :text => Sass::Engine.new(File.open(stylesheet_filename).read, sass_options).to_css\n else\n head :not_found\n end\n }\n format.gif {\n if File.file?(image_path = theme_public_images_path(filename))\n send_file image_path, :disposition => 'inline', :stream => false, :type => 'image/gif'\n else\n head :not_found\n end\n }\n format.jpeg {\n if File.file?(image_path = theme_public_images_path(filename))\n send_file image_path, :disposition => 'inline', :stream => false, :type => 'image/jpeg'\n else\n head :not_found\n end\n }\n format.js { \n if File.file?(javascript_path = theme_public_javascripts_path(filename))\n send_file javascript_path, :disposition => 'inline', :stream => false, :type => 'text/javascript'\n else\n head :not_found\n end\n }\n format.png {\n if File.file?(image_path = theme_public_images_path(filename))\n send_file image_path, :disposition => 'inline', :stream => false, :type => 'image/png'\n else\n head :not_found\n end\n }\n end\n end",
"def show\n @jquery_theme = JqueryTheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @jquery_theme }\n end\n end",
"def js_env\n data = {\n host: ENV['HOST'],\n database: ENV['DATABASE_HOST'],\n redirect_uri: ENV['REDIRECT_URI'],\n env: Rails.env,\n application_id: ENV['APPLICATION_UID'],\n application_secret: ENV['APPLICATION_SECRET']\n }\n\n <<-EOS.html_safe\n <script type=\"text/javascript\">\n shared = angular.module('gruenderviertel')\n shared.constant('Rails', #{data.to_json})\n </script>\n EOS\n end",
"def short_path\n self.path =~ /^(javascripts|stylesheets|fonts)\\/(.*)$/\n $2\n end",
"def loadtheme \n @preference = Preference.find_or_create_by_user_id(current_user.id)\n \n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @mode }\n end\n end",
"def js_erb_auto_include\n # Refactor this for resource controller: use request.path and request.path_parameters to deterine which url\n #path_params = request.path_parameters\n #path_params.delete(:action)\n #puts request.path\n #puts path_params.inspect\n #@js_erb_auto_include_controller_url = url_for(path_params.merge({ :format => 'js' }))\n #puts url_for(path_params.merge({ :format => 'js' })).inspect\n @js_erb_auto_include_url = url_for(request.path_parameters.merge({ :format => 'js' }))\n #puts url_for(request.path_parameters.merge({ :format => 'js' })).inspect\n end",
"def js\n File.read(@folder + \"/data/#{@what}.js\")\n end",
"def javascripts\n super + %w(js/custom.js)\nend",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.js\n format.json { render :json => @asset }\n format.xml { render :xml => @asset }\n end\n end",
"def show\n begin\n render template: 'assets/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :not_found\n end\n end",
"def asset_resolver_strategies; end",
"def asset_resolver_strategies; end",
"def inject_blacklight_browse_nearby_require\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by BlacklightBrowseNearby\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by BlacklightBrowseNearby:\n *= require blacklight_browse_nearby/blacklight_browse_nearby\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by BlacklightBrowseNearby\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by BlacklightBrowseNearby:\n//= require blacklight_browse_nearby/blacklight_browse_nearby\n}\n end\n end\n end",
"def action_javascript\n asset_context.js( request.symbolized_path_parameters[:action] )\n end",
"def casein_config_javascript_includes\n\t \t['/casein/javascripts/custom.js', '/casein/javascripts/casein.js', '/javascripts/prototype.js']\n\tend",
"def show\n respond_to do |format|\n format.js {}\n end\n end",
"def javascript_bundle_tag(path)\n src = \"/js/#{path}.js\"\n if ENV['RAILS_ENV'] == 'development'\n src = \"//localhost:8080#{src}\"\n end\n\n content_tag(:script, \"\", {src: src})\n end",
"def use_controller_js\n @controller_js = params[:controller].split('/')[-1]\n end",
"def use_controller_js\n @controller_js = params[:controller].split('/')[-1]\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 show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n #send_data(@json.file_contents,\n # type: @json.content_type,\n # filename: @json.filename)\n end",
"def assets\n \n if !params[:path].blank? or !params[:format].blank?\n if get_from_asset_folder\n return\n else\n render_404 and return\n end\n end\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_COMMENTS]\r\n end",
"def initializer_function\n %{<script type=\"text/javascript\">\n var map_options = #{options_to_json};\n onload_before_#{name} = typeof window.onload == 'function' ? window.onload : function(){};\n window.onload = function(){\n onload_before_#{name};\n phoenix_cartographer.init_map('#{name}', map_options);\n map_options = null;\n }\n </script>\n }.minified!\n end",
"def versioned_js(js)\n \"/javascripts/#{js}.js?\" + File.mtime(File.join(Sinatra.application.options.public, \"javascripts\", \"#{js}.js\")).to_i.to_s\n end",
"def json_view\n ApplicationController.renderer.render(partial: \"posts/post.json.jbuilder\", locals: {post: self})\n end",
"def show\n css_path = (development_environment?) ? 'application.css' : path_with_digest('application', 'css')\n js_path = (development_environment?) ? 'application.js' : path_with_digest('application', 'js')\n\n rid = find_request(params[:rid])\n return render_404 if rid.nil?\n\n setup_template_variables(rid)\n respond_to do |format|\n format.html { render 'shared_request' }\n format.js {\n render partial: 'requests/embed/embed', locals: {\n css_path: \"#{site_url}/assets/#{css_path}\",\n js_path: \"#{site_url}/assets/#{js_path}\"\n }\n }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def theme_public_javascripts_path(source = '')\n File.join(theme_path, 'public', 'javascripts', source)\n end",
"def generate()\n\t\tjdc='jekyll_date_chart.js'\n\t\tcopy_file \"lib/#{jdc}\", \"_assets/javascripts/#{jdc}\"\n\n\t\tdirectory 'vendor/assets/javascripts/', '_assets/javascripts/'\n\t\tdirectory 'vendor/assets/stylesheets/', '_assets/stylesheets/'\n\tend",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.js\n end\n end",
"def find_asset_json\n res = Asset.find(@params['id'])\n render :string => res.to_json, :content_type => \"application/json\", :layout => false\n end",
"def precompile_assets; end",
"def javascript(path_name = 'wedge', options = {})\n path_name = path_name.to_s\n\n if server?\n javascript_cache[path_name] ||= begin\n build(path_name, options).to_s\n end\n else\n url = \"#{Wedge.assets_url_with_host}/#{options[:path]}.js\"\n cache = options[:cache_assets]\n\n `jQuery.ajax({ url: url, dataType: \"script\", cache: cache }).done(function() {`\n # fix: at the moment to_js called from the server will set the class\n # store for whatever method it calls. we need to think of a better idea\n # for global and local data store.\n Wedge.config.component_class[options[:name]].config.store = options[:store].indifferent\n\n if initialize_args = options.delete(:initialize_args)\n comp = Wedge[options[:name], *initialize_args]\n else\n comp = Wedge[options[:name]]\n end\n\n if options[:method_args].any?\n comp.send(options[:method_called], options[:method_args])\n else\n comp.send(options[:method_called])\n end\n\n Wedge.trigger_browser_events\n\n `}).fail(function(jqxhr, settings, exception){ window.console.log(exception); })`\n end\n end",
"def show\n @api_javascript = Api::Javascript.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_javascript }\n end\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 index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end",
"def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{Netzke.RelativeUrlRoot = '#{ActionController::Base.config.relative_url_root}';}\n res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}\n\n res << %{Netzke.core.directMaxRetries = '#{Netzke::Core.js_direct_max_retries}';}\n\n res.join(\"\\n\")\n end",
"def javascript_path(source, options={})\n path = compute_public_path(source, 'assets', options.merge(:ext => 'js'))\n options[:body] ? path + \"?body=1\" : path\n end",
"def sources\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = []\n Plugins::Import.included_modules.each do |plugin|\n list << { \n :display => \"#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})\",\n :value => plugin.name\n }\n end\n render :json => list\n }\n end\n end",
"def country_scripts\n return if defined?(@@country_scripts_included)\n @@country_scripts_included = true\n render :partial => 'scripts/country_scripts'\n end",
"def vite_client_src\n prefix_vite_asset('@vite/client') if dev_server_running?\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.js\n end\n end"
] |
[
"0.6038718",
"0.5915775",
"0.5915775",
"0.5853893",
"0.58435315",
"0.57701534",
"0.57312936",
"0.56733334",
"0.566905",
"0.56350577",
"0.55973816",
"0.55973816",
"0.55973816",
"0.5539291",
"0.55279535",
"0.5499255",
"0.5488297",
"0.5468895",
"0.54674774",
"0.54142076",
"0.5348926",
"0.53422797",
"0.5315277",
"0.5269819",
"0.5267166",
"0.5260921",
"0.5242624",
"0.523957",
"0.5238585",
"0.5230254",
"0.5226096",
"0.5223781",
"0.522338",
"0.52210575",
"0.52087617",
"0.5199782",
"0.51980484",
"0.5196755",
"0.5194243",
"0.5192723",
"0.51912415",
"0.51872414",
"0.5184068",
"0.5184068",
"0.51840454",
"0.5178663",
"0.5178325",
"0.5174042",
"0.51648307",
"0.5155121",
"0.51383656",
"0.5131976",
"0.5131117",
"0.5122114",
"0.5118768",
"0.51154923",
"0.5105298",
"0.5105298",
"0.5100709",
"0.5085799",
"0.508286",
"0.50721014",
"0.5071902",
"0.5069542",
"0.5069542",
"0.50689805",
"0.5063768",
"0.5063335",
"0.50614977",
"0.5054983",
"0.5053473",
"0.505036",
"0.50461465",
"0.5032689",
"0.5029018",
"0.5027761",
"0.50219756",
"0.5021709",
"0.5021709",
"0.5021709",
"0.5021709",
"0.5021709",
"0.5021709",
"0.5021709",
"0.50090355",
"0.500563",
"0.50054353",
"0.5001339",
"0.49985975",
"0.49970058",
"0.4995216",
"0.49931994",
"0.49923456",
"0.49904525",
"0.49897036",
"0.49866617",
"0.49863997",
"0.49863997",
"0.49863997",
"0.49863997"
] |
0.6993085
|
0
|
Gets a single environment.
|
def environment(project, id)
get("/projects/#{url_encode project}/environments/#{id}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_environment ()\n service_data = query_for_services()\n return service_data[\"environment\"]\n end",
"def find(id)\n unless environment = ridley.environment.find(id)\n abort EnvironmentNotFound.new(id)\n end\n\n environment\n end",
"def get_environment\n\n fetch_environment || get_expression_pool.fetch_engine_environment\n end",
"def env\n Thread.current[ENVIRONMENT] or raise(\"no env in scope\")\n end",
"def current_environment\n read_environment_from_cache\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 get(environment_name)\n options = { 'EnvironmentNames' => [environment_name] }\n\n if data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first\n new(data)\n end\n end",
"def get_env(name)\n @ant.instance_eval(\"@env_%s\" % name)\n end",
"def environment\n @environment || DEFAULT_ENVIRONMENT\n end",
"def environment\n @environment\n end",
"def env\n unless defined?(@environment)\n self.env = DEFAULT_ENVIRONMENT\n end\n\n @environment\n end",
"def get_root_environment\n\n fetch_environment.get_root_environment\n end",
"def env\n @env\n end",
"def get_env(name)\n ENV[name]\n end",
"def env(name)\n if name\n Environment.new(name)\n else\n @environment #Environment.current\n end\n end",
"def environment\n self.class.environment\n end",
"def fetch_engine_environment\n\n eei = engine_environment_id\n ee, fei = fetch(eei)\n\n return ee if ee\n\n ee = Environment.new_env(eei, nil, nil, @application_context, nil)\n ee.store_itself\n ee\n end",
"def environment\n @environment ||= nil\n end",
"def get_env(key)\n\n end",
"def environment\n @environment ||= ActiveSupport::StringInquirer.new(app.environment.to_s)\n end",
"def [](env)\n @environments[env.to_s].freeze\n end",
"def [](name = nil)\n if name\n @environments_by_name[name]\n else\n @environments\n end\n end",
"def env\n return {} unless instance.respond_to? :env\n\n instance.env\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 detect_env\n @environments.find{|env_name,proc|\n instance_eval(&proc)\n } \n end",
"def env\n return :development unless @env\n @env\n end",
"def environment\n @_environment\n end",
"def env\n @_env\n end",
"def current\n @env.first\n end",
"def env\n config.env\n end",
"def env\n config.env\n end",
"def env\n @env || {}\n end",
"def env\n defined?(Rails) ? Rails.env.to_sym : @env\n end",
"def environment\n verify_environment\n ENV['ENV']\nend",
"def environment(id)\n Environment.new(self, id)\n end",
"def env(env=nil)\n env ||= 'default'\n e = @environments[env] ||= Environment.new\n yield e if block_given?\n e\n end",
"def env\n @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV[\"RAILS_ENV\"].presence || ENV[\"RACK_ENV\"].presence || \"development\")\n end",
"def environments\n Environment.list\n end",
"def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end",
"def fetch_environment\n\n get_expression_pool.fetch_expression(@environment_id)\n end",
"def current_env\n @current_env\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(key)\n if key.nil?\n nil\n else\n ENV[key]\n end\n end",
"def environments\n _get(\"/system/environments\") { |json| json }\n end",
"def env\n site.env\n end",
"def default_environment\n return nil unless default_environment_name\n environment(default_environment_name)\n end",
"def environment(environment=nil)\n @environment ||= environment_from_app(environment) || 'development'\n end",
"def env\n return Rails.env if defined?(Rails) && defined?(Rails.env)\n\n # https://github.com/rails/rails/blob/1ccc407e9dc95bda4d404c192bbb9ce2b8bb7424/railties/lib/rails.rb#L67\n @env ||= ActiveSupport::StringInquirer.new(\n ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || 'development'\n )\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\n return @environment || :development\n\n end",
"def target_environment\n return unless application = applications.first\n application.split(\"-\").first\n end",
"def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end",
"def name\n c.environment\n end",
"def environment_id\n id\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 environment\n if !@environment.is_a?(Condenser) && @environment.respond_to?(:call)\n @environment = @environment.call\n else\n @environment\n end\n end",
"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 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 env\n legacy_env || app_env\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 get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\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 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 @env ||= ENV['RACK_ENV'].present? ? ENV['RACK_ENV'].to_sym : :development\n end",
"def type_env\n @current_env\n end",
"def current_env\n Rails.env\n end",
"def shell_env\n @shell.env\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 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 @env ||= ActiveSupport::StringInquirer.new(ENV[\"CASSANDRA_ENV\"] || ENV[\"RACK_ENV\"] || \"development\")\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 pe_environment(certname)\n environment = catalog_environment(certname)\n if environment\n @environment = environment\n else\n Puppet.debug(\"No Environment found in PuppetDB using: #{certname}\")\n Puppet.debug(\"Querying 'puppet config print environment' for Environment\")\n @environment = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environment --section master', 'combine' => false).chomp\n end\n @environmentpath = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environmentpath --section master', 'combine' => false).chomp\n end",
"def get_environment request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_environment_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Notebooks::V1::Environment.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def pdb_get_environment(facts)\n if facts.is_a?(Hash) && !facts['trusted'].nil? && !facts['trusted']['value'].nil? && !facts['trusted']['value']['extensions'].nil? && !facts['trusted']['value']['extensions']['pp_environment'].nil?\n environment = facts['trusted']['value']['extensions']['pp_environment']\n Puppet.info(\"#{log_prefix} puppet environment for node is: environment=#{environment}\")\n environment\n else\n \"Unknown\"\n end\n end",
"def environment\n node.environment\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 fetch(*args)\n Environment.instance.fetch(*args)\n end",
"def fetch(*args)\n Environment.instance.fetch(*args)\n end",
"def bundle_environment_for(bundle_name)\n bundle_name = bundle_name.to_sym\n return environment[bundle_name] || (next_library.nil? ? {} : next_library.bundle_environment_for(bundle_name))\n end",
"def _env(e_name)\n __t_stringish(e_name)\n _jinja.env[__attribute_key(e_name)]\n end",
"def environment; end",
"def env\n @env ||= env_with_params\nend",
"def source_environment\n return @source_environment\n end",
"def environments\n environment_config.keys\n end",
"def e\n environment\n end",
"def environment\n 'dev'\nend",
"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 default_environment_name\n return nil unless config?\n config.default_environment\n end",
"def env_table\n 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 Sinatra.application.options.env.to_sym\nend",
"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",
"def lookup_environment (varname)\n\n return [\n get_expression_pool.fetch_engine_environment, varname[2..-1]\n ] if varname[0, 2] == '//'\n\n return [\n get_environment.get_root_environment, varname[1..-1]\n ] if varname[0, 1] == '/'\n\n [ get_environment, varname ]\n end",
"def [](key)\n @env[key]\n end",
"def [](key)\n @env[key]\n end",
"def environment\n constituents = @rule.length - 2 # what's present in the environment\n # some env may have been passed by the rules, takes priority\n # combine environment given from rules with original phomo environment\n @environment ||= @rule[2] if constituents >= 1\n env_construct(@environment, @rule[3], @rule[4]) # translate constituents\n end",
"def env; end",
"def env; end"
] |
[
"0.7837903",
"0.7415855",
"0.73646104",
"0.71620494",
"0.701538",
"0.69937277",
"0.695861",
"0.6910788",
"0.6859292",
"0.6824686",
"0.6776314",
"0.6752937",
"0.6747443",
"0.67369485",
"0.67336947",
"0.67184985",
"0.6673791",
"0.6661677",
"0.66139203",
"0.6599444",
"0.6594449",
"0.6578396",
"0.65773594",
"0.6566961",
"0.65612173",
"0.65117526",
"0.6509342",
"0.6496524",
"0.6450825",
"0.6429246",
"0.6429246",
"0.6396237",
"0.6367653",
"0.6359557",
"0.6304804",
"0.62760353",
"0.6252854",
"0.6241881",
"0.6229491",
"0.6218028",
"0.6188951",
"0.61853963",
"0.6171745",
"0.6152225",
"0.61450386",
"0.6143397",
"0.6140014",
"0.61324376",
"0.61302817",
"0.6117547",
"0.6113011",
"0.6106173",
"0.6092428",
"0.6077172",
"0.60683185",
"0.60611767",
"0.60556453",
"0.6051588",
"0.60444534",
"0.60298234",
"0.6011308",
"0.5987052",
"0.5979997",
"0.5978567",
"0.5978567",
"0.59765244",
"0.5973113",
"0.5968411",
"0.5961874",
"0.5955089",
"0.5945922",
"0.5945246",
"0.5919809",
"0.5907546",
"0.58972937",
"0.58765453",
"0.5861709",
"0.58566684",
"0.5847603",
"0.5847603",
"0.5840905",
"0.58406603",
"0.5827254",
"0.5820903",
"0.57836235",
"0.57688606",
"0.5763059",
"0.5753286",
"0.57395643",
"0.5728014",
"0.5725638",
"0.57155275",
"0.5712584",
"0.5707154",
"0.57052463",
"0.5704389",
"0.5704389",
"0.5704023",
"0.5702841",
"0.5702841"
] |
0.6583128
|
21
|
Delegate to the configuration objects
|
def method_missing(meth, *args, &blk)
c.key?(meth.to_s) ? c[meth.to_s] : super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def configurations; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configure\n end",
"def configure\n\t\t\tyield configuration\n\t\tend",
"def config=(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 config; end",
"def method_missing(sym, *args, &block)\n if configuration.respond_to?(sym)\n configuration.send(sym, *args, &block)\n else\n super\n end\n end",
"def config\n\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure; end",
"def config(&block)\n yield(self)\n end",
"def configure \n yield(configuration)\n end",
"def configure(conf)\n super\n end",
"def configure\n\t\t\tyield self\n\t\tend",
"def configure\n\t\t\tyield self\n\t\tend",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure(config={})\n config.each do |(key, val)|\n self.config[key] = val\n end\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield(self)\n end",
"def configure(&block)\n block.call Configuration\n end",
"def configure( &block )\n @configuration = block\n end",
"def configure(&block); end",
"def configure(&block); end",
"def configure\n yield(config)\n end",
"def config_store; end",
"def configure_with(params)\r\n\r\n\t\tend",
"def configure\n yield self\n end",
"def configure\n yield(self)\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def configure\n yield config\n end",
"def set_config(config)\n\t\tend",
"def config\n yield self\n end",
"def config\n yield self\n end",
"def config\n yield self\n end",
"def configure\n yield settings\n end",
"def method_missing(method_name, *arguments, &block)\n if Configuration.instance.respond_to?(method_name)\n Configuration.instance.public_send(method_name, *arguments, &block)\n else\n super\n end\n end",
"def config\n yield self\n end",
"def configure()\n\t\t\tyield self\n\t\tend",
"def configure\n yield self\n\n self\n end",
"def sync_configuration\n end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def configure\n yield self\n end",
"def initialize\n set_config\n end",
"def method_missing(method, *_args, &_block)\n @config.send(method)\n end",
"def configure(&block)\n self.config = Config.new(self)\n config.instance_eval(&block)\n\n attr_accessor *config.accessors\n attr_reader *config.setters.keys\n\n config.setters.each do |name, definition|\n define_method(:\"#{name}=\", definition)\n end\n end",
"def configure\n yield settings\n end",
"def configure\n yield(config)\n end",
"def configure &block\n @config_helper = ConfigHelper.new(&block)\n end",
"def configure(&block)\n self.instance_eval(&block)\n end"
] |
[
"0.7509297",
"0.74577075",
"0.74577075",
"0.74577075",
"0.74577075",
"0.74577075",
"0.7263984",
"0.71717584",
"0.7135995",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.70785147",
"0.7078275",
"0.7012807",
"0.6950958",
"0.6950958",
"0.6950958",
"0.6950958",
"0.69196945",
"0.6901328",
"0.68945915",
"0.6874716",
"0.68728346",
"0.68728346",
"0.6871915",
"0.6871915",
"0.6871915",
"0.6871915",
"0.6871915",
"0.6871915",
"0.6871915",
"0.68425614",
"0.6831128",
"0.6831128",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.6830976",
"0.68044364",
"0.68044364",
"0.6789303",
"0.67602897",
"0.6745499",
"0.67426616",
"0.67426616",
"0.6741859",
"0.6740878",
"0.67329377",
"0.6732307",
"0.67247313",
"0.6724358",
"0.6724358",
"0.6724358",
"0.67201424",
"0.6715105",
"0.6715105",
"0.6715105",
"0.6694301",
"0.6688147",
"0.6673778",
"0.6660308",
"0.6659051",
"0.6657764",
"0.6645847",
"0.6645847",
"0.6645847",
"0.6645847",
"0.6645847",
"0.6645635",
"0.6645635",
"0.6645635",
"0.6645635",
"0.6645635",
"0.66394323",
"0.6639383",
"0.66345084",
"0.66175103",
"0.6608853",
"0.6600057",
"0.65953636"
] |
0.0
|
-1
|
Creates a static route in EOS. May add or overwrite an existing route. ===Commands ip route [router_ip] [distance] [tag ] [name ]
|
def create(destination, nexthop, opts = {})
cmd = "ip route #{destination} #{nexthop}"
cmd << " #{opts[:router_ip]}" if opts[:router_ip]
cmd << " #{opts[:distance]}" if opts[:distance]
cmd << " tag #{opts[:tag]}" if opts[:tag]
cmd << " name #{opts[:name]}" if opts[:name]
configure cmd
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def aws_subnet_route_table_route_to_nat_create(opts)\n AWS::EC2.new.subnets[opts[:subnet_id]].route_table.create_route(\"0.0.0.0/0\", { instance: opts[:instance_id] } )\n end",
"def route(*args)\n Route.new(self, *args)\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end",
"def aws_instance_create_route_to_nat(instance)\n log \"AWS: creating Route for Subnet '#{self.subnet.driver_id}' to NAT Instance '#{self.driver_id}'\"\n self.scenario.subnets.select { |s| s.driver_id and !s.internet_accessible }.each do |subnet|\n aws_call('aws_subnet_route_table_route_to_nat_create', subnet_id: subnet.driver_id, instance_id: instance.id)\n end\n end",
"def add_route(route={})\n request :post, '/routes', route\n end",
"def add_route(*args, &block)\n route = Route.new(*args, &block)\n @routes << route\n route\n end",
"def add_static_route(logical_router_id, static_route, opts = {})\n data, _status_code, _headers = add_static_route_with_http_info(logical_router_id, static_route, opts)\n data\n end",
"def add_route(city1, city2, direction)\n if(node_hash[city1] == nil || node_hash[city2] == nil)\n puts \"INVALID CITY CODES\"\n return\n else\n puts \"Enter route distance\"\n distance = gets\n distance = distance.to_i()\n if(!validate_input(distance))\n puts \"Distance should be positive\"\n return\n end\n if(direction == \"FORWARD\")\n puts \"Adding #{city2} to #{city1} routes\"\n add_city_to_linked(node_hash[city1].linked_cities, city2, distance)\n elsif(direction == \"BACKWARD\")\n puts \"Adding #{city1} to #{city2} routes\"\n add_city_to_linked(node_hash[city2].linked_cities, city1, distance)\n elsif(direction == \"BOTH\")\n puts \"Adding #{city1} to #{city2} routes\"\n puts \"Adding #{city2} to #{city1} routes\"\n if(add_city_to_linked(node_hash[city1].linked_cities, city2, distance) && add_city_to_linked(node_hash[city2].linked_cities, city1, distance))\n route_name = city1.to_s() + \"-\" + city2.to_s()\n routes_hash[route_name] = distance\n end\n else\n puts \"INVALID DIRECTION INPUT\"\n end\n end \n end",
"def create_route(title, distance, locations, mode_of_travel = \"driving\", accepted_deviation = 0)\n begin\n route_class = ModelFabric.get_class(SocialFramework.route_class)\n location_class = ModelFabric.get_class(SocialFramework.location_class)\n\n return unless mode_of_travel == \"driving\" or mode_of_travel == \"bicycling\" or\n mode_of_travel == \"walking\" or mode_of_travel == \"transit\"\n route = route_class.new title: title, distance: distance,\n mode_of_travel: mode_of_travel, accepted_deviation: accepted_deviation\n route.users << self\n route.save\n\n locations.each do |location|\n new_location = location_class.create route: route, latitude: location[:latitude],\n longitude: location[:longitude]\n end\n return route\n rescue\n route.destroy unless route.nil?\n Rails.logger.warn \"Couldn't create route\"\n return\n end\n end",
"def new\n @route = Route.new\n end",
"def add_route(city_code1, city_code2, distance)\n if distance <= 0\n puts 'The distance must be positive'\n return\n end\n if @metros.has_key?(city_code1) && @metros.has_key?(city_code2)\n @metros[city_code1].destination[city_code2] = distance\n end\n end",
"def route(path = T.unsafe(nil)); end",
"def add(entry)\n _check_open!\n ::Dnet.route_add(@handle, entry)\n end",
"def route(args)\n routes=Routes.instance\n (cmd, pattern, dest, opts)=args\n\n d=URI::parse(dest)\n\n case cmd # route [add|remove]\n when :add\n routes.add(pattern, d, opts)\n when :remove\n routes.remove(pattern, d, opts)\n end\nend",
"def add_route(route)\n @routes << route\n route\n end",
"def initialize_routes(data, single)\n data.each do |line|\n @metros[line['ports'][0]].add_distination(line['ports'][1], line['distance'])\n if single == 0\n @metros[line['ports'][1]].add_distination(line['ports'][0], line['distance'])\n end\n end\n end",
"def add(route_id, source_path, target_url, request_method)\n if source_path.start_with?('/admin')\n Rails.logger.error(\"😱 Attempt to add admin route '#{source_path}' was cancelled.\")\n return\n end\n\n route = create_route_object(route_id, source_path, target_url, request_method)\n\n Disraptor::RouteStore.add_route(route_id, route)\n\n return route\n end",
"def add_route(route)\n @stations[@index].departure(self) unless @current_station.nil?\n @stations = route.stations\n @index = 0\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end",
"def create\n\t\t@route = Route.new(params[:route].merge(:user=>current_user))\n\t\t@route.geocode\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @route.save\n\t\t\t\tformat.html { redirect_to(@route, :notice => 'Route was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @route, :status => :created, :location => @route }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def route!( message )\n new.route!( message )\n end",
"def create_route\n return create_route_core unless Station.all.size < 2\n\n show_info_for_action('new Route')\n show_info_you_need_at_least('2 Stations', Station.all.count)\n\n create_station_advanced\n create_route\n end",
"def add_route_rule(name, route_table_name, nat_gateway_name, dest_cidr_block, depends_on: [])\n options = {\n Type: 'AWS::EC2::Route'\n }\n options[:DependsOn] = depends_on unless depends_on.blank?\n resource name,\n options.merge(\n Properties: {\n RouteTableId: ref(route_table_name),\n NatGatewayId: ref(nat_gateway_name),\n DestinationCidrBlock: dest_cidr_block\n })\n end",
"def submitNewRoute(routeId, edgeList)\n com = Sumo::Traci::Command_SetVariable.new(:route, :addRoute,\n routeId, edgeList) ;\n @traciClient.execCommands(com) ;\n end",
"def route() request.route end",
"def route\n #TODO\n end",
"def add(verb, path, options = {}, &block)\n routes << (route = Route.new(path, verb, options, &block))\n route.router = self\n route\n end",
"def routing\n if Vagrant::Util::Platform.darwin?\n @gateway = `route -n get default | grep 'gateway' | awk '{print $2}'`.delete(\"\\n\")\n elsif Vagrant::Util::Platform.linux?\n # Not tested\n @gateway = `ip route show`[/default.*/][/\\d+\\.\\d+\\.\\d+\\.\\d+/]\n end\n\n $vagrant.vm.provision :shell,\n run: \"always\",\n path: File.join(__dir__, \"../\", \"/utils/routing.py\"),\n args: \"#{@gateway}\"\n end",
"def addRoute(route)\n @routes.push route\n addRouteValue(@fromNodeMap, route.startStation, route)\n addRouteValue(@toNodeMap, route.endStation, route)\n end",
"def add_static_route_with_http_info(logical_router_id, static_route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # verify the required parameter 'static_route' is set\n if @api_client.config.client_side_validation && static_route.nil?\n fail ArgumentError, \"Missing the required parameter 'static_route' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes'.sub('{' + 'logical-router-id' + '}', logical_router_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(static_route)\n auth_names = ['BasicAuth']\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 => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#add_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_route(*args)\n route = super\n @named_routes[route.name] = route if route.name\n @generation_key_analyzer << route.generation_keys\n route\n end",
"def route(&block)\n unless block\n RodaPlugins.warn \"no block passed to Roda.route\"\n return\n end\n\n @raw_route_block = block\n @route_block = block = convert_route_block(block)\n @rack_app_route_block = block = rack_app_route_block(block)\n public define_roda_method(:_roda_main_route, 1, &block)\n @app = nil\n end",
"def map(path, options = {}, method = nil, &block)\n route = router.add(path, options)\n route.send(method) if method\n route.to(&block)\n @ins << router unless @ins.last == router\n route\n end",
"def add_route(*p, &b)\n @routes ||= routes.dup\n @routes.route(*p, &b)\n end",
"def add(verb, path, options = {}, &block)\n route = Route.new(path, verb, options, &block)\n route.router = self\n @routes << route\n route\n end",
"def route(&block)\n @router ||= Router.new\n @router.instance_eval(&block)\n end",
"def create_route!(depart, arrive)\n route = Route.new(@stations[depart.to_sym], @stations[arrive.to_sym])\n @routes[route.name.to_sym] = route\n route_created(route.name)\n end",
"def add_station_in_to_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = request_station\n station = getting(request, :approve_station_for_route, :select_station)\n station_added if route.add_station(station)\n end\n end",
"def add(pattern, dest, options)\n options[:prio]=255 unless options[:prio] # default\n @route[pattern]=RouteEntry.new(dest, options)\n end",
"def add(path, options = nil)\n add_route route(path.dup).with_options(options)\n end",
"def create_new_route route_name, type, value\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 << \"/routes/{route_name}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"route_name\" => route_name,\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 \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n typejson = type.to_json\r\n valuejson = value.to_json\r\n bodyjson = \"{\\\"type\\\": #{typejson}, \\\"value\\\": #{valuejson}}\"\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:bodyjson,\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 create_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def gen_route(dep_map)\n text = \"// Dependency Route: #{dep_map[\"class_indexed_name\"]} -> #{dep_map[\"dclass_indexed_name\"]}\\n\"\n temp = 0\n eta = 100\n if(dep_map[\"strength\"].nil?)\n dep_map[\"strength\"] = DEFAULT_SHIPS\n end\n while(temp < dep_map[\"strength\"])\n text += \"var #{dep_map[\"indexed_name\"]}_#{temp} = new Ship({\n name: \\\"#{dep_map[\"indexed_name\"]}_#{temp}\\\",\n material: new THREE.SpriteMaterial({map: trade_texture, color: 0xffffff, fog: true}),\n origin: #{dep_map[\"class_indexed_name\"]}.mesh,\n target: #{dep_map[\"dclass_indexed_name\"]},\n offset: #{eta*temp/dep_map[\"strength\"]},\n eta: #{eta},\n loop: true});\n#{dep_map[\"class_indexed_name\"]}.trade[#{dep_map[\"class_indexed_name\"]}.trade.length] = #{dep_map[\"indexed_name\"]}_#{temp};\n#{dep_map[\"indexed_name\"]}_#{temp}.spr.scale.set(2,2,1);\\n\\n\"\n temp += 1\n end\n return text\nend",
"def add_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end",
"def route\n @route\n end",
"def <<(route)\n unless route.is_valid_route?\n @errors += \"Route #{route.start_city}-#{route.end_city}#{route.distance} is invalid\\n\"\n end\n self.push route\n end",
"def route(path, opts = {}, &block)\n @@routes << [path, opts, block]\n end",
"def create(app_guid, space_guid, domain_guid, host = nil)\n app = @client.app(app_guid)\n space = @client.space(space_guid)\n domain = @client.domain(domain_guid)\n\n route = @client.routes.find { |rt|\n rt.host == host && rt.domain == domain && rt.space == space\n }\n\n unless route\n route = @client.route\n\n route.host = host if host != nil #app_name if app_name != nil\n route.domain = domain\n route.space = space\n route.create!\n end\n\n #@client.app(app_guid) will get an empty instance of Application, so we check that guid exists\n if app.guid\n app.add_route(route)\n end\n route\n end",
"def nat_gateway_init(name, subnet_name, route_table_name, dest_cidr_block: '0.0.0.0/0', depends_on: [])\n nat_gateway_eip_name = \"#{name}EIP\"\n nat_gateway_eip = allocate_new_eip(nat_gateway_eip_name, depends_on: depends_on)\n nat_gateway_name = name\n nat_gateway_options = {\n Type: 'AWS::EC2::NatGateway'\n }\n nat_gateway_options[:DependsOn] = depends_on unless depends_on.blank?\n resource nat_gateway_name,\n nat_gateway_options.merge(\n Properties: {\n AllocationId: nat_gateway_eip,\n SubnetId: ref(subnet_name)\n })\n nat_route_rule_name = \"#{name}Route\"\n add_route_rule(nat_route_rule_name, route_table_name, nat_gateway_name, dest_cidr_block, depends_on: depends_on)\n\n output nat_gateway_name,\n Description: 'NAT Gateway',\n Value: ref(nat_gateway_name)\n\n nat_gateway_name\n end",
"def initialize\n @router = Router.new(ROUTES)\n end",
"def route(identifier, params={}, &block)\n # Require block\n raise ArgumentError.new(\"#route requires a block\") unless block_given?\n\n # Get rep name\n rep_name = params[:rep] || :default\n\n # Create rule\n rule = Rule.new(identifier_to_regex(identifier), rep_name, block)\n @site.compiler.item_routing_rules << rule\n end",
"def add_route(subnet, mask, comm)\n # If a bitmask was supplied, convert it.\n netmask = (mask.to_s =~ /^\\d+$/) ? Rex::Socket.bit2netmask(mask.to_i) : mask\n rv = true\n\n _init\n\n mutex.synchronize {\n # If the route already exists, return false to the caller.\n if (route_exists?(subnet, netmask) == false)\n self.routes << Route.new(subnet, netmask, comm)\n else\n rv = false\n end\n }\n\n rv\n end",
"def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end",
"def create\n @route = Route.new(route_params)\n @route.save\n\n redirect_to '/routes/map/'+@route.map_id.to_s\n end",
"def initialize( routes=[], options={} )\n\t\troutes.each do |tuple|\n\t\t\tself.log.debug \" adding route: %p\" % [ tuple ]\n\t\t\tself.add_route( *tuple )\n\t\tend\n\tend",
"def add_route path, controller, &block\n\t\t\t\t@active_host ||= add_host :default\n\t\t\t\t@active_host.routes << ::Plezi::Base::Route.new(path, controller, &block)\n\t\t\tend",
"def for(path, *args)\n arg = args[0]\n log.debug \"Adding route, path: #{path}, args: #{args.inspect}\"\n\n match = get_regex_for_route(path, arg)\n hash = get_to_hash(arg)\n route_info = {:regex => match[:regex], :args => arg, :vars => match[:vars], :hash => hash}\n \n # Add the HTTP methods for this route if they exist in options\n route_info[:methods] = arg[:methods] if not arg.nil? and arg.has_key? :methods\n \n self.routes.push(route_info)\n end",
"def create\n @route = Route.create(route_args)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_route( verb, path, route )\n\t\tre = Regexp.compile( '^' + path.join('/') + '$' )\n\n\t\t# Make the Hash for the specified HTTP verb if it hasn't been created already\n\t\tself.routes[ re ][ verb ] = route\n\tend",
"def route(from, to, options = {})\n if from && to\n options[:to] = to\n options[:from] = from\n call_api self, @mapquest.version, 'route', options\n else\n raise ArgumentError, 'The method must receive the to, and from parameters'\n end\n end",
"def add_route( rule, output_channel )\n validate_arguments( binding() )\n routes.push( RouteSpecification.new( rule, output_channel ) )\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to admin_route_url(@route), notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: admin_route_url(@route) }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_an_inbound_route(body)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/v2/routes'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept': 'application/vnd.api+json',\r\n 'content-type' => 'application/vnd.api+json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_s\r\n )\r\n\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Unauthorized – There was an issue with your API credentials.',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'The specified resource was not found',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n \r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def add_waypoint _center, _radius, _index=-1\n if _index == -1\n _wp = Rarmalib::SQF::Waypoint.new @this, _center, _radius\n else\n _wp = Rarmalib::SQF::Waypoint.new @this, _center, _radius, _index\n end\n _wp\n end",
"def register(route, command, action = nil)\n if @route_map.has_key?(route)\n raise(Imp::RouterError, \"Route name cannot be defined twice: #{route}\")\n end\n\n @route_map[route] = { :command => command, :action => action }\n nil\n end",
"def set_route\n route = Gmaps4rails.destination({\"from\" =>address_start, \"to\" =>address_end},{},\"pretty\")\n\n self.distance = route[0][\"distance\"][\"value\"]\n self.duration = route[0][\"duration\"][\"value\"]\n end",
"def create\n @route = Route.new(route_params)\n @route.driver_id = @driver.id\n respond_to do |format|\n if @route.save\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def route14\n end",
"def route(*args)\n @app.log << \"route #{args.inspect[1..-2]}\"\n @app.route(*args)\nend",
"def set_route\n #puts \"set route #{params}\"\n @myroute = Route.find(params[:id])\n puts \"set route #{@myroute.inspect}\"\n end",
"def create\n feature_enable unless feature_enabled\n X__RESOURCE_NAME__X_router\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n flash[:notice] = 'Route was created successfully.'\n format.html { redirect_to routes_path }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @route = Route.new route_params\n end",
"def process_route(args, file_path)\n File.open(file_path, 'a') do |f|\n # write to file\n str = \"`#{args[0].upcase} #{args[1]}`\"\n f << str\n f << \"\\n\"\n end\n end",
"def add(path, vertical=nil)\n sr = path\n sr = SimpleRoute.new(path) unless path.is_a?(SimpleRoute)\n self << sr\n @by_path[path] = sr\n @by_name[sr.name] = sr\n add_to_vertical(sr, vertical) if vertical\n end",
"def route( key, &block )\n @routes[key] = compile!(\"route_#{key}\", &block)\n end",
"def route(path, controller = nil, &block)\n\t\tunless @active_router\n\t\t\tGReactor.warn \"You should define a listener before adding a route - use `Plezi.listen`.\\nCreating a default (empty) listener.\"\n\t\t\tPlezi.listen\n\t\tend\n\t\t@routers_locker.synchronize { @active_router.add_route path, controller, &block }\n\tend",
"def add_route(*args)\n custom_routes << args\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to(@route, :notice => 'Route was successfully created.') }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def route(pattern, options={})\n options[:builder] ||= GentleREST::RouteBuilder\n builder_class = options[:builder]\n begin\n builder = builder_class.new(pattern, options)\n rescue ArgumentError\n raise ArgumentError,\n \"A RouteBuilder class must take a pattern and an \" +\n \"options Hash as parameters in its initialize method.\" \n end\n if builder.respond_to?(:generate)\n new_routes = builder.generate\n new_routes.each do |route|\n if !route.kind_of?(GentleREST::Route)\n raise TypeError,\n \"Expected GentleREST::Route, got #{route.class.name}.\"\n end\n self.routes << route\n end\n new_routes\n else\n raise TypeError,\n \"An instantiated builder class must respond to the \" +\n \":generate message.\"\n end\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def with_temp_route(dest, gw, iface)\n Mutex.synchronize do\n begin\n add_route dest, gw, iface, 'monitor'\n `ip -4 rule add to #{dest} lookup monitor`\n yield\n\n ensure\n `ip -4 rule del to #{dest} lookup monitor`\n del_route dest, gw, iface, 'monitor'\n end\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end"
] |
[
"0.6502786",
"0.6321983",
"0.61906475",
"0.6159985",
"0.61007744",
"0.5989231",
"0.5970386",
"0.59586877",
"0.58476424",
"0.5817613",
"0.5803689",
"0.57613295",
"0.57404864",
"0.573992",
"0.57376033",
"0.56921756",
"0.5672304",
"0.5646193",
"0.5639679",
"0.5638072",
"0.5621057",
"0.5619721",
"0.5590007",
"0.5566892",
"0.5561209",
"0.55341625",
"0.5527753",
"0.55252326",
"0.55050457",
"0.5498393",
"0.5497249",
"0.548329",
"0.5453834",
"0.54463446",
"0.5426577",
"0.5426277",
"0.540374",
"0.53957814",
"0.5377277",
"0.5375045",
"0.53130597",
"0.53075236",
"0.53075236",
"0.53068304",
"0.53001934",
"0.52754813",
"0.5274027",
"0.52704775",
"0.5257758",
"0.5246904",
"0.5243935",
"0.52428",
"0.52279973",
"0.52276367",
"0.5224777",
"0.5222774",
"0.52078986",
"0.5204732",
"0.5201164",
"0.5195416",
"0.5190316",
"0.51873183",
"0.518731",
"0.5181333",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51511145",
"0.51499563",
"0.5147543",
"0.5135729",
"0.51177293",
"0.51170886",
"0.5116342",
"0.51138544",
"0.5112146",
"0.51091784",
"0.5100457",
"0.5087566",
"0.50849915",
"0.50814664",
"0.50785244",
"0.50785035",
"0.5076587",
"0.50659144",
"0.5065545",
"0.5065545",
"0.5065545",
"0.5063396",
"0.50539255",
"0.5052612"
] |
0.7125344
|
0
|
Removes a given route from EOS. May remove multiple routes if nexthop is not specified. ===Commands no ip route [nexthop]
|
def delete(destination, nexthop = nil)
cmd = "no ip route #{destination}"
cmd << " #{nexthop}" if nexthop
configure cmd
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_route(route={})\n request :delete, '/routes', route\n end",
"def remove(route)\n @route_map.delete(route)\n nil\n end",
"def delete_station_in_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter station name [#{all_stations(route)}]: \"]\n station = getting(request, :approve_station_for_route, :select_station)\n station_deleted if route.delete_station(station)\n end\n end",
"def remove(route_id)\n return Disraptor::RouteStore.remove_route(route_id)\n end",
"def delete_route!(name)\n route_added_to_list if @routes.delete(name.to_sym)\n end",
"def remove_station_from_route(route)\n available_stations = route.stations.select do |item|\n item != route.stations.first && item != route.stations.last\n end\n\n unless available_stations.empty?\n return remove_station_from_route_core(available_stations, route)\n end\n\n show_info_for_action('removing Station from Route')\n show_info_you_need_at_least('1 Station in Route', 0)\n\n add_station_to_route_advanced(route)\n manage_stations_in_route\n end",
"def remove_route(subnet, netmask, gateway)\n\t\trequest = Packet.create_request('stdapi_net_config_remove_route')\n\n\t\trequest.add_tlv(TLV_TYPE_SUBNET_STRING, subnet)\n\t\trequest.add_tlv(TLV_TYPE_NETMASK_STRING, netmask)\n\t\trequest.add_tlv(TLV_TYPE_GATEWAY_STRING, gateway)\n\n\t\tresponse = client.send_request(request)\n\n\t\treturn true\n\tend",
"def delete_route(path, options = nil)\n route = get_route(path, options)\n root.delete(route)\n routes.replace(root.unique_routes)\n build_grapher!\n route\n end",
"def remove_route(value)\n @children['route'][:value].delete(value)\n end",
"def delete_route(path, options = nil)\n route = get_route(path, options)\n @root.delete(route)\n @routes = @root.unique_routes\n rebuild_grapher!\n route\n end",
"def remove_route(subnet, mask, comm)\n # If a bitmask was supplied, convert it.\n netmask = (mask.to_s =~ /^\\d+$/) ? Rex::Socket.bit2netmask(mask.to_i) : mask\n rv = false\n\n _init\n\n mutex.synchronize {\n self.routes.delete_if { |route|\n if (route.subnet == subnet and route.netmask == netmask and route.comm == comm)\n rv = true\n else\n false\n end\n }\n }\n\n rv\n end",
"def delete(route_guid)\n route = @client.route(route_guid)\n route.delete!\n end",
"def remove_route(city1, city2, direction)\n if(node_hash[city1] == nil || node_hash[city2] == nil)\n puts \"INVALID CITY CODES\"\n return\n else\n if(direction == \"FORWARD\")\n puts \"Removing #{city2} from #{city1} routes\"\n remove_city_from_linked(node_hash[city1].linked_cities, city2)\n elsif(direction == \"BACKWARD\")\n puts \"Removing #{city1} from #{city2} routes\"\n remove_city_from_linked(node_hash[city2].linked_cities, city1)\n elsif(direction == \"BOTH\")\n puts \"Removing #{city1} from #{city2} routes\"\n puts \"Removing #{city2} from #{city1} routes\"\n remove_city_from_linked(node_hash[city1].linked_cities, city2)\n remove_city_from_linked(node_hash[city2].linked_cities, city1)\n else\n puts \"INVALID DIRECTION INPUT\"\n end\n end\n end",
"def remove_single_route(city_code1, city_code2)\n if @metros.has_key?(city_code1) && @metros.has_key?(city_code2)\n @metros[city_code1].destination.delete(city_code2)\n end\n end",
"def destroy\n Rails.logger.info('👻 Disraptor: Destroying route.')\n\n if Disraptor::Route.remove(params[:route_id])\n Rails.application.reload_routes!\n\n render json: success_json\n else\n render json: failed_json\n end\n end",
"def drop_route(t_obj, value)\n t_obj.drop_route_id = @routes.detect{|r| r.name == value}.try(:id)\n end",
"def delete_l7route(lb_id, config_id, id, headers = {})\n res = delete!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n check_job(res.body[\"job_id\"], headers)\n end",
"def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def cmd_clear_routes argv\n setup argv\n response = @api.clear_routes\n msg response\n return response\n end",
"def delete\n unless params[:route_id]\n render status: :bad_request, json: {error: 'route_id must be provided'}\n return\n end\n\n route = Route.where(id: params[:route_id]).first\n unless route.present?\n render status: :bad_request, json: {error: 'No route found with provided route_id'}\n return\n end\n\n unless route.user_id == current_user.id\n render status: :unauthorized, json: {error: 'Routes can only be deleted by the owner'}\n return\n end\n\n route.destroy\n\n render nothing:true\n end",
"def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end",
"def removeAddr( node_id )\n for addr in @routing_table.keys\n if @routing_table[addr][\"node_id\"] == node_id\n @routing_table.delete([addr])\n end\n end\n end",
"def remove_by_comm(comm)\n _init\n mutex.synchronize {\n routes.delete_if { |route|\n route.comm == comm\n }\n }\n end",
"def manage_routes_delete_station\n @ui.manage_routes_delete_station_msg(routes, stations)\n route_name = gets.chomp\n route = routes.find { |route_elem| route_elem.name == route_name }\n validate_route_for_delete!\n @ui.manage_routes_delete_station_input_station_msg(route)\n station_name = gets.chomp\n validate_route_deletion!\n manage_routes_delete_station_delete(route_name, station_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end",
"def delete_router_interface(router, id, type)\n data = case type\n when 'port' then { 'port_id' => id }\n when 'subnet' then { 'subnet_id' => id } \n else raise \"Invalid Interface Type\" \n end\n return put_request(address(\"routers/\" + router + \"/remove_router_interface\"), data, @token)\n end",
"def removeAddr(node_id)\n for addr in @routing_table.keys\n if @routing_table[addr][\"node_id\"] == node_id\n @routing_table.delete([addr])\n end\n end\n end",
"def destroy\n @route = Route.find(params[:id]) \n \n if @route.fellow_id\n route = @route\n tmp_route = Route.find(@route.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n @route.destroy\n \n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def remove_weakest_individual\n sort_routes\n @routes = @routes[0..-2]\n end",
"def delete_router(router)\n return delete_request(address(\"routers/\" + router), @token)\n end",
"def delete_router_gateway(router)\n data = { 'router' => {'external_gateway_info' => nil}}\n return put_request(address('routers/' + router), data, @token)\n end",
"def delete(name, action, seqno)\n configure([\"no route-map #{name} #{action} #{seqno}\"])\n end",
"def rd_route client, server_type, msg, &block\n end",
"def destroy\n\t photos = @route.assets\t\t\t\t\t#delete photos associated with given route\n\t delete_photos(photos)\t\t\t\t\t\t#\n\t event = Event.find_by_route_id(@route.id)\n\t unless event.nil?\n\t @route.update_attributes(:user_id => event.user_id)\t\n\t\tuser = User.find(event.user_id)\n\t\tflash[:success] = \"Route was handed to another user (it is still used in an event): #{user.email}!\"\n\t\tredirect_to current_user\n\t else\n\t\t@route.destroy\n\t\tflash[:success] = \"Route was deleted!\"\n\t\tredirect_to current_user\n\t end\n\tend",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.delete\n respond_to do |format|\n format.html { redirect_to routes_url, notice: t(\"routes.deleted\") }\n format.json { head :no_content }\n end\n end",
"def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n named_routes.delete(name)\n end",
"def stop_path\n # force_move_route(EMPTY_MOVE_ROUTE)\n clear_path\n Pathfinding.remove_request(self)\n end",
"def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n @named_routes.delete(name)\n end",
"def unlink(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::UNLINK, path, to, as, constraints, &blk)\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end",
"def excluir(telefone)\n @client.delete(Route.new([ROTA_BINA, telefone]))\n end",
"def asr_delete_router(router_id)\n elektron_networking.delete(\"/asr1k/routers/#{router_id}\").body\n end",
"def destroy\n router_bgp('no')\n end",
"def remove_netif(opts)\n do_remove_netif(opts[:netif].name)\n end",
"def remove_server(server, vrf = nil)\n configure(\"no ntp server #{vrf.nil? ? '' : \"vrf #{vrf} \"}#{server}\")\n end",
"def reset_routes(routes=[])\n request :put, '/routes', routes\n end",
"def destroy\n @ht_route.destroy\n respond_to do |format|\n format.html { redirect_to ht_routes_url, notice: 'Ht route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def apps_app_routes_route_delete(app, route, opts = {})\n apps_app_routes_route_delete_with_http_info(app, route, opts)\n return nil\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def move_train_backward_by_route\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter the train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train_moved_backward if train.move_train_backward\n end\n end",
"def delete(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::DELETE, path, to, as, constraints, &blk)\n end",
"def delete_static_route(logical_router_id, id, opts = {})\n delete_static_route_with_http_info(logical_router_id, id, opts)\n nil\n end",
"def remove_netif(opts)\n\n end",
"def remove_netif(opts)\n\n end",
"def remove_netif(opts)\n\n end",
"def remove_double_route(city_code1, city_code2)\n if @metros.has_key?(city_code1) && @metros.has_key?(city_code2)\n @metros[city_code1].destination.delete(city_code2)\n @metros[city_code2].destination.delete(city_code1)\n end\n end",
"def destroy\n @favorite_route.destroy\n end",
"def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end",
"def destroy_route\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url, :notice => t(\".destroyed\") }\n format.json { render :json => @route.as_json(json: 'wall') }\n end\n end",
"def remove(options = {})\n requires :ip\n raise Fog::Errors::Error.new('Ip is not attached to a server.') if serverid.nil?\n data = service.ip_remove({:ipaddress => ip}.merge!(options)).body[\"response\"][\"details\"]\n merge_attributes data\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to admin_routes_url, notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end",
"def remove(target_ip)\n @targets.delete target_ip\n @arp_packets.delete target_ip\n end",
"def remove_all_ospfs\n require_relative '../lib/cisco_node_utils/router_ospf'\n RouterOspf.routers.each do |_, obj|\n obj.destroy\n end\n end",
"def destroy\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url, :notice => t(\".destroyed\") }\n format.json { head :no_content }\n end\n end",
"def delete options = {}\n run_callbacks :destroy do\n @catalog.purge({@route => @name}, options) unless new?\n clear\n self\n end\n end",
"def create(destination, nexthop, opts = {})\n cmd = \"ip route #{destination} #{nexthop}\"\n cmd << \" #{opts[:router_ip]}\" if opts[:router_ip]\n cmd << \" #{opts[:distance]}\" if opts[:distance]\n cmd << \" tag #{opts[:tag]}\" if opts[:tag]\n cmd << \" name #{opts[:name]}\" if opts[:name]\n configure cmd\n end",
"def route(args)\n routes=Routes.instance\n (cmd, pattern, dest, opts)=args\n\n d=URI::parse(dest)\n\n case cmd # route [add|remove]\n when :add\n routes.add(pattern, d, opts)\n when :remove\n routes.remove(pattern, d, opts)\n end\nend",
"def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def remove(p)\n @first = counterclockwise(@first) if @first.equal?(p)\n @first = nil if @first.equal?(p)\n @neighbors.delete(p)\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url, notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url, notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url, notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to routes_url, notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @train_route.destroy\n respond_to do |format|\n format.html { redirect_to train_routes_url, notice: 'TrainRoute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end",
"def destroy\n @admin_route = Admin::Route.find(params[:id])\n @admin_route.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_routes_url }\n format.json { head :no_content }\n end\n end",
"def process_route_end\n if @move_route.repeat\n @move_route_index = -1\n elsif @move_route_forcing\n @move_route_forcing = false\n restore_move_route\n end\n end",
"def destroy\n @completed_route = CompletedRoute.find(params[:id])\n @completed_route.destroy\n\n respond_to do |format|\n format.html { redirect_to(completed_routes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def edit(route_id, source_path, target_url, request_method)\n if Disraptor::RouteStore.has_route(route_id)\n Disraptor::RouteStore.remove_route(route_id)\n end\n\n return add(route_id, source_path, target_url, request_method)\n end",
"def add_route(route)\n @stations[@index].departure(self) unless @current_station.nil?\n @stations = route.stations\n @index = 0\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end",
"def remove_event(event)\n participant_event = get_participant_event(event)\n\n if not participant_event.nil? and participant_event.role == \"creator\"\n event.route.destroy unless event.route.nil?\n event.destroy\n end\n end",
"def remove_server(server)\n @server.delete(server.uri)\n end",
"def delete(opt)\n raise \"Missing vlan_id\" unless opt[:vlan_id]\n raise \"Missing link\" unless opt[:link]\n link = list(:link=>opt[:link]).find { |l|\n l.linkinfo.data &&\n l.linkinfo.data.id == opt[:vlan_id]\n }\n raise Errno::ENODEV unless link\n @rtsocket.link.delete(link.index)\n end",
"def delete(opt)\n ipaddr_modify(RTM_DELADDR, 0, opt)\n end",
"def ensure_route(route)\n unless self.routes.member?(route) or route.blank?\n self.routes << route\n end\n end",
"def delete\n config = get\n return true unless config\n configure(\"no router bgp #{config[:bgp_as]}\")\n end",
"def destroy\n @bus_route = BusRoute.find(params[:id])\n @bus_route.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_routes_url }\n format.json { head :no_content }\n end\n end",
"def remove(pattern, dest, options)\n [:remove, pattern, dest, options]\nend",
"def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def apps_app_routes_route_delete_with_http_info(app, route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutesApi.apps_app_routes_route_delete ...\"\n end\n # verify the required parameter 'app' is set\n if @api_client.config.client_side_validation && app.nil?\n fail ArgumentError, \"Missing the required parameter 'app' when calling RoutesApi.apps_app_routes_route_delete\"\n end\n # verify the required parameter 'route' is set\n if @api_client.config.client_side_validation && route.nil?\n fail ArgumentError, \"Missing the required parameter 'route' when calling RoutesApi.apps_app_routes_route_delete\"\n end\n # resource path\n local_var_path = \"/apps/{app}/routes/{route}\".sub('{' + 'app' + '}', app.to_s).sub('{' + 'route' + '}', route.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 = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutesApi#apps_app_routes_route_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.733061",
"0.7047446",
"0.63307446",
"0.63004726",
"0.6192135",
"0.618163",
"0.6146836",
"0.6108581",
"0.6082754",
"0.6015169",
"0.5966243",
"0.57931566",
"0.5768936",
"0.57113594",
"0.5670663",
"0.56609005",
"0.56481063",
"0.5642889",
"0.5642889",
"0.56135625",
"0.55898654",
"0.55736816",
"0.5476509",
"0.54317844",
"0.5424105",
"0.5377007",
"0.5370923",
"0.5344356",
"0.53384435",
"0.53071123",
"0.5271619",
"0.5261636",
"0.5258761",
"0.5252092",
"0.52447414",
"0.52447414",
"0.52447414",
"0.52447414",
"0.52136755",
"0.52121556",
"0.5203047",
"0.51824284",
"0.51724625",
"0.51599234",
"0.51599234",
"0.5153648",
"0.51462865",
"0.5100928",
"0.5098531",
"0.5084806",
"0.50840855",
"0.508059",
"0.50785244",
"0.5064839",
"0.5064839",
"0.5064839",
"0.50639033",
"0.50515616",
"0.5048185",
"0.5046886",
"0.5046886",
"0.5046886",
"0.50348544",
"0.5033105",
"0.50295544",
"0.5002169",
"0.49948928",
"0.49876353",
"0.49835023",
"0.49599236",
"0.49541733",
"0.4951202",
"0.49473977",
"0.49352908",
"0.49229288",
"0.49208605",
"0.4916214",
"0.4912359",
"0.49107128",
"0.49107128",
"0.49107128",
"0.49107128",
"0.48965308",
"0.48818454",
"0.4878112",
"0.48575982",
"0.48308402",
"0.48286325",
"0.48250994",
"0.48191532",
"0.4816002",
"0.48036483",
"0.47966418",
"0.4790595",
"0.4787566",
"0.47772968",
"0.47765398",
"0.47763142",
"0.4770619",
"0.4766124"
] |
0.7019449
|
2
|
Validates that role exists in config file
|
def role_valid
if (APP_CONFIG["user_roles"]+SYSTEM_DATA["user_roles"]).select{|role| role["name"] == self.role}.empty?
errors.add(:role, "Role does not exist in config")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate(role, _environments, cookbooks, roles) # rubocop:disable CyclomaticComplexity\n # validate the role passed in match the name of either the .rb or .json\n file = %W{roles/#{role}.rb roles/#{role}.json}.find { |f| File.exist?(f) }\n role = role.split(\"/\").last if role =~ /\\// # pull out directories\n if file\n c_role = evaluate_c_role(file)\n Spiceweasel::Log.debug(\"role: '#{role}' name: '#{c_role.name}'\")\n unless role.eql?(c_role.name)\n STDERR.puts \"ERROR: Role '#{role}' listed in the manifest does not match the name '#{c_role.name}' within the #{file} file.\"\n exit(-1)\n end\n role_run_list(c_role, cookbooks, role, roles)\n else # role is not here\n STDERR.puts \"ERROR: Invalid Role '#{role}' listed in the manifest but not found in the roles directory.\"\n exit(-1)\n end\n end",
"def role_valid\n if !role_data\n errors.add(:role, :invalid)\n end\n end",
"def role_given?\n self.resources_configuration[:self][:role].present?\n end",
"def role_exists?\n roles.presence\n end",
"def validates_role\n self.role = Role.find_by_name \"Technician\" if self.role.nil?\n end",
"def validate\n return false if @role_array.empty?\n\n @role_array.each do |role|\n return false unless ROLES[role]\n end\n\n return true\n end",
"def check_role(role_name)\n role = Role.find_by_name(role_name)\n unless roles.include?(role)\n roles << role\n end\n end",
"def has_role?(role)\n if self.roles.exists? then\n self.roles.find_by(:name => role).present?\n end\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def role? role_name\n self.roles.exists? name: role_name.to_s\n end",
"def has_role?(name)\r\n roles.include?(name.to_s)\r\n end",
"def has_role?\n Role.roles.include? role.try(:name)\n end",
"def has_role?(role) \n return self.roles.include?(role)\n end",
"def role?(role)\n roles.include? role\n end",
"def role?(role)\n roles && roles.include?(role)\n end",
"def has_role?(role)\n role_symbols.include? role\n end",
"def check_for_role\n self.role = ROLES[:user] if self.role.nil?\n end",
"def check_role!\n add_role :user if roles.blank?\n if has_role?(:admin)\n add_role :editor unless has_role?(:editor)\n add_role :user unless has_role?(:user)\n end\n end",
"def role_required?\n @role_required || false\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s)\n end",
"def role?(role)\n \troles.include? role.to_s\n end",
"def has_role?(role_name, resource = nil)\n has_role_helper(role_name, resource)\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def must_have_a_role\n errors.add(:roles, \"Must have a staff or admin role\") unless admin_or_staff?\n end",
"def has_role?(role)\n self.roles_cached.nil? ? false : self.roles_cached.split(',').include?(role)\n end",
"def has_role?(name)\n !roles.find_by('lower(name) = ?', name.downcase).nil?\n end",
"def have_role? role\r\n self.roles ||= []\r\n my_holes = self.roles.collect {|r| r.name.to_s }\r\n my_holes.include? role.to_s\r\n end",
"def has_role?(arg) \n if arg.is_a?(Array)\n required_roles = arg.collect {|role| role.to_s}\n else\n required_roles = arg.to_s.to_a\n end\n not (self.roles.to_s.split(' ') & required_roles).empty?\n end",
"def validate_aws_config_file!\n config_file = config[:aws_config_file]\n Chef::Log.debug \"Using AWS config file at #{config_file}\"\n\n raise ArgumentError, \"The provided --aws_config_file (#{config_file}) cannot be found on disk.\" unless File.exist?(config_file)\n\n aws_config = ini_parse(File.read(config_file))\n profile_key = config[:aws_profile]\n profile_key = \"profile #{profile_key}\" if profile_key != \"default\"\n\n unless aws_config.values.empty?\n if aws_config[profile_key]\n config[:region] = aws_config[profile_key][\"region\"]\n else\n raise ArgumentError, \"The provided --aws-profile '#{profile_key}' is invalid.\"\n end\n end\n end",
"def has_role?(role)\n role = role.name if role.is_a?(Role)\n self.my_roles.include?(role)\n end",
"def exists?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :exists\n end\n false\n end",
"def isAnsibleRole?(path)\n begin\n Dir.foreach(path) { |entry|\n if File.directory?(path+\"/\"+entry) and\n [\"tasks\", \"vars\"].include?(entry)\n return true # https://knowyourmeme.com/memes/close-enough\n elsif [\"metadata.rb\", \"recipes\"].include?(entry)\n return false\n end\n }\n rescue Errno::ENOTDIR\n end\n false\n end",
"def role?(role_name)\n Array(self[:roles]).include?(role_name)\n end",
"def role?(role)\n\t self.role.name == role\n end",
"def role?(role_name)\n role == role_name\n \n end",
"def valid_role?(role)\n redirect_to root_path(locale: I18n.locale), :notice => t('shared.msgs.not_authorized') if !current_user || !((role.is_a?(String) && current_user.is?(role)) || (role.is_a?(Array) && role.include?(current_user.role.name)))\n end",
"def role_allowed?(required_role)\n if role_hierarchy.find_index(required_role.to_sym)\n role_hierarchy.find_index(role.to_sym) >= role_hierarchy.find_index(required_role.to_sym)\n else\n false\n end\n end",
"def role?(role)\n !(roles.map(&:name) & Array(role)).empty?\n end",
"def role?(role) \n roles.any? { |r| r.name.underscore.to_sym == role } \n end",
"def has_role( role_name )\n role_name = role_name.to_s\n role = get_role( role_name ) \n role = Role.create( :name => role_name ) if role.nil?\n self.roles << role if role and not self.roles.exists?( role.id )\n end",
"def role?(role)\n roles.pluck(:name).include? role.to_s\n end",
"def check_for_role\n\t\tself.role = ROLES[:user] if !self.role.present?\n\tend",
"def has_role(r)\n self.role == r\n end",
"def exists?\n begin\n rbac_role_resource.head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n false\n end\n end",
"def check_for_role\n\t\tself.role = ROLES[:user] if self.role.nil?\n\tend",
"def has_role?(role)\n role_list ||= roles.map(&:name)\n role_list.include?(role.to_s) || role_list.include?(User::JEDI_MASTER_ROLE)\n end",
"def invalid_role?\r\n self.role.blank? || self.role < 0\r\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 role?\n false\n end",
"def check_role(role_name)\n all_roles = Role.all\n r = nil\n all_roles.each do |role|\n if role.name == role_name\n r = role\n end\n end\n\n unless r.nil?\n return self.roles.include?(r)\n end\n \n return false\n end",
"def check_env_files(role_manifest, dev_env)\n vars = role_manifest['configuration']['variables']\n dev_env.each_pair do |name, (env_file, value)|\n next if Common.special_env(name)\n i = vars.find_index{ |x| x['name'] == name }\n next unless i.nil?\n STDOUT.puts \"dev env var #{name.red} defined in #{env_file.red} does not exist in role manifest\"\n @has_errors += 1\n end\nend",
"def has_role?(role_name)\n if user_roles\n roles = user_roles.data.map do |role|\n role.name\n end\n\n roles.include?(role_name)\n end\n end",
"def has?(role)\n role_id = (role.class <= Rend::Acl::Role) ? role.id : role.to_s\n roles.has_key?(role_id)\n end",
"def has_role?(role_name) # rubocop:disable Naming/PredicateName\n role&.name == role_name.to_s\n end",
"def allowed?\n @roles.any? { |r| r.to_s.downcase == Account.find(@account_id).role.downcase }\n 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_admin\n ac = AdminConfigFile.new\n ac.read\n @admin = ac.exist?(@user_id)\n end",
"def has_role?(role)\n roles.where(name: Role::NAMES[role]).exists?\n #cached_roles.map(&:name).include?(Role::NAMES[role])\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def has_role?(role, unit = nil)\n if unit\n unit = Unit.find(unit) unless unit.is_a?(Unit)\n roles.for(unit.id).collect(&:to_sym).include?(role.to_sym) || roles.for(nil).collect(&:to_sym).include?(role.to_sym)\n else\n roles.collect(&:to_sym).include?(role.to_sym)\n end\n end",
"def has_role?( role )\n\t\treturn self.role.title.to_sym == role if self.role\n\t\tfalse\n\tend",
"def has_spree_role?(role_name)\n spree_roles.exists?(name: role_name)\n end",
"def has_spree_role?(role_name)\n spree_roles.exists?(name: role_name)\n end",
"def role?(value)\n roles.include?(value.to_s)\n end",
"def has_no_role?\n self.roles.where(\"name != 'errata'\").empty?\n end",
"def role?\n role.name.to_sym\n end",
"def has_role?(role)\n roles.map {|r| r.to_s.downcase}.include?(role.to_s.downcase)\n end",
"def has_role?(role)\n # User master always have access to all\n # Given a nil role or a blank list also retun access granted\n return true if role.blank?\n list ||= self.roles.collect(&:name)\n role.is_a?(Array) ? rolelist = role : rolelist = [role]\n rolelist.any? { |r| list.include?(r.to_s) } || list.include?('admin') || self.master?\n end",
"def has_role_blank?( user_role )\n self.role_id.blank?\n end",
"def has_role?(name)\n role = Role.find_by_name(name)\n # does the role even exist?\n return false unless role != nil\n # role exists, is the user in it?\n return self.roles.first(:conditions => {:name => name}) != nil\n end",
"def has_role?(role_name)\n return false unless User.roles.keys.include?(role_name)\n r = User.roles[role_name]\n self.role & (1 << r) != 0\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s.camelize)\n end",
"def role?(role)\n roles.any? {|r| r.name.underscore.to_sym == role}\n end",
"def validate_config!\n valid = false\n begin\n names_to_ids # Force re-evaluation of ids\n valid = (!image_id.nil? && !flavor_id.nil? && !region_id.nil?)\n rescue Excon::Errors::Unauthorized => e\n add_error \"Invalid credentials\"\n end\n valid\n end",
"def role?(role)\n self.role == role.to_s ? true : false\n end",
"def role?(role)\n @roles.any? { |r| r.name == role.to_s }\n end",
"def has_role?(name)\n roles.pluck(:name).member?(name.to_s)\n end",
"def check_role\n if user_signed_in? && current_user.role_id ==nil\n redirect_to new_reg_path\n\n end\n end",
"def create_role_config\n template \"#{template_file}\", \"#{role_name}.json\"\n end",
"def role?(role)\n self.role.to_s == role.to_s\n end",
"def validate_file\n unless File.readable?(self.config_file)\n raise Errno::EACCES, \"#{self.config_file} is not readable\"\n end\n end",
"def role_data\n APP_CONFIG['roles'].find { |role| role['name'] == self.role }\n end",
"def has_role?(the_role)\n\t\tthe_role==self.role ? true : false\n\tend",
"def has_role? (role_in)\n # Rails.logger.debug(\"* Models::UserRoles.has_role? self.roles:#{self.roles}, role_in:#{role_in}\")\n (to_array_if_not(self.roles)).index(role_in.to_s) != nil\n end",
"def has_role settings, role, make_security_group=nil\n security_group role if make_security_group\n settings[:user_data][:attributes][:run_list] << \"role[#{role}]\"\nend",
"def role?(role)\n if self.role == role.to_s\n return true\n else\n return false\n end\n end",
"def role?(role_name)\n Mapr.role? node, role_name\nend",
"def role? role\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n self.role&.name == role\n end"
] |
[
"0.71491146",
"0.6838999",
"0.66361266",
"0.652407",
"0.6522044",
"0.6417222",
"0.6404501",
"0.64042354",
"0.6400524",
"0.6400524",
"0.6331413",
"0.6306299",
"0.6306245",
"0.62876153",
"0.628089",
"0.6269485",
"0.62663954",
"0.624251",
"0.6239899",
"0.6208354",
"0.62056535",
"0.62052196",
"0.6182281",
"0.61788434",
"0.61788434",
"0.61788434",
"0.61788434",
"0.61788434",
"0.61788434",
"0.61729205",
"0.6166618",
"0.6154495",
"0.61480445",
"0.6132356",
"0.61321354",
"0.61283",
"0.61202353",
"0.6109411",
"0.61088604",
"0.61076796",
"0.6081334",
"0.60722995",
"0.60720444",
"0.6069668",
"0.60690266",
"0.6058053",
"0.6054116",
"0.60224926",
"0.60047543",
"0.5996168",
"0.5992722",
"0.5982475",
"0.5974976",
"0.59577465",
"0.5953689",
"0.5952773",
"0.59526056",
"0.5947527",
"0.59474826",
"0.59413064",
"0.5934391",
"0.5931682",
"0.5925201",
"0.5924675",
"0.5915363",
"0.5915363",
"0.5915363",
"0.59004885",
"0.58982646",
"0.5897962",
"0.5897962",
"0.58924806",
"0.5890588",
"0.58881545",
"0.5883936",
"0.587472",
"0.58707213",
"0.5864062",
"0.58638835",
"0.58619446",
"0.58619446",
"0.58619446",
"0.58619446",
"0.58589077",
"0.58586484",
"0.585531",
"0.5849077",
"0.58474904",
"0.58440936",
"0.5832657",
"0.5831112",
"0.5819157",
"0.58154345",
"0.580921",
"0.58066183",
"0.5795599",
"0.5786732",
"0.5785975",
"0.5783588",
"0.5779421"
] |
0.8173761
|
0
|
Clear all tokens that have expired
|
def clear_expired_tokens
access_tokens.where("token_expire < ?", Time.now).destroy_all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def expire_tokens!\n update_tokens(nil)\n end",
"def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end",
"def delete_all_expired_for(time)\n expired_for(time).delete_all\n end",
"def revoke!\n return if revoked?\n update(revoked_at: Time.now)\n tokens.update_all(revoked_at: Time.now, updated_at: Time.now)\n end",
"def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end",
"def clear_expired(request)\n entries_for(request)\n .where {|t| t.created_at < Time.now - ttl }\n .delete\n end",
"def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end",
"def invalidate_token\n update_attribute(:token, nil)\n update_attribute(:token_created_at, Time.now)\n end",
"def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end",
"def reset\n reset_token\n end",
"def revoke_all_account_and_authentication_tokens\n self.redis.keys(account_token_key('*')).each do |token_key|\n token = token_key.gsub(\"user:#{id}:account_token:\", '')\n revoke_token(token)\n end\n end",
"def expire\n touch :expires_at\n\n user.subscriptions.facebook.each do |subscription|\n subscription.deactivate\n end\n\n UserMailer.access_token_expired_email(user).deliver\n end",
"def flush_namespaced_access_tokens\n return 0 unless namespace\n tokens = RefreshToken.all(namespace, store)\n tokens.each do |token|\n AccessToken.destroy(token.access_uid, store)\n # unlink refresh token from the current access token\n token.update(0, 0, token.csrf)\n end.count\n end",
"def invalidate_token\n self.update_columns(auth_token: nil)\n end",
"def refresh_tokens\n @token = @token.refresh!\n tokens\n end",
"def clean_tokens\n @db.execute(\"DELETE FROM request_tokens WHERE strftime('%s','now') - strftime('%s',time) > 900\")\n end",
"def flush_cache\n KitSaasSharedCacheManagement::TokenDetails.new([client_id]).clear\n KitSaasSharedCacheManagement::TokenByTokenId.new([id]).clear\n end",
"def invalidate_token \n self.update_columns(auth_token: nil)\n end",
"def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end",
"def clear\n @now.clear\n @next.clear\n end",
"def expire_all\n adapter.expire_all\n logger.info('', '', :expired, cache_name)\n end",
"def clear_request_token\n @request_token = nil\n end",
"def gc!\n delete_if { |key, s| s.expired? }\n end",
"def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end",
"def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end",
"def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end",
"def clear\n with_config do\n self.storage.delete_expired_tempfiles\n end\n end",
"def logout\r\n self.update(token: nil) \r\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def clear_cache(auth_token)\n Authentication::RedisStore.instance.delete(auth_token)\n end",
"def expire!\n token = nil\n save!\n end",
"def invalidate_token\n update_columns(token: nil)\n end",
"def flush_expired!\n Dir[ File.join( store, \"*.cache\" ) ].each do |f|\n if (File.mtime(f)+timeout) <= Time.now\n File.delete(f)\n end\n end\n @gc_last = Time.now\n end",
"def reset_token\n @@token = nil\n end",
"def invalidate_token\n \tupdate_columns(token: '')\n \ttouch(:token_created_at)\n \tend",
"def clear_credentials!\n @access_token = nil\n @refresh_token = nil\n @id_token = nil\n @username = nil\n @password = nil\n @code = nil\n @issued_at = nil\n @expires_at = nil\n end",
"def create\n super\n # delete_expired_tokens\n end",
"def clear_cookies\n \tcookies.delete(:auth_token)\n end",
"def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end",
"def remove_expired_set_members\n client.zremrangebyscore(cache_key, '-inf', \"(#{current_timestamp}\")\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def mark_expired\n all.each do |u|\n u.expire! if u.expired? && u.expired_at.nil?\n end\n end",
"def invalidate_all!\n FileUtils.rm_r(@cache_path, force: true, secure: true)\n end",
"def reset_token\n set_new_token\n save!\n temporary_token\n end",
"def reset_token\n self.token = ''\n end",
"def reset_token\r\n authentication_token true\r\n end",
"def fb_access_token_expired\n self.access_token = nil\n save!\n end",
"def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end",
"def reset_auth_token!\n reset_auth_token\n save(:validate => false)\n end",
"def reset\n session.delete(:access_token)\n session.delete(:refresh_token)\n redirect('/auth/gowalla')\n end",
"def clear_reset_password_token; end",
"def expire_all\n @memcache.flush_all\n stop_tracking_keys\n Merb.logger.info(\"cache: expired all\")\n true\n end",
"def clear_all\n clear\n clear_stored_requests\n end",
"def invalidate_token(user)\n user.renew_token\n user.save\n end",
"def clear_session\n Mack::SessionStore.expire_all\n end",
"def expire_all\n true\n end",
"def delete_expired \n Sentence.expired.each do |sentence| \n if sentence.expired? \n sentence.destroy\n end\n end\n end",
"def refreshToken\n # is there a token? (and is it's timestamp not older than 24h?)\n if @token.nil? or @tokenTimeStamp < Time.now - 86400\n @token = getToken(@email,@password)\n @tokenTimeStamp = Time.now\n end\n end",
"def expire_all\n @mutex.synchronize do\n @cache.clear\n end\n Merb.logger.info(\"cache: expired all\")\n true\n end",
"def reset_token!\n api_key.delete if api_key.present?\n assign_api_key!\n end",
"def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end",
"def clear_all_reviewer_sessions!\n reviewer_access_sessions.delete_all\n end",
"def destroy_tokens\n if saved_change_to_address? || destroyed?\n tokens = ['recovery']\n Token.where(:user_id => user_id, :action => tokens).delete_all\n end\n end",
"def void_pending_expired_authorizations\n self.transactions.authorized.pending.expired.each do |t|\n t.account.void(t.authorization)\n end\n end",
"def ageoff\n messages.reject! { |m| m.expired? }\n\n claims.keys.dup.each do |id|\n claim = claims[id]\n if claim.expired? || claim.messages.empty?\n claim.messages.each { |m| m.claim = nil }\n claims.delete(id)\n end\n end\n end",
"def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end",
"def token_reset\n item = read\n item['token'] = SecureRandom.uuid.gsub(/[^a-f0-9]/, '')\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end",
"def expire_all\n FileUtils.rm_rf(Dir.glob(\"#{@config[:cache_directory]}/*\"))\n Merb.logger.info(\"cache: expired all\")\n true\n end",
"def purge_expired_keys\n Thread.new do\n loop do\n sleep PURGE_EXPIRED_KEYS_FREQUENCY_SECS\n puts 'Purging expired keys...'\n @cache_handler.purge_expired_keys\n end\n end\n end",
"def delete_authentication_tokens\n request.headers.env.delete 'HTTP_X_USER_EMAIL'\n request.headers.env.delete 'HTTP_X_USER_TOKEN'\n end",
"def set_token_expires_at\n self.token_expires_at = 3600.seconds.from_now\n end",
"def destroy_current_access_token\n AccessToken.find(current_access_token_id).destroy\n end",
"def reset_authentication_token!\n reset_authentication_token\n save(:validate => false)\n end",
"def expire!\n expire_faults!\n expire_perfs!\n end",
"def flush_by_token(token)\n uid = token_uid(token, :refresh, @refresh_claims)\n flush_by_uid(uid)\n end",
"def clear_ticket_state\n @last_updated = nil\n @ticket_granting_ticket = nil\n end",
"def clear\n @lock.synchronize do\n @credentials = nil\n end\n end",
"def reset\n session.delete(:access_token)\n session.delete(:refresh_token)\n redirect('/auth/foursquare')\n end",
"def reset_auth_token\n self.auth_token = generate_token(:auth_token)\n end",
"def expire_all\n do_with_logging(:expire_all, nil) do\n retryable do\n self.adapter.expire_all\n nil\n end\n end\n end",
"def clear_checkid_request\n unless session[:request_token].blank?\n OpenIdRequest.destroy_all :token => session[:request_token]\n session[:request_token] = nil\n end\n end",
"def nuke_auth_token\n\t\t\tfile = get_access_token_file\n\t\t\t@logger.info \"Removing persisted access token: #{file}\"\n\t\t\tFile.delete file\n\t\t\tset_access_token(nil)\n\t\t\tset_auth_header ''\n\t\tend",
"def unconsume_tokens!\n consumed_tokens.each do |token|\n kase.restore_token(token)\n end\n end",
"def reset_authentication_token!\n reset_authentication_token\n save(validate: false)\n end",
"def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting })\n begin\n count = CacheStore.cleanup(ttl: SESSION_TTL)\n logger.info(\"Deleted #{count} expired sessions.\", :cleanup, { state: :success, count: count })\n rescue StandardError => e\n logger.info(\"Failed to clean up expired sessions.\", :cleanup, { state: :error, message: e.message })\n\n # Reraise (calling `raise` without arguments will reraise last error)\n raise\n end\n end",
"def clear_emails\n all_emails.clear\n self.current_emails = nil\n self.current_email = nil\n end",
"def revoke_token\n raise 'To be implemented in child classes'\n end",
"def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\n end",
"def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end",
"def reset!\n reset_secret\n refresh_expiry\n reset_confirmation\n save!\n end",
"def renew access_token, expires_at\n update_attributes token: access_token, expires_at: expires_at, reminded_at: nil\n\n user.subscriptions.facebook.unscoped.each do |subscription|\n subscription.activate\n end\n end",
"def fresh_token\n refresh! if expired?\n access_token\n end",
"def remove_token\n update(token: nil)\n end",
"def forget_me!(value)\n remember_me_tokens.where(value: value).destroy_all\n end",
"def clear!\n self.access_key, self.secret_key = []\n end",
"def revoke!\n self[:revoked] = Time.now\n save\n Client[client_id].token_revoked\n end"
] |
[
"0.8014729",
"0.7826364",
"0.72858053",
"0.7003844",
"0.6984809",
"0.6972976",
"0.6952847",
"0.6942722",
"0.6909779",
"0.6869758",
"0.6833584",
"0.6825665",
"0.6772656",
"0.6762896",
"0.6756962",
"0.67244494",
"0.6688539",
"0.66881764",
"0.6640788",
"0.6582605",
"0.65643376",
"0.65631026",
"0.65143484",
"0.6509475",
"0.6502952",
"0.6502952",
"0.6501059",
"0.6485846",
"0.64795136",
"0.6476505",
"0.64687604",
"0.6457974",
"0.6444127",
"0.6430091",
"0.64074165",
"0.63968265",
"0.63956106",
"0.6389616",
"0.6374966",
"0.63681",
"0.6366748",
"0.6366748",
"0.6362698",
"0.6362698",
"0.6357155",
"0.63567954",
"0.63481486",
"0.63374984",
"0.63225216",
"0.6315701",
"0.6276999",
"0.62480754",
"0.6240531",
"0.6239988",
"0.62301743",
"0.62248135",
"0.6216133",
"0.61952275",
"0.6191721",
"0.618486",
"0.6178817",
"0.61740935",
"0.6156548",
"0.6153322",
"0.61405563",
"0.61347693",
"0.6121885",
"0.61168134",
"0.61014277",
"0.6100204",
"0.60874546",
"0.6073387",
"0.6072177",
"0.6071088",
"0.6068215",
"0.6065807",
"0.6062144",
"0.6061915",
"0.6060031",
"0.6059991",
"0.60559285",
"0.6055231",
"0.60545653",
"0.605392",
"0.6050844",
"0.6048571",
"0.6035209",
"0.60325867",
"0.60292995",
"0.5992688",
"0.598848",
"0.598595",
"0.5983893",
"0.59790623",
"0.59776914",
"0.59717846",
"0.59710217",
"0.5966972",
"0.5966193"
] |
0.88821876
|
0
|
Returns role hash from config file
|
def role_object
(APP_CONFIG["user_roles"]+SYSTEM_DATA["user_roles"]).select{|role| role["name"] == self.role}.first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def role_data\n APP_CONFIG['roles'].find { |role| role['name'] == self.role }\n end",
"def token\n File.read(config_file)\n end",
"def read\n unless File.exist?(config_file)\n raise UserError, \"Kitchen YAML file #{config_file} does not exist.\"\n end\n\n Util.symbolized_hash(combined_hash)\n end",
"def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end",
"def hash\n require 'yaml'\n hash = YAML.load(File.read(self.yaml_file)) #gets hash from yaml file\n return hash\n end",
"def get_hash()\n\t\t\treturn @config.clone()\n\t\tend",
"def create_role_config\n template \"#{template_file}\", \"#{role_name}.json\"\n end",
"def credentials_file\n dir['credentials']\n end",
"def read_config_file; end",
"def parse_secret_hash(config)\n mdata = /(?<=\\s{3}secret hash\\s)(md5|sha512)$/.match(config)\n { secret_hash: mdata.nil? ? DEFAULT_SECRET_HASH : mdata[1] }\n end",
"def config_file\n @config_file\n end",
"def config_hash\n certs_path = File.join(__dir__, '..', 'our_certs')\n\n { contract_id: '356936003', # from CP signed contract\n customer_id: 'L03051', # from CP signed contract\n certificate_path: File.join(certs_path, 'squared_VCA12032726_2022.pem'),\n private_key_password: File.read(File.join(certs_path, 'keypass.txt')),\n private_key_path: File.join(certs_path, 'squared_private_2022.key'),\n sending_post_office_code: 12_000 }\n end",
"def galaxy_install_info(role_name)\n role_path = File.join(\"deployment\", \"ansible\", \"roles\", role_name)\n galaxy_install_info = File.join(role_path, \"meta\", \".galaxy_install_info\")\n\n if (File.directory?(role_path) || File.symlink?(role_path)) && File.exists?(galaxy_install_info)\n YAML.load_file(galaxy_install_info)\n else\n { install_date: \"\", version: \"0.0.0\" }\n end\nend",
"def config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end",
"def file( config_file )\n unless File.exists?( config_file )\n raise BadConfigurationException, \"No user defined configuration \" + \n \"file found at #{config_file}.\"\n else\n begin\n config = YAML.load_file(config_file)\n unless config.respond_to? :[]\n raise BadConfigurationException, \"YAML file expected to contain \"+\n \"a hash but did not. Fix #{config_file} and try again.\" \n else\n return config.symbolize_keys!(:deep)\n end\n rescue Exception => e\n raise BadConfigurationException, \"Failed to load user defined \" +\n \"configuration file #{config_file}.\\n\\t#{e}\"\n end\n end \n end",
"def config_element_role( role, hash )\n # Attributes data\n #\n attr = hash.first_value( %w( attribute attr ) )\n unless attr.nil?\n attr.each do |name, value|\n role.attributes[ name ] = value\n end\n end\n\n # Options data\n #\n #\n opt = hash.first_value( %w( options opt ) )\n role.options ||= CubeText::parse_options( opt ) unless opt.nil?\n end",
"def read_secret\n if config[:secret]\n config[:secret]\n else\n Chef::EncryptedDataBagItem.load_secret(config[:secret_file])\n end\n end",
"def credentials\n YAML.load_file('config/secrets.yml')['admins']\n end",
"def hash\n [ name, database, password ].hash\n end",
"def hash_file(filename)\n file = File.read(filename)\n tlsh_hash(file.bytes)\n end",
"def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end",
"def config_file\n CONFIG_FILE\n end",
"def load_credentials\n yml = YAML.load(File.read(credentials_file)) || {}\n @uuid, @token = yml[:uuid], yml[:token]\n yml\n end",
"def roles_path\n verify_path ROLES_PATH\n File.join @tar_contents_path, ROLES_PATH\n end",
"def read_config_file(file); end",
"def passwords_file\n dir['passwords']\n end",
"def roleid\n [ account, kind, identifier ].join(':')\n end",
"def get_config(fn)\n YAML.load_file(fn).symbolize_keys\nend",
"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 current_sha\n @current_sha ||= Digest::SHA512.hexdigest(File.read(hostsfile_path))\n end",
"def config\n @config_file\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 role_arn\n data[:role_arn]\n end",
"def secret_file\n config[:secret_file] ||\n Chef::Config[:knife][:secure_data_bag][:secret_file]\n end",
"def load_config_file\n data = {}\n if File.exists?(@configfile)\n File.open(@configfile, \"r\").each_line do |line|\n # strip blank spaces, tabs etc. off the lines\n line.gsub!(/\\s*$/, \"\")\n \n if (line =~ /^([^=]+)=\"([^=]*)\"$/)\n key = $1.downcase\n val = $2\n \n case key\n when /^ve_(private|root)$/\n data[key] = val.gsub!(/\\$VEID/, @ctid)\n else\n data[key] = val\n end\n end\n end\n end\n data\n end",
"def read_config(name)\n read_config_file[name]\n end",
"def load_salt(filename)\n @salt = File.new(filename).read\n end",
"def file_sha256_hash(file_path)\n file = File.read(file_path)\n Digest::SHA256.hexdigest(file) if file\n end",
"def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end",
"def role_definition\n return @role_definition\n end",
"def role_definition\n return @role_definition\n end",
"def get_role_arn(name)\n sib_role = @deploy.findLitterMate(name: name, type: \"roles\")\n return sib_role.cloudobj.arn if sib_role\n\n begin\n role = MU::Cloud::AWS.iam(credentials: @config['credentials']).get_role({\n role_name: name.to_s\n })\n return role['role']['arn']\n rescue Exception => e\n MU.log \"#{e}\", MU::ERR\n end\n nil\n end",
"def role_arn\n data.role_arn\n end",
"def file_path\n @credentials_file\n end",
"def pdb_get_role(facts)\n if facts.is_a?(Hash) && !facts['trusted'].nil? && !facts['trusted']['value'].nil? && !facts['trusted']['value']['extensions'].nil? && !facts['trusted']['value']['extensions']['pp_role'].nil?\n role = facts['trusted']['value']['extensions']['pp_role']\n Puppet.info(\"#{log_prefix} puppet role for node is: role=#{role}\")\n role\n else\n \"Unknown\"\n end\n end",
"def configfile_hash\n\n config = {}\n begin\n json = File.read(configfile)\n config = JSON.parse(json)\n rescue Errno::ENOENT\n # depending on whether the instance has been saved or not, we may not\n # yet have a configfile - allow to proceed\n @logger.debug \"#{configfile} does not exist\"\n @force_save = true\n rescue JSON::ParserError\n # swallow parse errors so that we can destroy and recreate automatically\n @logger.debug \"JSON parse error in #{configfile}\"\n @force_save = true\n end\n config\n end",
"def aws_cred_file_location\n @cred_file ||= begin\n if !config[:aws_credential_file].nil?\n config[:aws_credential_file]\n else\n Chef::Util::PathHelper.home(\".aws\", \"credentials\") if ::File.exist?(Chef::Util::PathHelper.home(\".aws\", \"credentials\"))\n end\n end\n end",
"def read_config_file\n config_hash = {}\n if File.file? @config_file\n begin\n config_hash = JSON.parse(File.read(@config_file))\n rescue StandardError => e\n raise ConfigError.new(\"parsing configuration file: #{e}\")\n end\n end\n config_hash\n end",
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend",
"def load_config()\n rspec_file = '.rspec'\n full_config = YAML::load(File.open('./config/users.yaml')) # full YML\n puts \"\\n>Loaded user configuration for: \" + ENV['env_name'].to_s # only section of YML that is relevant for the particular environment\n return full_config[ENV['env_name']] # only section of YML that is relevant for the particular environment\nend",
"def read_master_file\n File.read(@config.redis_server).chomp\n end",
"def detect_from_config\n context.config.value('revision_sha')\n end",
"def config_metadata\n Mash.new(\n encryption_format: config[:encryption_format],\n decryption_format: config[:decryption_format],\n encrypted_keys: encrypted_keys,\n encrypt: true,\n secret: secret\n )\n end",
"def hash\n return (path + file_id.to_s).hash\n end",
"def get_role(name)\n role_mapper = get_data_file(data_dir, 'role_mappings.yaml')\n unless File.exists?(role_mapper)\n raise(Exception, \"Role mapping file: #{role_mapper} should exist\")\n end\n role_mappings = YAML.load_file(role_mapper)\n split_name = name.split('.')\n split_name.size.times do |x|\n cur_name = split_name[0..(split_name.size-x-1)].join('.')\n role = role_mappings[cur_name]\n if role\n Puppet.debug(\"Found role from role mappings: #{role}\")\n return role\n end\n end\n Puppet.debug(\"Did not find role mapping for #{name}\")\n return nil\n end",
"def guardfile_contents\n config = File.read(_user_config_path) if File.exist?(_user_config_path)\n [_guardfile_contents_without_user_config, config].compact.join(\"\\n\")\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end",
"def authentication\n file_join = File.join('config', 'authentication.yml')\n\t# path can be either from root or for debugging from the curent class\n\tif File.exists?(file_join)\n\t\treturn YAML.load(File.read(file_join))\n\telse\n\t\traise StandardError, 'Cannot find configuration file. Please make sure you have edited authentication.yml.'\n\tend\nend",
"def roles\n get_chef_files_absolute_paths roles_path\n end",
"def config\n @config ||= YAML.load File.read(@config_file)\n end",
"def password\n open(@credentials_file, 'r').readlines.last.strip if valid_file?(@credentials_file)\n end",
"def decrypt_config(file)\n f = File.open(file, 'r').to_a\n decrypt_array(f.collect {|line| type_7_matches(line)}.flatten)\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def role(name)\n json = client.get(\"/v1/auth/approle/role/#{encode_path(name)}\")\n return Secret.decode(json)\n rescue HTTPError => e\n return nil if e.code == 404\n raise\n end",
"def config_file_contents\n config = Brightbox::BBConfig.new\n File.read(config.config_filename)\n end",
"def chef_credentials\n creds = Hash.new\n File.open(ENV['HOME'] + '/.chef/knife.rb').each do |line|\n creds['c_uri'] = line.scan(/'([^']*)'/).join(' ') if line.match('chef_server_url')\n creds['c_key'] = line.scan(/'([^']*)'/).join(' ') if line.match('client_key')\n creds['c_node'] = line.scan(/'([^']*)'/).join(' ') if line.match('node_name')\n end\n return creds\nrescue => e\n puts '(chef=>tenant_prov): Unable to access Chef credentials. Check the knife.rb file for the user environment.'\n puts \"(chef=>tenant_prov): Error: #{e}\"\n exit\nend",
"def get_credentials\n trackmine_path = File.join(Rails.root, 'config', 'trackmine.yml')\n raise MissingTrackmineConfig.new(\"Missing trackmine.yml configuration file in /config\") unless File.exist?(trackmine_path)\n YAML.load_file(trackmine_path)\n end",
"def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end",
"def chef_config\n ci = @json.split('/').last.gsub('.json', '')\n \"#{prefix_root}/home/oneops/#{@circuit}/components/cookbooks/\" \\\n \"chef-#{ci}.rb\"\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 load\n config = YAML.load_file @config_path\n @path = config['steam']\n end",
"def key\n 'roleid'\n end",
"def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend",
"def data\n return {} unless File.exist?(vault_path)\n\n encrypted_file_content = File.open(vault_path, 'rb') { |f| f.read }\n cipher = new_decryption_cipher\n decrypted_file_content = cipher.update(encrypted_file_content) + cipher.final\n\n password_data = YAML.load(decrypted_file_content)\n end",
"def get(profile='default')\n raise 'Config File does not exist' unless File.exists?(@file)\n\n @credentials = parse if @credentials.nil?\n raise 'The profile is not specified in the config file' unless @credentials.has_key?(profile)\n\n @credentials[profile]\n end",
"def role\n @manifest_options[:role] || \"\"\n end",
"def hash\n @hash ||= @client.get_hash(path)\n @hash\n end",
"def hash\n @hash ||= @client.get_hash(path)\n @hash\n end",
"def role_config_file(reference, deploy_group:, project: project(), **args) # rubocop:disable Style/MethodCallWithoutArgsParentheses\n file = config_file\n file = file.sub('$deploy_group', deploy_group.env_value) if deploy_group && dynamic_folders?\n self.class.role_config_file(project, file, reference, **args)\n end",
"def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#{NilavuStylesheets.last_file_updated}\"\n end\n end",
"def config(options = {})\n if options[:file]\n filename = options[:filename] || File.join(Dir.home, \".bos\")\n config_hash = JSON.parse(IO.read(filename), symbolize_names: true)\n @user_id = config_hash[:user_id]\n @password = config_hash[:password]\n @security_code = config_hash[:security_code]\n else\n @user_id = options[:user_id]\n @password = options[:password]\n @security_code = options[:security_code]\n File.open(File.join(Dir.home, \".bos\"), \"w\") do |f|\n f.write options.to_json\n end\n end\n end",
"def hash\n [access_key_id, address, arn, aws_session_name, connection_type, event_source, exchange_server_hostname, exchange_user, folder_path, id, ldap_server, links, name, port, protocol, region, scan_engine_is_inside_aws, secret_access_key, status, username, win_rm_server].hash\n end",
"def user_role\n USER_ROLE[role]\n end",
"def role_id(name)\n json = client.get(\"/v1/auth/approle/role/#{encode_path(name)}/role-id\")\n return Secret.decode(json).data[:role_id]\n rescue HTTPError => e\n return nil if e.code == 404\n raise\n end",
"def get_hash(name)\n file_name = File.join(@db_dir, name + '.json')\n return ::Hash.new unless File.exist?(file_name)\n\n begin\n json = File.read(file_name)\n rescue => e\n PEROBS.log.fatal \"Cannot read hash file '#{file_name}': #{e.message}\"\n end\n JSON.parse(json, :create_additions => true)\n end",
"def role_id\n data.role_id\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def assume_role_credentials_from_config(opts = T.unsafe(nil)); end",
"def get_system_config(config)\n\n config = YAML.load_file(config_file)\n\n #Config details.\n @host = config[\"database\"][\"host\"]\n @port = config[\"database\"][\"port\"]\n\n @user_name = config[\"database\"][\"user_name\"]\n @password_encoded = config[\"database\"][\"password_encoded\"]\n\n if @password_encoded.nil? then #User is passing in plain-text password...\n @password = config[\"database\"][\"password\"]\n @password_encoded = Base64.encode64(@password)\n end\n\n @database = config[\"database\"][\"schema\"]\n end",
"def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\nend",
"def role_definition_id\n return @role_definition_id\n end",
"def get_forum_config_data\n config_hash = Hash.new\n c = File.read( File.join( RAILS_ROOT, 'public' , 'forum', 'config.php' ) )\n c.scan(/\\$(\\w*)\\s*=\\s*['"](.*)['"];/).each do |pair|\n config_hash[pair[0].to_sym] = pair[1]\n end\n config_hash\n end",
"def config_file_path\n rails_root + \"/config/redis.conf\"\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def config(file_name=nil)\n # Authorize.net configuration\n result = YAML.load_file(RAILS_ROOT + \"/config/#{file_name || config_file_name}\")[RAILS_ENV].symbolize_keys\n @@authorize_net_login_id = result[:login_id]\n @@authorize_net_transaction_key = result[:transaction_key]\n if result[:mode] == 'test'\n # Tell ActiveMerchant to use the Authorize.net sandbox\n ActiveMerchant::Billing::Base.mode = :test\n end\n result\n end",
"def hash\n fullname.hash\n end",
"def config\n @config ||= YAML.load_file(@config_file_path)\n end",
"def path\n \"#{self.project_root}/puppet/roles/#{self.name}\"\n end"
] |
[
"0.6470133",
"0.5945538",
"0.59347224",
"0.5742012",
"0.57084733",
"0.5553579",
"0.55347407",
"0.54963243",
"0.54862905",
"0.5434629",
"0.5419047",
"0.54066336",
"0.5402064",
"0.53946984",
"0.53723645",
"0.53501713",
"0.5349991",
"0.5344727",
"0.5328685",
"0.53208214",
"0.53127265",
"0.530879",
"0.53059834",
"0.5303876",
"0.5290368",
"0.5282777",
"0.52274305",
"0.522123",
"0.51992846",
"0.5197931",
"0.5197035",
"0.5194618",
"0.51901203",
"0.51884246",
"0.51754385",
"0.51734066",
"0.5123109",
"0.51203716",
"0.51166797",
"0.5106328",
"0.5106328",
"0.5104801",
"0.51039416",
"0.51016265",
"0.5101533",
"0.5099135",
"0.5092109",
"0.5086224",
"0.5082002",
"0.50774777",
"0.50771874",
"0.5073265",
"0.5070349",
"0.5063839",
"0.50583816",
"0.50367796",
"0.5035912",
"0.50287336",
"0.502863",
"0.50215524",
"0.50172555",
"0.5016786",
"0.50161964",
"0.50153613",
"0.50109965",
"0.5006443",
"0.5004202",
"0.50005734",
"0.49980587",
"0.49965915",
"0.49806607",
"0.49800545",
"0.49798122",
"0.49782762",
"0.49772313",
"0.49770686",
"0.49719164",
"0.49708006",
"0.49708006",
"0.49702978",
"0.49567142",
"0.49552944",
"0.4951472",
"0.49284935",
"0.492073",
"0.491951",
"0.49096188",
"0.4900431",
"0.48976648",
"0.4897621",
"0.48955193",
"0.48951933",
"0.4894989",
"0.4891073",
"0.48908833",
"0.48905396",
"0.48831233",
"0.48820722",
"0.48784444",
"0.48756528"
] |
0.5306723
|
22
|
Checks if users role has given right value
|
def has_right?(right_value)
role_object["rights"].include? right_value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def role?(value)\n roles.include?(value.to_s)\n end",
"def role?(role_name)\n role == role_name\n \n end",
"def role?(r)\n self.role == r.to_s\n end",
"def role?(role)\n self.role == role.to_s ? true : false\n end",
"def has_role(r)\n self.role == r\n end",
"def role?(role)\n self.role.to_s == role.to_s\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def checkrole\n if roles_mask == 4\n 'User'\n elsif roles_mask == 6\n 'Administrator'\n end\n end",
"def role?(role)\n \troles.include? role.to_s\n end",
"def check_user_role \t \n redirect_to root_path unless current_user.roles.first.name == \"empleado\" or current_user.roles.first.name == \"supervisor\"or current_user.roles.first.name == \"admin\" \n end",
"def invalid_role?\r\n self.role.blank? || self.role < 0\r\n end",
"def role?(role)\n if self.role == role.to_s\n return true\n else\n return false\n end\n end",
"def role?(role)\n\t self.role.name == role\n end",
"def role_valid\n if (APP_CONFIG[\"user_roles\"]+SYSTEM_DATA[\"user_roles\"]).select{|role| role[\"name\"] == self.role}.empty?\n errors.add(:role, \"Role does not exist in config\")\n end\n end",
"def role?(role) \n roles.any? { |r| r.name.underscore.to_sym == role } \n end",
"def has_role?(role) \n return self.roles.include?(role)\n end",
"def role?(role)\n \n if self.is_admin\n return true\n end\n \n self.roles.each do |item|\n if item.name.to_s == role.to_s\n return true\n end\n end\n \n return false\n end",
"def role?(role)\n\t self.role == role\n\tend",
"def is?( requested_role )\n self.role == requested_role.to_s\n end",
"def has_role?(the_role)\n\t\tthe_role==self.role ? true : false\n\tend",
"def role?(role)\n roles.include? role\n end",
"def check_for_role\n self.role = ROLES[:user] if self.role.nil?\n end",
"def role?(role)\n self.role&.name == role\n end",
"def is_role(r)\n return r == role\n end",
"def role?(role_to_compare)\n self.role.to_s == role_to_compare.to_s\n end",
"def role?(role)\n roles && roles.include?(role)\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def has_role? (role_name)\n self.role ? self.role.name==(role_name.to_s) : false\n end",
"def role?(role)\n roles.pluck(:name).include? role.to_s\n end",
"def role_exists?\n roles.presence\n end",
"def role?\n false\n end",
"def user_admin\n user_role.in? [\"Department Admin\",\"College Admin\",\"Tech User\"] if user_role\n end",
"def user_role?\n roles.any? { |role| Roles.user_roles.include?(role) }\n end",
"def is?(rololo)\n role == rololo\n end",
"def role?(base_role)\n role == base_role.to_s\nend",
"def has_role?(name)\r\n roles.include?(name.to_s)\r\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s) || list.include?('admin')\n end",
"def has_role(the_role)\n answer = false\n roles = self.roles\n\n roles.each do |role|\n if role.roleable_type == the_role\n answer = true \n end \n end \n return answer\n\n end",
"def has_a_role_of( role )\n return self.role.name == role\n end",
"def role?(authorized_role)\n return false if self.employee.nil?\n return false if self.employee.role.nil?\n self.employee.role.downcase.to_sym == authorized_role\n end",
"def check_for_role\n\t\tself.role = ROLES[:user] if !self.role.present?\n\tend",
"def role?(authorized_role)\n return false if employee.nil?\n employee.role.downcase.to_sym == authorized_role\n end",
"def has_role?( user, object )\n false\n end",
"def has_role?(role)\n list ||= self.roles.map(&:name)\n list.include?(role.to_s)\n end",
"def role?\n role.name.to_sym\n end",
"def role? role_name\n self.roles.exists? name: role_name.to_s\n end",
"def is?(role)\n roles.include?(role.to_s)\n end",
"def has_role_blank?( user_role )\n self.role_id.blank?\n end",
"def user_in_role(role)\n attrs = session['user_attributes']\n attrs && attrs['role'].split(',').include?(role)\n end",
"def has_role?(role)\n if self.roles.exists? then\n self.roles.find_by(:name => role).present?\n end\n end",
"def is?(role)\n self.roles.pluck(:name).include?(role.to_s)\n end",
"def has_role?(role)\n # I want to be able to use a symbol\n role = role.to_s\n\n case role\n when 'everyone'\n true\n\n when 'readonly'\n User.current_user.is_readonly?\n\n when 'not_readonly'\n !User.current_user.is_readonly?\n\n else\n # The sub! returns nil if no substition was made\n negated = !!role.sub!(/^not_/,'')\n\n # It's an XOR, cool huh? ;)\n negated ^ User.current_user.in_role?(role)\n end\n end",
"def is?( requested_role )\n\t\tself.role = Role.find_by(name: \"regular\") if role.nil?\n \tself.role.name == requested_role.to_s\n end",
"def role?(role_id)\r\n return @user.role?(role_id)\r\n end",
"def admin?\n role= current_user ? current_user.role : \"\"\n role.upcase.split(\",\").include?(\"A\")\n rescue\n false\n end",
"def has_role?\n Role.roles.include? role.try(:name)\n end",
"def has_role?(role)\n # User master always have access to all\n # Given a nil role or a blank list also retun access granted\n return true if role.blank?\n list ||= self.roles.collect(&:name)\n role.is_a?(Array) ? rolelist = role : rolelist = [role]\n rolelist.any? { |r| list.include?(r.to_s) } || list.include?('admin') || self.master?\n end",
"def has_role?(role_name)\n if user_roles\n roles = user_roles.data.map do |role|\n role.name\n end\n\n roles.include?(role_name)\n end\n end",
"def check_role!\n add_role :user if roles.blank?\n if has_role?(:admin)\n add_role :editor unless has_role?(:editor)\n add_role :user unless has_role?(:user)\n end\n end",
"def check_for_role\n\t\tself.role = ROLES[:user] if self.role.nil?\n\tend",
"def allowed?\n @roles.any? { |r| r.to_s.downcase == Account.find(@account_id).role.downcase }\n end",
"def has_role?(role)\n current_user.role.name.gsub(/ /, '').underscore.to_sym.eql?(role) if current_user\n end",
"def role?(role)\n !(roles.map(&:name) & Array(role)).empty?\n end",
"def has_role?(arg) \n if arg.is_a?(Array)\n required_roles = arg.collect {|role| role.to_s}\n else\n required_roles = arg.to_s.to_a\n end\n not (self.roles.to_s.split(' ') & required_roles).empty?\n end",
"def has_role?(role)\n case role\n when :admin then admin?\n when :member then true\n else false\n end\n end",
"def staff?\n if self.role and self.role < 4 \n true\n end\n end",
"def current_user_has_any_role?(node)\n current_user.present? && current_user.has_any_role?(node)\n end",
"def update?\n UserPolicy::ROLE_VALUE[user.dominant_role.class] == 3 ||\n UserPolicy::ROLE_VALUE[user.dominant_role.class] > UserPolicy::ROLE_VALUE[record.dominant_role.class]\n end",
"def role?(base_role)\n return false unless role # A user have a role attribute. If not set, the user does not have any roles.\n ROLES.index(base_role.to_s) <= ROLES.index(role)\n end",
"def role?(base_role)\n return false unless role # A user have a role attribute. If not set, the user does not have any roles.\n ROLES.index(base_role.to_s) <= ROLES.index(role)\n end",
"def has_role?(role)\n role_symbols.include? role\n end",
"def role_required?\n @role_required || false\n end",
"def has_role?( role )\n\t\treturn self.role.title.to_sym == role if self.role\n\t\tfalse\n\tend",
"def has_role?(name)\n !roles.find_by('lower(name) = ?', name.downcase).nil?\n end",
"def has_role?(role)\n self.roles_cached.nil? ? false : self.roles_cached.split(',').include?(role)\n end",
"def role_allowed?(required_role)\n if role_hierarchy.find_index(required_role.to_sym)\n role_hierarchy.find_index(role.to_sym) >= role_hierarchy.find_index(required_role.to_sym)\n else\n false\n end\n end",
"def have_role? role\r\n self.roles ||= []\r\n my_holes = self.roles.collect {|r| r.name.to_s }\r\n my_holes.include? role.to_s\r\n end",
"def any_role?(user)\n user_id = user.id if user.is_a?(User)\n !self.roles.index{ |rol| rol.user_id == user_id }.nil?\n end",
"def role?(role)\n @roles.any? { |r| r.name == role.to_s }\n end",
"def has_role?(role)\n roles.map {|r| r.to_s.downcase}.include?(role.to_s.downcase)\n end",
"def is_admin_or_staff?\n [\"staff_admin\", \"staff_user\"].include?(role_id)\n end",
"def is_admin_or_staff?\n [\"staff_admin\", \"staff_user\"].include?(role_id)\n end",
"def has_role?(name)\n roles.pluck(:name).member?(name.to_s)\n end",
"def admin_assistant?\n if self.role and self.role < 3 \n true\n end\n end",
"def accepts_role?( role_name, user )\n user.has_role? role_name, self\n end",
"def has_any_role? user_role\n role_subject && role_subject.has_any_role?(user_role)\n end",
"def has_role?(role_name)\n return false unless User.roles.keys.include?(role_name)\n r = User.roles[role_name]\n self.role & (1 << r) != 0\n end",
"def has_role?(role_name) # rubocop:disable Naming/PredicateName\n role&.name == role_name.to_s\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role)\n return !!self.roles.find_by_name(role.to_s)\n end",
"def role?(role_name)\n Mapr.role? node, role_name\nend",
"def update?\n user.role == \"Manager\" || user.role == \"Newcomer\"\n end",
"def role?(base_role)\n role == base_role.to_s\n end"
] |
[
"0.8040441",
"0.77134573",
"0.7711028",
"0.76543105",
"0.76199436",
"0.7612789",
"0.76101804",
"0.76101804",
"0.75220317",
"0.75215846",
"0.7516382",
"0.7504229",
"0.74994576",
"0.74955463",
"0.7475736",
"0.7469369",
"0.74452645",
"0.7440596",
"0.74216753",
"0.7417727",
"0.74116224",
"0.7401321",
"0.738894",
"0.73585314",
"0.7358122",
"0.73445797",
"0.7337656",
"0.73333204",
"0.73333204",
"0.7318244",
"0.7289276",
"0.7282235",
"0.7271062",
"0.7256081",
"0.7248171",
"0.7245975",
"0.72428495",
"0.7240507",
"0.7240507",
"0.7240507",
"0.7240507",
"0.7240507",
"0.7240507",
"0.72331136",
"0.72257924",
"0.7212075",
"0.7202444",
"0.7187905",
"0.7187485",
"0.7185438",
"0.7184211",
"0.71782863",
"0.7176434",
"0.71648663",
"0.716481",
"0.7158551",
"0.71530485",
"0.71494657",
"0.7146675",
"0.7129012",
"0.7128085",
"0.71274275",
"0.7125155",
"0.7123723",
"0.71224105",
"0.7120164",
"0.711403",
"0.71122587",
"0.711201",
"0.7111356",
"0.7108049",
"0.71042866",
"0.7098696",
"0.7089889",
"0.70883137",
"0.70883137",
"0.7086259",
"0.70764756",
"0.7076008",
"0.7075523",
"0.706996",
"0.7067431",
"0.70592237",
"0.70394784",
"0.7035655",
"0.703469",
"0.7032488",
"0.7032488",
"0.7031367",
"0.70295525",
"0.70234734",
"0.7017109",
"0.7015879",
"0.7007918",
"0.7006281",
"0.7006281",
"0.7006281",
"0.69839996",
"0.6981455",
"0.6978926"
] |
0.70434284
|
83
|
First clear all invalid tokens. Then look for our provided token. If we find one, we know it is valid, and therefor update its validity further into the future
|
def validate_token(provided_token, extend_expire = true)
clear_expired_tokens
token_object = access_tokens.find_by_token(provided_token)
return false if !token_object
if extend_expire
token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)
end
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_valid_token(name, token)\n token = find_token(name, token)\n return unless token\n !token.expired? && token\n end",
"def invalidate_token\n update_attribute(:token, nil)\n update_attribute(:token_created_at, Time.now)\n end",
"def validate_tokens!\n tokens.each(&:validate_token!)\n end",
"def valid_token\n # generate the token\n self.token=Digest::MD5.hexdigest(\"#{Time.now}-#{self.ad_id}-#{self.publisher_id}\")\n\n # Aux var to the ValidatorLoop\n counter = 0\n\n # Loop which validate the token on the DB\n while true do\n another_access = Access.where(token: self.token).take\n break if another_access.nil?\n self.token=\"#{self.token}#{counter}\"\n counter=counter+1\n end\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n self.update_columns(token: nil)\n end",
"def invalidate_token\n \tupdate_columns(token: '')\n \ttouch(:token_created_at)\n \tend",
"def valid_new_token?(token)\n unique_token?(token) && token_looks_safe?(token)\n end",
"def valid_token\n unless !value_changed? || token_data(refresh: true).is_valid\n errors.add(\n :value,\n I18n.translate(\n 'fbsync.activerecord.errors.token.invalid_token',\n expires_at: I18n.localize(token_data.expires_at)\n )\n )\n end\n end",
"def validate_token(provided_token)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n true\n end",
"def ensure_token!(instance)\n reset_token!(instance) unless token_set?(instance)\n get_token(instance)\n end",
"def validate!(token)\n raise ArgumentError, \"Invalid search token\" if !token || token.strip.empty?\n end",
"def check_token\n end",
"def find_by_valid_token(name, hash)\n token = find_token(name: name.to_s, token: hash)\n return if !token || token.expired?\n token.tokenizable\n end",
"def invalidate_token model\n case invalidation_strategy\n when :new then set_token! model\n when :nullify then model[challenge_column] = nil ; model.save!\n when :destroy then model.destroy\n when :delete then model.class.delete model.id\n else raise ArgumentError, \"unknown token invalidation strategy\"\n end\n nil\n end",
"def valid_token?(token)\n exists?(:token => token)\n end",
"def valid_token?\n # we check against a copy invitation object\n match = Invitation.find_by_token(self.token)\n \n if !match\n errors.add :token, 'not found'\n return false\n elsif User.registered.find_by_invitation_id(match)\n errors.add :token, 'already used'\n return false\n end\n \n true\n end",
"def validate_token_hash; end",
"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 valid?\n @token.valid?\n end",
"def remove_token\n update(token: nil)\n end",
"def reset_token\n @@token = nil\n end",
"def invalidate_token\n self.update_columns(auth_token: nil)\n end",
"def find_by_valid_token(name, token)\n token = find_token(:name => name.to_s, :token => token)\n return token.object if token && token.valid_for_use?\n end",
"def try_to_free_token(tkn, slt)\n\n if slt.reservation_token_id == tkn.id\n slt.reservation_token_id = nil\n slt.save\n\n write_log_entry(\"VAPAUTUS: \", tkn, slt)\n\n return 1\n end\nend",
"def reset_token\n self.token = ''\n end",
"def refresh_tokens\n @tokens = self.class.dup_tokens\n\n if @token_filter\n @tokens.each{|t| @token_filter.call(t)}\n end\n\n tokens_to_find = tokens.each_with_index.map do |t, i|\n [i, t.string] if t.string\n end.compact\n\n @tokens_to_find_indexes = tokens_to_find.map{|t| t[0]}\n @tokens_to_find_strings = tokens_to_find.map{|t| t[1]}\n\n tokens_to_extract = tokens.each_with_index.map do |t, i|\n [i, t.name] if t.extract?\n end.compact\n\n @tokens_to_extract_indexes = tokens_to_extract.map{|t| t[0]}\n @tokens_to_extract_names = tokens.map{|t| t.name}\n\n @have_tokens_to_extract = (@tokens_to_extract_indexes.size > 0)\n end",
"def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\n end",
"def invalidate_token \n self.update_columns(auth_token: nil)\n end",
"def token_validation\n if (!jwt_string.blank? && !(token.all? &:blank?))\n cur_time = Time.now\n iat_time = Time.at(token[0][\"iat\"])\n exp_time = Time.at(token[0][\"exp\"])\n if exp_time < cur_time\n errors.add(:base, I18n.t('token.expired'))\n elsif !(iat_time < cur_time && iat_time < exp_time)\n errors.add(:base, I18n.t('token.invalid'))\n end\n else\n errors.add(:base, I18n.t('token.invalid'))\n end\n rescue JWT::DecodeError\n errors.add(:base, I18n.t('token.invalid'))\n end",
"def match_token (exp, token)\n\tputs \"Leaf token received: #{token.value}\"\n\tputs \"\\tExpecting token of type: #{exp}\"\n\n\tif exp == token.type\n\t\tputs \"\\t\\tShiny. Got #{token.type}!\"\n\t\t$cst.add_leaf(token.value, token)\n\t\t\n\t\t# To try to make this auto-managed\n\t\t$index = $index + 1\n\t\t\n\telse\n\t\traise FaultyTokenError.new(exp, token)\n\tend\nend",
"def token_validation\n return errors.add(:base, I18n.t('token.invalid')) if jwt_string.blank? || token.all?(&:blank?)\n\n current_time = Time.current\n iat_time = Time.at(read('iat'))\n exp_time = Time.at(read('exp'))\n if exp_time < current_time\n errors.add(:base, I18n.t('token.expired'))\n elsif iat_time >= current_time && iat_time > exp_time\n errors.add(:base, I18n.t('token.invalid'))\n end\n rescue JWT::DecodeError\n errors.add(:base, I18n.t('token.invalid'))\n end",
"def token_valid?\n raise 'To be implemented in child classes'\n end",
"def reset_perishable_token\n self.perishable_token = self.class.make_token\n end",
"def reset_token\n set_new_token\n save!\n temporary_token\n end",
"def with_fresh_token\n retried = false\n\n begin\n token = File.exist?(TOKEN_PATH) && File.read(TOKEN_PATH) || refresh_token()\n yield(token)\n rescue StaleTokenError\n raise if retried # Avoid endless loops.\n retried = true\n\n FileUtils.rm(TOKEN_PATH)\n retry\n end\nend",
"def validate_token\n return success if @token.blank?\n\n service_response = UserManagement::DoubleOptIn.new({client: @client, t: @token, user_id: @user_id}).perform\n #TODO: user_token_sale_state should be sent to web.\n return unauthorized_access_response('um_gbd_2') unless service_response.success?\n @user.reload\n\n @account_activated = true if (@user_token_sale_state != @user.get_token_sale_state_page_name &&\n @user_token_sale_state == GlobalConstant::User.get_token_sale_state_page_names(\"verification_page\"))\n\n @user_token_sale_state = @user.get_token_sale_state_page_name\n success\n end",
"def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end",
"def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end",
"def refreshToken\n # is there a token? (and is it's timestamp not older than 24h?)\n if @token.nil? or @tokenTimeStamp < Time.now - 86400\n @token = getToken(@email,@password)\n @tokenTimeStamp = Time.now\n end\n end",
"def invalidate\n @invalid = true\n end",
"def validate_token\n\n @manager = CacheManagement::Manager.new([@manager_id]).fetch[@manager_id]\n @manager_s = CacheManagement::ManagerSecure.new([@manager_id]).fetch[@manager_id]\n\n return unauthorized_access_response('am_vc_5') unless @manager.present? &&\n (@manager[:status] == GlobalConstant::Manager.active_status)\n\n return unauthorized_access_response('am_vc_10') if token_s.blank?\n\n @manager_device = CacheManagement::ManagerDeviceById.new([@manager_device_id]).fetch[@manager_device_id]\n\n return unauthorized_access_response('am_vc_13') if @manager_device.nil?\n\n @fingerprint = @manager_device[:fingerprint]\n\n evaluated_token = Manager.get_cookie_token(\n manager_id: @manager_id,\n current_client_id: @manager[:current_client_id],\n token_s: token_s,\n browser_user_agent: @browser_user_agent,\n manager_device_id: @manager_device_id,\n fingerprint: @fingerprint,\n last_session_updated_at: @manager_s[:last_session_updated_at],\n cookie_creation_time: @created_ts,\n auth_level: auth_level\n )\n\n return unauthorized_access_response('am_vc_6') unless (evaluated_token == @token)\n\n success\n\n end",
"def fix_up_token\n# FIX THIS: token age should be configurable\n new_token if updated_at < 1.day.ago\n end",
"def verify_subscription(token)\n # Is there a token?\n result = @tokens.include?(token)\n\n # Ensure we cannot reuse the token\n @tokens.delete(token)\n\n result\n end",
"def invalidate\n @valid = false\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def ensure_token\n if self.token_expiration and Time.now > self.token_expiration\n self.token = nil\n end\n self.token ||= self.generate_token\n self.token_expiration = Time.now + 1.day\n self.save\n return self.token\n end",
"def valid_access_token\n\t\t\t\t# The token we have stored is expired - fetch a new one using the refresh token\n\t\t\t\tself.refresh_access_token if self.access_token_expired?\n\n\t\t\t\tself.access_token\n\t\t\tend",
"def unconsume_tokens!\n consumed_tokens.each do |token|\n kase.restore_token(token)\n end\n end",
"def invalidate\r\n @invalid=true\r\n end",
"def expire_tokens!\n update_tokens(nil)\n end",
"def validateToken(token)\n if (token.nil? or token.empty?)\n debug(\"Error: validateToken: nil/empty token.\")\n return\n end\n body, sig = token.split(\"&sig=\")\n if (body.nil? or sig.nil?)\n debug(\"Error: validateToken: Invalid token: #{token}\")\n return\n end\n sig = u64(sig)\n return token if (sig == signToken(body))\n debug(\"Error: validateToken: Signature did not match.\")\n return\n end",
"def set_token\n\tbegin\n\t self.token = SecureRandom.hex\n\tend while EncryptedString.where(token: self.token).present?\n end",
"def remove_tokens_from_errors(input_errors)\n input_errors&.each do |error|\n # Ingest errors return as {errors => [{path => string, errors => string}]}\n # where path is a place in the metadata and the errors are content errors\n # There should not be tokens in these errors, so we can skip them.\n next if error.is_a?(Hash)\n\n # Match something that contains Token [<token>] and replace it where $1 = the first few chars of <token>\n error.gsub!(/Token \\[(.*?)\\]/) { |s| \"Token beginning with #{truncate_token($1)}\" }\n end\n\n input_errors\n end",
"def reset_perishable_token!\n update_attribute(:perishable_token, reset_perishable_token)\n end",
"def is_token_valid? token\n @browser_token_db.has_token? token\n end",
"def valid_token\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['valid_token']) do\n if ![\"facebook\"].include?(params[:provider]) # using include? allows us to do this for twitter/tumblr in the future\n return render_error(404, \"this route only currently supports facebook as a provider.\")\n end\n\n if auth = current_user.first_provider(params[:provider]) and auth.is_a? Authentication\n @token_valid = GT::UserFacebookManager.verify_auth(auth.oauth_token)\n @status = 200\n else\n return render_error(404, \"This user does not have a #{params[:provider]} authentication to check on\")\n end\n end\n end",
"def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end",
"def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end",
"def invalidate_token(user)\n user.renew_token\n user.save\n end",
"def validate_token\n if reg_params[:reg_token].blank?\n flash[:alert] = MESSAGES[:blank_token]\n redirect_to info_path\n return\n end\n\n begin\n @decoded_token = TokenService.decode reg_params[:reg_token]\n rescue JWT::DecodeError\n flash[:alert] = MESSAGES[:bad_token]\n redirect_to info_path\n return\n end\n\n if @decoded_token[:course_id].blank? or @decoded_token[:user_id].blank?\n flash[:alert] = MESSAGES[:bad_token]\n redirect_to info_path\n return\n end\n\n if reg_params[:course_id].to_i != @decoded_token[:course_id]\n flash[:alert] = MESSAGES[:bad_token]\n redirect_to info_path\n return\n end\n\n reg_count =\n Registration.\n where(course_id: @decoded_token[:course_id],\n user_id: @decoded_token[:user_id]).\n count\n\n if reg_count > 0\n flash[:alert] = MESSAGES[:already_registered]\n redirect_to info_path\n return\n end\n end",
"def validate\n token = jwt\n return unless token\n token.validate\n end",
"def invalidate\n @invalid=true\n end",
"def validate\n if self.any? { |e| !e.is_a?(SuspendedToken) }\n raise \"All members must be of type SuspendedTokens #{ entries.inspect }\"\n end\n if self.any? { |i| i.position < 0 }\n raise \"Negative offsets not permitted #{ entries.inspect }\"\n end\n self\n end",
"def match_token(token)\n return true\n end",
"def token_valid?\n @session_token and @toodle_token_death > Time.now\n end",
"def token_can_be_reused?(token, client_id)\n # ghetto HashWithIndifferentAccess\n updated_at = self.tokens[client_id]['updated_at'] || self.tokens[client_id][:updated_at]\n last_token = self.tokens[client_id]['last_token'] || self.tokens[client_id][:last_token]\n\n\n return true if (\n # ensure that the last token and its creation time exist\n updated_at && last_token &&\n\n # ensure that previous token falls within the batch buffer throttle time of the last request\n Time.parse(updated_at) > Time.now - DeviseTokenAuth.batch_request_buffer_throttle &&\n\n # ensure that the token is valid\n ::BCrypt::Password.new(last_token) == token\n )\n end",
"def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end",
"def reset_token!(instance)\n write_new_token(instance)\n instance.save! if Gitlab::Database.read_write?\n end",
"def validate_token_no_tmp_datetime(token)\n valid_vals = []\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now)\n (1..self.class.ga_timedrift).each do |cc|\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now.ago(30*cc))\n valid_vals << ROTP::TOTP.new(self.get_qr).at(Time.now.in(30*cc))\n end\n\n if valid_vals.include?(token.to_i)\n return true\n else\n return false\n end\n end",
"def reset_auth_token!\n reset_auth_token\n save(:validate => false)\n end",
"def token_can_be_reused?(token, client_id)\n return true if (\n # ensure that the last token and its creation time exist\n self.tokens[client_id]['updated_at'] and\n self.tokens[client_id]['last_token'] and\n\n # ensure that previous token falls within the batch buffer throttle time of the last request\n Time.parse(self.tokens[client_id]['updated_at']) > Time.now - DeviseTokenAuth.batch_request_buffer_throttle and\n\n # ensure that the token is valid\n BCrypt::Password.new(self.tokens[client_id]['last_token']) == token\n )\n end",
"def scan_for_t(token); end",
"def token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: auth_token)\n end",
"def valid_token?(token)\n return false unless !token.nil? && token_looks_safe?(token)\n result = ApiToken.find_by(token: token)\n !result.nil? && result[:active]\n end",
"def update_token!(_action, _entity, tile, old_tile)\n cities = tile.cities\n if old_tile.paths.empty? &&\n !tile.paths.empty? &&\n cities.size > 1 &&\n (token = cities.flat_map(&:tokens).find(&:itself))\n\n # always move token to city with index 0\n token.move!(cities[0])\n @game.graph.clear\n end\n end",
"def update_token!(_action, _entity, tile, old_tile)\n cities = tile.cities\n if old_tile.paths.empty? &&\n !tile.paths.empty? &&\n cities.size > 1 &&\n (token = cities.flat_map(&:tokens).find(&:itself))\n\n # always move token to city with index 0\n token.move!(cities[0])\n @game.graph.clear\n end\n end",
"def validate_token\n return true if @current_username\n token = get_token\n token.force_encoding('utf-8') if token\n token_object = AccessToken.find_by_token(token)\n if token_object && token_object.validated?\n @current_username = token_object.username\n return true\n else\n return false\n end\n end",
"def valid_token(card_type: T.unsafe(nil)); end",
"def validate token\r\n token =~ /[A-Za-z0-9]/\r\n end",
"def remove_token!\n return if new_record? || api_token.nil?\n\n update_column(:api_token, nil)\n end",
"def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end",
"def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end",
"def token?\n @token && !@token.empty?\n end",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def validate_token(token)\n object_from_response(Code42::TokenValidation, :get, \"authToken/#{token.to_s}\")\n end",
"def validate_cloudmail_token!(token, message)\n unless token == cloudmail_token(message)\n throw 'invalid cloudmail token'\n end\n end",
"def assert_reset_token_passed\n nil\n end",
"def reset\n @token = params[:tokens]\n @id = params[:id]\n end",
"def reset\n @token = params[:tokens]\n @id = params[:id]\n end",
"def token?(token)\n return false\n end",
"def require_tokens\n @tokens_required = true\n end",
"def refresh_token\n return if token\n refresh_token!\n end",
"def assign_unique_token\n unless(self.token)\n begin\n self.token = rand(36**8).to_s(36).downcase # a-z \n end while self.class.exists?(:token => token)\n end\n end",
"def reset_perishable_token!\n reset_perishable_token\n save_without_session_maintenance(validate: false)\n end",
"def remove_token!\n unless api_token.blank?\n update_column(:api_token, \"\") unless new_record?\n end\n end",
"def valid_reset_token?(token)\n token.is_a?(String) && reset_password_period_valid? && reset_password_token == token\n end"
] |
[
"0.6805831",
"0.6804558",
"0.67512935",
"0.67468435",
"0.66581714",
"0.66581714",
"0.66271526",
"0.6603434",
"0.6603434",
"0.66029185",
"0.65269786",
"0.6505263",
"0.64926445",
"0.6206626",
"0.61235684",
"0.61097026",
"0.6086967",
"0.6067329",
"0.6059277",
"0.595322",
"0.5948985",
"0.5947494",
"0.5940393",
"0.59089726",
"0.590667",
"0.58776295",
"0.58356243",
"0.5818874",
"0.5818316",
"0.57793695",
"0.5772585",
"0.5756628",
"0.5722504",
"0.57099354",
"0.5693376",
"0.56834984",
"0.56680286",
"0.56662166",
"0.5662686",
"0.56498307",
"0.56491995",
"0.56338793",
"0.56300366",
"0.56216943",
"0.5618855",
"0.56174266",
"0.5611414",
"0.5606576",
"0.5605796",
"0.55717444",
"0.5546955",
"0.55442965",
"0.5518133",
"0.55146575",
"0.5503458",
"0.5493332",
"0.5465084",
"0.54599124",
"0.545309",
"0.544614",
"0.5441992",
"0.5441992",
"0.54366004",
"0.5435656",
"0.54355234",
"0.54190147",
"0.54118025",
"0.5398372",
"0.5387144",
"0.53866994",
"0.53738296",
"0.53712934",
"0.5361947",
"0.5361821",
"0.5357887",
"0.53476596",
"0.53449404",
"0.5342845",
"0.53383625",
"0.53383625",
"0.5333572",
"0.532035",
"0.5315709",
"0.53128946",
"0.53124356",
"0.53124356",
"0.53032386",
"0.52991426",
"0.5298339",
"0.52896",
"0.52864605",
"0.5282399",
"0.5282399",
"0.52805585",
"0.5279343",
"0.527643",
"0.5274929",
"0.52726525",
"0.52709454",
"0.52639914"
] |
0.5867835
|
26
|
Authenticate user against password sources
|
def authenticate(provided_password, force_authenticate=false)
if force_authenticate
token_object = generate_token
return token_object.token
end
auth_status = authenticate_local(provided_password)
auth_status
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end",
"def authenticate(password)\n true\n end",
"def password_authentication\n if user = User.authenticate(params[:login], params[:password])\n successful_login(user,params[:url])\n else\n failed_login(user, \"Couldn't log you in as '#{params[:login]}'\")\n end\n end",
"def authenticate(user, pass)\n self.logger.debug \"#{user} : #{pass}\"\n Digest::MD5.hexdigest(pass) == CREDENTIALS[user]\n end",
"def authenticate(request, realm, &password_procedure); end",
"def authenticate password\n if self.password == password\n true\n else\n false\n end\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end",
"def authenticate(password)\n user && user.password == password\n end",
"def authenticate(pass)\n password.is_password?(pass) && self\n end",
"def authenticate!(psw)\n User.encrypt_token(psw, password_salt) == encrypted_password\n end",
"def login_from_params\n authenticate(params[:password])\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def authenticate_with_password(input_password)\n return false unless self.valid_password?(input_password)\n authenticate\n end",
"def authenticate(username, password)\n end",
"def authenticate\n end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n raise \"That username and password combination does not exist\"\n end\n end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end",
"def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end",
"def authenticate_user(username, password, list_of_users)\n list_of_users.each do |user_record|\n if user_record[:username] == username && verify_hash_digest(user_record[:password]) == password\n return user_record\n end\n puts \"Credentials are not correct\"\n end\n end",
"def authenticate( raw_vals )\n\n username = (raw_vals[:username] || raw_vals['username']).to_s.strip\n password = (raw_vals[:password] || raw_vals['password']).to_s.strip\n ip_addr = (raw_vals[:ip_address] || raw_vals['ip_address']).to_s.strip\n user_agent = (raw_vals[:user_agent] || raw_vals['user_agent']).to_s.strip\n \n ip_addr = nil if ip_addr.empty?\n user_agent = nil if user_agent.empty?\n\n if username.empty? || password.empty?\n raise Wrong_Password, \"#{raw_vals.inspect}\"\n end\n mem = Life.find.username( username ).grab(:owner).go_first!\n\n # Check for Password_Reset\n raise Password_Reset::In_Reset, mem.inspect if mem.password_in_reset?\n\n # Check for too many failed attempts.\n # Raise Account::Reset if necessary.\n fail_count = Failed_Log_In_Attempt.for_today(mem).count\n if fail_count > 2\n mem.reset_password\n raise Password_Reset::In_Reset, mem.inspect\n end\n \n # See if password matches with correct password.\n correct_password = BCrypt::Password.new(mem.data.hashed_password) === (password + mem.data.salt)\n return mem if correct_password\n\n # Update failed count.\n new_count = fail_count + 1\n \n # Insert failed password.\n Failed_Log_In_Attempt.create(\n nil,\n :owner_id => mem.data._id, \n :ip_address => ip_addr,\n :user_agent => user_agent \n )\n\n raise Wrong_Password, \"Password is invalid for: #{username.inspect}\"\n end",
"def passwords_match?\n context.user.password == context.password\n end",
"def authenticate(username,password)\n user = @@users_module.lookup_user(username)\n return false if not user\n salt=user['salt']\n hashpass=Digest::SHA256.hexdigest(salt + password)\n if(hashpass == user['password'])\n return true\n end\n return false\n end",
"def authenticate(username, password)\n if user = find_by_username(username)\n if user.correct_password?(password)\n user\n end\n end\n end",
"def authenticate(username, password)\n @username = username\n @password = password\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end",
"def authenticate_signin(email, password)\n Credentials::Password.authenticate_email email, password\n end",
"def authenticate!\n # Do nothing yet\n end",
"def check(creds)\n creds[1].crypt(password) == password\n end",
"def setup_password_credentials\n config_key = credential_config_key\n\n if config(\"#{config_key}.user\") && config(\"#{config_key}.password\")\n $stderr.puts \"Password credentials already configured for API Provider #{api_url}\"\n unless yes?('Would you like to reconfigure the password for this provider?')\n $stderr.puts 'Nothing to do.'\n exit 1\n end\n end\n\n username, password, response = _auth_loop_request(\"#{api_url}/user\") { |url|\n Net::HTTP::Head.new(url.path)\n }\n\n case response\n when Net::HTTPOK\n $stdout.puts \"Storing username/password credentials for API Provider #{api_url} with key #{config_key}\"\n store_config_credentials(username, :password => password)\n else\n $stderr.puts \"Failed to acquire credentials: #{response.code}: #{response.message}\"\n end\n nil\n end",
"def get_username_and_password_diligently\n while true\n credentials = get_username_and_password_and_authenticate\n if credentials == false\n puts \"Could not authenticate, try again?\"\n puts \"y/n\"\n\n again = STDIN.gets.strip\n case again.downcase\n when \"y\"\n when \"n\"\n return false\n end\n else\n return credentials\n end\n end\n end",
"def authenticate(username, user_password)\n data_arr = load_data\n user_data(data_arr, username, user_password)\n end",
"def authenticate\n @username = params[:username]\n @password = params[:password]\n user = User.find_by(username: @username)\n\n # NEED TO ADD THE PASSWORD VERIFICATION BACK IN\n if user && user.authenticate(@password)\n render json: { auth_token: user.generate_auth_token, user_id: user.id, user_name: user.name }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end",
"def receive_plain_auth user, password\n true\n end",
"def receive_plain_auth user, password\n true\n end",
"def authenticate_via_identity password\n (provider == 'identity') &&\n (id = Identity.find_by_id(uid)) &&\n id.authenticate(password)\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"myTaskboard Login\") do |email, password|\n user = User.where(email: email, password: password).first rescue nil\n redirect_to controller: :login, action: :index, status: 403 and return if user.nil?\n\n session[:current_user_id] = user.id #rescue nil\n end\n end",
"def authenticate(passwd)\n User.password_hash(passwd.to_s, salt) == password ? self : false\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend",
"def authenticate_user\n if Rails.env.production?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == Wordpressed.password\n end\n end\n #warden.custom_failure! if performed?\n end",
"def authenticate(password)\n return :expired if expired?\n return :invalid unless check_password(password)\n user.auth_bounce_reason(self) || user\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end",
"def authenticate(*args)\n authenticate!(*args)\n rescue\n nil\n end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def authenticate_user\n if I18nEditor.configuration.authentication_user.present? and I18nEditor.configuration.authentication_password.present?\n authenticate_or_request_with_http_basic do |username, password|\n username == I18nEditor.configuration.authentication_user && password == I18nEditor.configuration.authentication_password\n end\n end\n end",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticates?(password)\r\n self.password == Crypto::digest(password)\r\n end",
"def authenticate_user(username, password, user_list)\n user_list.each do |user|\n if user[:username] == username && verify_hash_digest(user[:password]) == password\n return user\n end\n end\n \"Credentials were not correct\"\n end",
"def authenticate!\n resource = mapping.to.where(:username => authentication_hash[:email]).first if authentication_hash\n resource ||= mapping.to.new if resource.nil?\n\n username = authenticate_against_ebay(authentication_hash[:email], password)\n\n if username\n resource.username = username\n resource.password = password\n resource.password_confirmation = password\n resource.save if resource.changed?\n end\n\n return fail(:invalid) unless username and resource\n\n if validate(resource) { not resource.nil? }\n success!(resource)\n end\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def enter_password_shared\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end",
"def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend",
"def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end",
"def authenticate!(password)\n raise_if_blank password, 'password'\n resp = API.connection.post 'users/sign_in', { \n user: {\n email: @email, \n password: password\n }\n }\n\n case resp.status\n when 201\n refresh_from_user_response resp\n when 401\n raise Teachable::AuthError, resp.body['error']\n else\n raise Teachable::Error, 'Unknown response.'\n end\n end",
"def authenticate(field, password)\n @u = find_active_with_conditions(MA[:login_field] => field)\n @u = @u && @u.authenticated?(password) ? @u : nil\n end",
"def auth(login, passwd)\n @user = User.find_by_login(login) \n if @user.passwd == encrypt(passwd, @user.salt) \\\n and @user.userstatus_id == 2\n return @user \n end\n end",
"def authenticate(username, password)\n true\n end",
"def authenticate(*args)\n warden.authenticate(*args)\n end",
"def authenticate(params)\n params.merge!(:password => get_password)\n user_store = Evernote::UserStore.new(USER_STORE_URL, params)\n begin\n token = user_store.authenticate\n log.info \"Evernote authentication was successful for #{USER_COLOR} #{params[:username]}\"\n token\n rescue Evernote::UserStore::AuthenticationFailure\n log.error \"Evernote authentication failed for #{USER_COLOR} #{params[:username]}\"\n return\n end\n end",
"def authenticate(username, password)\n if @users[username] && @users[username][:password] == password\n { :code => 'Access-Accept' }.merge(@users[username][:attributes])\n else\n { :code => 'Access-Reject' }\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end",
"def fCheckCredentials (email, pwd)\n @users.checkCredentials(email,pwd)\n end",
"def authenticate(password)\n self.authenticated?(password) ? self : nil\n end",
"def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end",
"def authenticate(user, password, account)\n user == @user &&\n (password.nil? || password == @password) &&\n (account.nil? || account == @account)\n end",
"def authenticate(controller, realm, &password_procedure)\n authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure)\n end",
"def password_request\n password_input = @prompt.mask(\"Please enter your password, or type quit.\")\n if password_input == @user.password\n puts \"Successful login!\"\n @user\n user_menu_runner\n #user can quit this process\n elsif password_input == \"quit\" || password_input == \"exit\"\n exit\n else\n #try again\n puts \"Sorry, incorrect password. Try again.\" # add esscape option\n password_request\n end\n end",
"def authenticate_with_http_digest(realm = T.unsafe(nil), &password_procedure); end",
"def authorize(username, password)\np username\np password\n username == settings.username && password == settings.password\n end",
"def authenticate(email, password)\n query = <<SQL\nSELECT id, account_name, nick_name, email\nFROM users\nWHERE email = ? AND passhash = SHA2(CONCAT(?, salt), 512)\nSQL\n result = db.xquery(query, email, password).first\n unless result\n raise Isucon5::AuthenticationError\n end\n session[:user_id] = result[:id]\n result\n end",
"def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def authenticate(username, password)\n Base.authenticate(username, password)\n end",
"def check_credentials\n @user = User.where(email: params[:email]).first\n if @user && @user.valid_password?(params[:password])\n head :ok\n else\n head :unauthorized\n end\n end",
"def authenticate(*args)\n warden.authenticate(*args)\n end",
"def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend",
"def auth_user(username, password, list_of_users)\n list_of_users.each do |user_record|\n if user_record[:username] == username && user_record[:password] == password\n return user_record\n end\n end\n \"Credentials were not correct\"\nend",
"def authenticate(username, password)\n user = find_user(username)\n hash = BCrypt::Password.new(user.password) rescue nil\n (hash && hash == password) ? user : nil\n end",
"def authenticated?(pass)\n encrypted_password == User.encrypt(pass, salt)\n end",
"def authenticate(*args)\n warden.authenticate!(*args)\n end",
"def authenticate(*args)\n warden.authenticate!(*args)\n end",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def valid_password?(password); end",
"def verify_authentication(username, password, validation_factors = {})\n end",
"def authenticate!\n redirect_to login_path unless current_user\n end",
"def enter_password\n end",
"def authenticate(password)\n !self.locked? && super\n end",
"def authenticate\n user = User.active.where(\"email_id = ?\", self.email_id).first\n if user.present?\n return user.hashed_password == Digest::SHA1.hexdigest(user.password_salt.to_s + self.password)\n end\n return false\n end",
"def auth_user(username, password, list_of_users)\n list_of_users.each do |user_record|\n if user_record[:username] == username && user_record[:password] == password\n print \"Your Credentials: \"\n return user_record\n end\n end\n \"Credentials were not correct. Try Again\"\nend",
"def authenticate!\n unless params[:user].nil?\n init_local_admin\n my_username = params[:user][:username].strip\n my_password = params[:user][:password].strip\n user = User.find_by_username(my_username)\n if my_username == @local_admin[\"username\"] && my_password == @local_admin[\"password\"]\n # Local admin authentication\n if user.nil?\n user= User.new(:username => @local_admin[\"username\"], :email=>@local_admin[\"email\"], :password => @local_admin[\"password\"], \\\n :password_confirmation => @local_admin[\"password\"], :role => 0)\n user.save!\n end\n user = User.find_by_username(my_username)\n success!(user)\n elsif user && user.valid_password?(my_password) # Local user database authentication\n success!(user)\n else\n fail(\"User name or password invalid \")\n end\n else\n fail\n end\n end",
"def authenticate(password)\n hashed_password == BCrypt::Engine.hash_secret(password, salt)\n end",
"def authenticate(unencrypted_password)\n [password_digest, ao_password].compact.any? do |password|\n BCrypt::Password.new(password).is_password?(unencrypted_password)\n end && self\n end",
"def authenticate!(*args)\n warden.clear_strategies_cache!\n warden.authenticate!(*args)\n end",
"def check_authentication( req )\n\t\tusername = req.params[:username]\n\t\tpassword = req.params[:password]\n\n\t\tunless hmac = self.class.users[ username ]\n\t\t\tself.log.error \"Auth failure: no such user %p\" % [ username ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\tpw_hmac = OpenSSL::HMAC.hexdigest( 'sha1', self.class.key, password )\n\t\tself.log.debug \" hash of 'demo' is: %p\" % [ OpenSSL::HMAC.hexdigest('sha1', self.class.key, 'demo') ]\n\n\t\tunless hmac == pw_hmac\n\t\t\tself.log.error \"Auth failure: password digests don't match: expected %p, got %p\" %\n\t\t\t\t[ hmac, pw_hmac ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\t# Tell the auth provider that the user provided valid credentials\n\t\tself.auth_provider.auth_succeeded( req, username )\n\n\t\treturn username\n\tend"
] |
[
"0.7542667",
"0.72435147",
"0.7234556",
"0.7230701",
"0.7218011",
"0.7214323",
"0.72076756",
"0.71991116",
"0.7153465",
"0.7032604",
"0.70288247",
"0.6983232",
"0.6978997",
"0.6938965",
"0.6933271",
"0.69056565",
"0.6851127",
"0.68439",
"0.68439",
"0.6822622",
"0.6809123",
"0.6780491",
"0.6755429",
"0.6747049",
"0.66865355",
"0.66840994",
"0.66839856",
"0.66681206",
"0.66579396",
"0.66528225",
"0.66454136",
"0.66443294",
"0.66349345",
"0.6630093",
"0.6607401",
"0.66069555",
"0.66069555",
"0.6601672",
"0.6576735",
"0.65659124",
"0.6538764",
"0.65368104",
"0.65312415",
"0.65213567",
"0.65121675",
"0.650745",
"0.6503333",
"0.6490683",
"0.64878434",
"0.6485607",
"0.64787763",
"0.6475818",
"0.6473479",
"0.6473479",
"0.6468967",
"0.64651847",
"0.64639795",
"0.6462891",
"0.64562064",
"0.64501727",
"0.64500064",
"0.64450103",
"0.64413583",
"0.64405257",
"0.64324886",
"0.6430448",
"0.64278185",
"0.6419576",
"0.6419401",
"0.64193016",
"0.6416735",
"0.64098907",
"0.6405632",
"0.64002067",
"0.6395912",
"0.6394218",
"0.6393285",
"0.63924414",
"0.6385009",
"0.6384079",
"0.63822615",
"0.63802665",
"0.6380004",
"0.6379737",
"0.6379737",
"0.6379668",
"0.6379668",
"0.6379668",
"0.6379668",
"0.6371417",
"0.63707197",
"0.63690424",
"0.6356259",
"0.6348972",
"0.63479006",
"0.6336888",
"0.63296473",
"0.6329028",
"0.6328945",
"0.6324342",
"0.6312143"
] |
0.0
|
-1
|
Authenticate against passwords in database
|
def authenticate_local(provided_password)
if self.password.blank?
return false
end
pass = BCrypt::Password.new(self.password)
if(pass == provided_password)
token_object = generate_token
return token_object.token
end
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def authenticate password\n if self.password == password\n true\n else\n false\n end\n end",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def passwords_match?\n context.user.password == context.password\n end",
"def authenticate(password)\n true\n end",
"def authenticate!(psw)\n User.encrypt_token(psw, password_salt) == encrypted_password\n end",
"def authenticate(pass)\n password.is_password?(pass) && self\n end",
"def login (db, username, password)\n results = db.get_first_value('SELECT Password FROM log_in WHERE TwitterUsername = ?', [username])\n if(results == password)\n return true\n else\n return false\n end\n \nend",
"def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end",
"def authenticate(password)\n user && user.password == password\n end",
"def check(creds)\n creds[1].crypt(password) == password\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def password_compare(password, user_id)\n password_digest = db.execute(\"SELECT password_digest FROM users WHERE user_id=?\", user_id)[0][0]\n if BCrypt::Password.new(password_digest) == password\n return true\n else\n return false\n end\n\nend",
"def check_passwords_against_database(value = nil)\n rw_config(:check_passwords_against_database, value, true)\n end",
"def valid_password?(password); end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end",
"def authenticate(user, pass)\n self.logger.debug \"#{user} : #{pass}\"\n Digest::MD5.hexdigest(pass) == CREDENTIALS[user]\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def authenticate(request, realm, &password_procedure); end",
"def login_verification(params_username, params_password) \n db = connect_to_database()\n database_info = db.execute(\"SELECT Username, Password, UserId FROM users WHERE users.Username = ?\", params_username)\n if database_info.length > 0 && BCrypt::Password.new(database_info.first[\"Password\"]) == params_password\n return true \n else\n return false\n end\n end",
"def authenticate_with_password(input_password)\n return false unless self.valid_password?(input_password)\n authenticate\n end",
"def password_authentication\n if user = User.authenticate(params[:login], params[:password])\n successful_login(user,params[:url])\n else\n failed_login(user, \"Couldn't log you in as '#{params[:login]}'\")\n end\n end",
"def valid_password?; end",
"def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end",
"def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n raise \"That username and password combination does not exist\"\n end\n end",
"def authenticate( raw_vals )\n\n username = (raw_vals[:username] || raw_vals['username']).to_s.strip\n password = (raw_vals[:password] || raw_vals['password']).to_s.strip\n ip_addr = (raw_vals[:ip_address] || raw_vals['ip_address']).to_s.strip\n user_agent = (raw_vals[:user_agent] || raw_vals['user_agent']).to_s.strip\n \n ip_addr = nil if ip_addr.empty?\n user_agent = nil if user_agent.empty?\n\n if username.empty? || password.empty?\n raise Wrong_Password, \"#{raw_vals.inspect}\"\n end\n mem = Life.find.username( username ).grab(:owner).go_first!\n\n # Check for Password_Reset\n raise Password_Reset::In_Reset, mem.inspect if mem.password_in_reset?\n\n # Check for too many failed attempts.\n # Raise Account::Reset if necessary.\n fail_count = Failed_Log_In_Attempt.for_today(mem).count\n if fail_count > 2\n mem.reset_password\n raise Password_Reset::In_Reset, mem.inspect\n end\n \n # See if password matches with correct password.\n correct_password = BCrypt::Password.new(mem.data.hashed_password) === (password + mem.data.salt)\n return mem if correct_password\n\n # Update failed count.\n new_count = fail_count + 1\n \n # Insert failed password.\n Failed_Log_In_Attempt.create(\n nil,\n :owner_id => mem.data._id, \n :ip_address => ip_addr,\n :user_agent => user_agent \n )\n\n raise Wrong_Password, \"Password is invalid for: #{username.inspect}\"\n end",
"def authenticate(passwd)\n User.password_hash(passwd.to_s, salt) == password ? self : false\n end",
"def validate_password(email, password)\n password_for_email = $db.execute(\"SELECT password_digest FROM users WHERE email = ?\", email)[0][\"password_digest\"]\n p \"validating password\"\n if BCrypt::Password.new(password_for_email) == password\n p \"password match\"\n return true\n else\n p \"password not match\"\n return false\n end\nend",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def authenticate(email, password)\n query = <<SQL\nSELECT id, account_name, nick_name, email\nFROM users\nWHERE email = ? AND passhash = SHA2(CONCAT(?, salt), 512)\nSQL\n result = db.xquery(query, email, password).first\n unless result\n raise Isucon5::AuthenticationError\n end\n session[:user_id] = result[:id]\n result\n end",
"def check_password(password)\n self.try(:authenticate, password)\n end",
"def authenticate(password)\n hashed_password == BCrypt::Engine.hash_secret(password, salt)\n end",
"def db_verify_user_password(userid, password)\n\t\t\n\t\t# SQL statement for selecting * given a userid and a hashed password\n \tquery = \"SELECT * FROM users\n\t\t\t\tWHERE userid='%%email%%'\n\t\t\t\tAND password='%%password%%';\"\n\t\t\n\t\t# Fill in userid and password values in the SQL statement\n \tquery = query.gsub(/%%email%%/, PG::Connection.escape_string(userid)).gsub(/%%password%%/, hashPassword(password))\n \t\n \t# Connect to the database\n \tconn = DBTools.new.connectToDB()\n \t\n \t# Execute SQL Statement\n results = conn.exec(query)\n \n # If there are 0 results\n if (results.ntuples == 0)\n \tresults.clear()\n conn.finish()\n return false\n\n # If there are too many results (this should never occur)\n elsif (results.ntuples > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many password matches.\"\n \n # Query successful\n else\n \tresults.clear()\n \tconn.finish()\n \treturn true\n end\n\tend",
"def authenticate(password)\n\t\t# If the hashed version of the password matches what's in the database, it's valid\n\t\tif BCrypt::Password.new(self.password_digest) == password\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend",
"def authenticates?(password)\r\n self.password == Crypto::digest(password)\r\n end",
"def authenticated?(pass)\n encrypted_password == User.encrypt(pass, salt)\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def login(email, password)\n password_digest = db.execute(\"SELECT password FROM users WHERE email=?\", email)\n if BCrypt::Password.new(password_digest[0][0]) == password\n user_id = db.execute(\"SELECT user_id FROM users WHERE email=?\", email)[0][0]\n return [true, email, user_id]\n else\n return [false]\n end\nend",
"def password\n\n end",
"def password(db_connection)\n sql = 'SELECT password FROM user_logins WHERE user_id=$1;'\n db_connection.exec_params(sql, [ id ]).first['password']\n end",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def authenticate(password)\n\t\tself.hashed_password ==\n\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend",
"def authenticate_user(username, password, list_of_users)\n list_of_users.each do |user_record|\n if user_record[:username] == username && verify_hash_digest(user_record[:password]) == password\n return user_record\n end\n puts \"Credentials are not correct\"\n end\n end",
"def authenticate(guesspassword)\n\t# self.hash_password ==\n\tself.hashed_password ==\n\t # BCrypt::Engine.hash_secret(password, self.salt)\n\t BCrypt::Engine.hash_secret(guesspassword, self.salt)\nend",
"def login(try_password)\n pass = Password.new(self.password.encode('ascii-8bit'))\n return pass == try_password\n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def password\n end",
"def password\n end",
"def authenticate(username, password)\n end",
"def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end",
"def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end",
"def validate_login(username, password)\n user = nil\n begin\n user = @users.find_one(_id: username)\n # you will need to retrieve right document from the users collection.\n p 'This space intentionally left blank.'\n rescue\n p 'Unable to query database for user'\n end\n\n if user.nil?\n p 'User not in database'\n return nil\n end\n\n salt = user['password'].split(',')[1]\n\n if user['password'] != make_pw_hash(password, salt)\n p 'user password is not a match'\n return nil\n end\n # Looks good\n user\n end",
"def fetch(password)\r\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end",
"def authenticate(password)\n\t\t\tself.hashed_password ==\n\t\t\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def check_login(username, password)\n hashed_password = Digest::SHA2.hexdigest(password)\n\n @login_database.each_with_index do |data, index|\n return true if (data.include? username + \" || \" + hashed_password)\n end\n return false\nend",
"def authenticate_with_password(plain_password)\n ::Challah::Encrypter.compare(self.crypted_password, plain_password)\n end",
"def authenticate\n user = User.active.where(\"email_id = ?\", self.email_id).first\n if user.present?\n return user.hashed_password == Digest::SHA1.hexdigest(user.password_salt.to_s + self.password)\n end\n return false\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",
"def enter_password\n end",
"def checkPass(_username, _password)\n e = self.encrypt\n encryptPass = e.encrypt(_password)\n #check a user's password\n coll = self.coll_users \n combo = coll.find({\"username\" => _username, \"password\" => encryptPass}).to_a\n # if the user collection is empty here, it means the username is available\n test = JSON.generate(combo)\n test2 = JSON.parse(test)\n\n test2.each do |doc|\n if doc[\"password\"].to_s === encryptPass.to_s\n return true \n else\n return false\n end\n end\n end",
"def login()\n db = SQLite3::Database.new('db/db.db')\n result = db.execute(\"SELECT Password FROM users WHERE Username =(?)\", params[\"name\"])\n if result[0] == nil\n session[:loginfail] = true\n redirect('/')\n end\n not_password = result[0][0]\n if BCrypt::Password.new(not_password) == params[\"pass\"]\n session[:loggedin] = true\n session[:user] = params[\"name\"]\n redirect('/')\n else\n session[:loginfail] = true\n redirect('/')\n end\nend",
"def authenticate(unencrypted_password)\n logger.debug(unencrypted_password)\n logger.debug(self)\n if BCrypt::Password.new(self.password_digest) == unencrypted_password\n \t return self\n else\n return false\n end\n end",
"def authenticate(unencrypted_password)\n [password_digest, ao_password].compact.any? do |password|\n BCrypt::Password.new(password).is_password?(unencrypted_password)\n end && self\n end",
"def authenticate(username,password)\n user = @@users_module.lookup_user(username)\n return false if not user\n salt=user['salt']\n hashpass=Digest::SHA256.hexdigest(salt + password)\n if(hashpass == user['password'])\n return true\n end\n return false\n end",
"def authenticate(username, password)\n if user = find_by_username(username)\n if user.correct_password?(password)\n user\n end\n end\n end",
"def authenticated?(password)\n self.hashed_password == encrypt(password)\n end",
"def my_pass(user_id, pass_id)\n result = db_connection().execute('SELECT * FROM passwords WHERE user_id=? AND id=?', user_id, pass_id)\n p result\n p user_id\n p pass_id\n return result[0] != nil\n end",
"def authenticate(password)\n return :expired if expired?\n return :invalid unless check_password(password)\n user.auth_bounce_reason(self) || user\n end",
"def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end",
"def authenticate(passwd)\n unless self.hash == encrypt(passwd)\n raise TradeException, \"Wrong password!\"\n end\n\n end",
"def verify_password(*)\n false\n end",
"def password?\n password\n end",
"def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def admin_authenticate?(password)\r\n salt = get_setting(:admin_pass_salt, \"\")\r\n hash = get_setting(:admin_pass_hash, \"\")\r\n hash == BCrypt::Engine.hash_secret(password, salt)\r\n end",
"def login_from_params\n authenticate(params[:password])\n end",
"def authenticated?(password)\n self.hashed_password == encrypt(password) or using_bypass(password)\n end",
"def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend",
"def validate_password?\n provider == :password\n end",
"def authenticate(auth_password)\n if(password_digest)\n password_digest == checksum(auth_password)\n else\n false\n end\n end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end",
"def password; datastore['PASSWORD']; end",
"def auth(login, passwd)\n @user = User.find_by_login(login) \n if @user.passwd == encrypt(passwd, @user.salt) \\\n and @user.userstatus_id == 2\n return @user \n end\n end",
"def test_set_hashpass\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\told_hashpass = res[0]['hashpass']\n\t\tassert old_hashpass.size > 20\n\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'bl00p€r'])\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\trefute_equal old_hashpass, res[0]['hashpass']\n\t\tassert res[0]['hashpass'].size > 20\n\t\t# password must be > 3 characters\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'x¥z'])\n\t\tend\n\t\tassert err.message.include? 'short_password'\n\tend",
"def authenticate(input_password=nil)\n # input_password = \"password\"\n # stored = Password.create(original_password)\n # password_hash = Password.new(stored)\n # return true if\n begin\n return false if input_password.nil? || input_password.empty?\n # return false if self.password_digest.nil?\n password_hash = Password.new(self.password_digest)\n return password_hash == input_password\n rescue => e\n p e\n return false\n end\n end",
"def check_login(username, password)\n\n results = $db.execute('SELECT * FROM users WHERE username = ?', username)\n p results\n if results == [] \n return -1\n end\n\n password_digest = results[0]['password_digest']\n userid = results[0]['userid']\n\n if BCrypt::Password.new(password_digest) == password \n return userid\n else\n return 0\n end\n end",
"def password_required?; end",
"def authenticated?(password)\n self.crypted_password == self.encrypt(password)\n end",
"def authenticatebis(name, password)\n if m=Member.find_by_name(name) \n \tif (m.authenticate(password))\n\t\t\t true\n\t\t\telse\n\t\t\t return -1\n\t\t\tend\n \telse\n \treturn -2\n end\n end",
"def validate_password\n score = []\n score << repetitive_substring(@row[\"password\"])\n score << string_length(@row[\"password\"])\n score << upper_lower_case(@row[\"password\"])\n score << digit(@row[\"password\"])\n character_change = score.sum\n @row[\"status\"] = (character_change.zero? ? \"Strong\" : character_change)\n return @row\n end",
"def authenticated?(pass)\n\t\tencrypted_password == User.encrypt(pass,salt)\n\tend",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end"
] |
[
"0.74291587",
"0.73806864",
"0.73486435",
"0.7331528",
"0.7313712",
"0.727355",
"0.7256975",
"0.72473866",
"0.7238763",
"0.71585363",
"0.7110982",
"0.7086134",
"0.7049169",
"0.7008752",
"0.6975806",
"0.6969461",
"0.6969461",
"0.6956913",
"0.6950632",
"0.68854356",
"0.6868332",
"0.68673784",
"0.6860723",
"0.6859467",
"0.68356246",
"0.6834019",
"0.68306774",
"0.6820558",
"0.6801381",
"0.6795275",
"0.6794746",
"0.67612517",
"0.67460424",
"0.67450863",
"0.67407656",
"0.6731755",
"0.6730357",
"0.67260045",
"0.67200536",
"0.66910535",
"0.6682199",
"0.6677513",
"0.6647382",
"0.66462153",
"0.6643277",
"0.6639575",
"0.6635697",
"0.6620483",
"0.6617511",
"0.6617511",
"0.66143435",
"0.6599895",
"0.6594274",
"0.6589971",
"0.65883785",
"0.6583292",
"0.65717477",
"0.6565456",
"0.6565456",
"0.6565456",
"0.6565456",
"0.6565456",
"0.6565456",
"0.65591353",
"0.6554815",
"0.6554229",
"0.65514314",
"0.6539969",
"0.6530643",
"0.65296245",
"0.6527803",
"0.65257996",
"0.6519275",
"0.65143347",
"0.6510142",
"0.65097123",
"0.6504735",
"0.6502934",
"0.6500465",
"0.64880836",
"0.6486994",
"0.6475187",
"0.64676785",
"0.6459983",
"0.6456072",
"0.64506626",
"0.644858",
"0.6441725",
"0.64367044",
"0.6432165",
"0.64280283",
"0.64270437",
"0.64261246",
"0.64248663",
"0.64246047",
"0.64079225",
"0.64044905",
"0.64003384",
"0.63936514",
"0.63894665",
"0.6387889"
] |
0.0
|
-1
|
Generate a random token
|
def generate_token
token_hash = SecureRandom.hex
token_hash.force_encoding('utf-8')
access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end",
"def rand_token\n\t\ttok = rand(36**8).to_s(36)\n\t\tif tok.length < 8\n\t\t\trand_token\n\t\telse\n\t\t\ttok\n\t\tend\n\tend",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def generate_token\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n token = (0...50).map { o[rand(o.length)] }.join\n return token\n end",
"def generate_random_token\n SecureRandom.hex(15)\n end",
"def random_token\n SecureRandom.hex(20)\n end",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def generate_random_token\n #generates a random hex string of length 5\n unless self.random_token\n self.random_token = SecureRandom.hex(5)\n end\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def generate_token\n SecureRandom.hex(10)\n end",
"def generate_token\n loop do\n token = SecureRandom.base64(44).tr(\"+/=\", \"xyz\").first(16).upcase\n break token unless self.class.where(:token => token).first\n end\n end",
"def generate_token\n SecureRandom.urlsafe_base64.tap do |token|\n logger.debug \"Generated token #{token}\"\n end\n end",
"def generate_token\n self.token ||= SecureRandom.hex(16)\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def random_token\n SecureRandom.urlsafe_base64\n end",
"def generate_token\n SecureRandom.hex(64)\nend",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def gen_token()\n used_tokens = []\n @data.records.each() { |r| used_tokens << r.token }\n\n free_tokens = @data.tokens - used_tokens\n\n srand\n free_tokens[rand(free_tokens.length)]\n end",
"def generate_token\n self.token = SecureRandom.base64(64)\n end",
"def randomToken\n @tokens[rand(@tokens.size)]\n end",
"def generate_token\n self.token ||= loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless self.class.exists?(token: random_token)\n end\n end",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.base58(UID_LENGTH)\n break random_token unless Session.exists?(token: random_token)\n end\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def generate_token\n @token = SecureRandom.base58(10)\n self.update(token: @token)\n end",
"def rand_token length=36\r\n\ttoken = ''\r\n\tlength.times do\r\n\t\ttoken += (random(0, 2)==1) ? (random(0,10).to_s) : (rand_let())\r\n\tend\r\n\ttoken\r\nend",
"def generate_token(length = 48)\n SecureRandom.base64(length)\n end",
"def generate_token(size)\n validity = Proc.new {|token| Token.where(:token => token).first.nil?}\n\n begin\n token = SecureRandom.hex(size)[0, size]\n token = token.encode(\"UTF-8\")\n end while validity[token] == false\n\n token\n end",
"def generate_token\n self.token = SecureRandom.hex if new_record?\n end",
"def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend",
"def generate_token\n unless self.token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless User.exists?(token: random_token)\n end\n self.save\n end\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end",
"def random_token_digest\n token_digest( random_token )\n end",
"def generatePlayerToken\n\t\to = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n\t\tstring = (0...50).map { o[rand(o.length)] }.join\n\t\treturn string\n\tend",
"def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end",
"def friendly_token\n SecureRandom.base64(32).tr('+/=lIO0', 'pqrsxyz')\n end",
"def generate_token(options = {})\n values = [rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x1000000), rand(0x1000000)]\n \"%04x%04x-%04x-%04x-%04x-%06x%06x\" % values\n end",
"def generate_token\n #Token.generate_token(self.id)\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Organization.exists?(token: random_token)\n end\n end",
"def generate_token(n: 36)\n token = nil\n loop do\n token = SecureRandom.urlsafe_base64(n)\n return token if valid_new_token?(token)\n end\n end",
"def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end",
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end",
"def generate_auth_token\n begin\n token = SecureRandom.hex\n end while AuthToken.exists?(auth_token: token)\n self.auth_tokens.create(auth_token: token)\n token\n end",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def generate_secure_token_string\n SecureRandom.urlsafe_base64(25).tr('lIO0', 'sxyz')\n end",
"def generate_token\n begin\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end while Invitation.exists?(:token => self.token)\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n \t\tSecureRandom.urlsafe_base64\n \tend",
"def random_token length = 5\n token = \"\"\n alphabets = \"abcdefghijklmnopqrstuvwxyz\"\n 1.upto(length) do |i|\n idx = rand(alphabets.length)\n token += alphabets[idx..idx]\n end\n return token\nend",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def token_id\n SecureRandom.random_bytes(16).bytes.to_a\n end",
"def generate_token\n self.token = custom_token.presence || SecureRandom.hex(3)\n self.custom_token = nil\n generate_token if AliasedLink.exists?(token: token)\n end",
"def new_token\n\t\tSecureRandom.urlsafe_base64\n\tend",
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end",
"def generate_access_token\n allowed_chars = [*'0'..'9', *'a'..'z', *'A'..'Z'].join\n self.access_token = 128.times.map { allowed_chars[rand(allowed_chars.size)] }.join\n end",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def generate_token\n\t\tself.token = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64(nil, false)\n\t\t\tbreak random_token unless Invite.exists?(token: random_token)\n\t\tend\n\tend",
"def token\n return self[:token] if self[:token] # <- Will not generate a token more than once.\n begin\n byte_string = [self.user_id, rand(2**32)].pack('L*') << rand(256)\n self[:token] = Base64.urlsafe_encode64(byte_string)\n end while UserAuthToken.exists?(token: self[:token])\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\nend",
"def generate_token\n loop do\n new_token = Digest::SHA1.hexdigest([Time.now, rand].join).first(35)\n break self.token = new_token unless InvitationLink.where(:token => new_token).exists?\n end\n end",
"def set_token\n self.token ||= SecureRandom.uuid.gsub(/\\-/, '').first(5).upcase\n end",
"def friendly_token(length = 20)\n # To calculate real characters, we must perform this operation.\n # See SecureRandom.urlsafe_base64\n rlength = (length * 3) / 4\n SecureRandom.urlsafe_base64(rlength).tr('lIO0', 'sxyz')\n end",
"def generate_auth_token\n loop do \n token = SecureRandom.hex\n break token unless self.class.exists?(auth_token: token)\n end\n end",
"def generate_authentication_token\n SecureRandom.hex(8)\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless FeedbackRequest.exists?(token: random_token)\n end\n end",
"def nuevo_token # Igual - Modo ExtraConfuso\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend",
"def generate_token\n self.email_token = SecureRandom.hex(3)\n self.mobile_token = SecureRandom.hex(3)\n end",
"def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end",
"def generate_token\n if self.token.blank?\n self.id = self.token = UniqueToken.generate\n end\n end"
] |
[
"0.848953",
"0.84795976",
"0.8477234",
"0.845374",
"0.8431042",
"0.8409435",
"0.83842605",
"0.83466655",
"0.83185303",
"0.82754123",
"0.8212093",
"0.8150419",
"0.8132802",
"0.81114125",
"0.80903524",
"0.80601895",
"0.8052892",
"0.804667",
"0.80160993",
"0.8008536",
"0.79660404",
"0.7911379",
"0.78874445",
"0.7861341",
"0.78569794",
"0.78465545",
"0.7831197",
"0.78146213",
"0.77941644",
"0.77714264",
"0.7744216",
"0.7733093",
"0.7725635",
"0.7713058",
"0.7706542",
"0.7698969",
"0.76713204",
"0.7656501",
"0.7633308",
"0.76071036",
"0.7604957",
"0.7588153",
"0.75819373",
"0.7573621",
"0.756054",
"0.75490683",
"0.7548257",
"0.7546567",
"0.75375426",
"0.7501009",
"0.7501009",
"0.7501009",
"0.74911416",
"0.7490238",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.74808866",
"0.747434",
"0.7449252",
"0.7447201",
"0.7443461",
"0.74356276",
"0.74280596",
"0.7423053",
"0.7423053",
"0.7423053",
"0.7423053",
"0.7423053",
"0.7405463",
"0.7394484",
"0.7376137",
"0.7369462",
"0.7348913",
"0.7339364",
"0.7333851",
"0.7330569",
"0.73233503",
"0.73196733",
"0.7314126",
"0.73136425",
"0.73125887",
"0.72957003",
"0.7291987",
"0.7284546",
"0.7252247",
"0.7249018",
"0.7243227"
] |
0.7461941
|
71
|
create new FantasyStat load_tournament_list load_tournament_game_data create_leagues load_player_data
|
def load_fantasy_stats
load_tournament_list
load_tournament_game_data
create_leagues
load_player_data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @game = Game.new(params[:game])\n\t\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Create a team to hold the home team players\n home_team = Team.new\n home_team.name = params[:home_team_name]\n home_team.save\n @game.home_team_id = home_team.id\n \n #Create a team to hold the away team players\n away_team = Team.new\n away_team.name = params[:away_team_name]\n away_team.save\n @game.away_team_id = away_team.id\n \n #Create home and away teams from available players\n build_teams(home_team, away_team)\n \n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teams_from_teams_playoffs()\n end",
"def create_stat_team_data\n # all_teams_hashes \n # <---- calls the API we should only to this once when seeding the data\n \n $Total_arr.each do |team|\n Stat.create_or_find_by(\n team_api_id: team['team']['id'],\n team_name: team['team']['name'],\n wins: team['won'],\n draws: team['draw'],\n losses: team['lost'],\n goals_for: team['goalsFor'],\n goals_against: team['goalsAgainst'],\n standing: team['position'],\n )\n end\nend",
"def create_match(match_data)\n participants = match_data[\"participantIdentities\"]\n for participant in participants do\n # Create a new Match object.\n match = Match.new\n # Set the Match's summoner_id field.\n summoner = create_summoner(participant[\"player\"][\"summonerName\"])\n match.summoner_id = summoner.id\n # Set the Match's champion_id and win field.\n participant_data = match_data[\"participants\"]\n current_summoner = participant_data.find do |data|\n data[\"participantId\"] == participant[\"participantId\"]\n end\n match.champion_id = Champion.find_by(champ_id: current_summoner[\"championId\"]).id\n match.win = current_summoner[\"stats\"][\"win\"]\n # Set the Match's game_id field.\n match.game_id = match_data[\"gameId\"]\n # Set the Match's ban field.\n bans = match_data[\"teams\"][0][\"bans\"] + match_data[\"teams\"][1][\"bans\"]\n if bans.empty?\n match.ban = -1\n else\n match.ban = bans.find {|ban| ban[\"pickTurn\"] == participant[\"participantId\"]}[\"championId\"]\n end\n # Save the Match to the database!\n match.save\n end\nend",
"def create #players are in an array\n @players = [\n Player.new('Contestant 1')\n Player.new('Contestant 2')\n ]\n end",
"def create_players\n\n get_players.map do|player|\n Player.create(first_name: player[\"firstName\"],last_name: player[\"lastName\"],team: player[\"teamId\"], position: player[\"pos\"])\n end\n\nend",
"def create\n #Setting up the players \n setup = SetupPlayers.run(params[:players])\n t_size = setup[:t_size]\n player_names = setup[:player_names]\n \n #Tournament creation\n if (t_size != 'too big')\n tournament = Tournament.new(tournament_params)\n tournament.size = t_size\n if (tournament.save)\n #Match setup for the tournament\n SetupMatches.run(tournament, t_size, player_names)\n redirect_to tournament_path(tournament.id)\n else\n #Tournament name was blank\n flash[:alert] = \"Tournament name must not be empty!\"\n redirect_to group_path(params[:tournament][:group_id])\n end\n else\n #error tournament size is too big\n flash[:alert] = \"You chose a size that is currently unsupported. Please choose less participants.\"\n redirect_to group_path(params[:tournament][:group_id])\n end\n\n end",
"def create\n tournament = Tournament.open.last\n\n if tournament\n @player = tournament.players.new name: params[:name],\n key: SecureRandom.uuid\n if @player.valid?\n @player.save!\n message = { :name => @player.name,\n :key => @player.key,\n :message => @player.key }\n else\n message = { :message => \"You must register with a valid and unique player name.\" }\n end\n\n respond_to do |format|\n format.json { render :json => message }\n format.xml { render :xml => message }\n format.html { redirect_to '/pages/registration', :notice => message[:message] }\n end\n else\n respond_to do |format|\n format.json { render_not_found \"The tournament is currently closed.\" }\n format.xml { render_not_found \"The tournament is currently closed.\" }\n format.html { redirect_to '/pages/registration', :alert => \"The tournament is currently closed.\" }\n end\n end\n end",
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def new_game\n params_check(params[:player_names]) {\n @game = Game.create\n params[:player_names].split(\",\").each do |player_name|\n player = Player.create(name: player_name, game: @game)\n 10.times do |i|\n i == 10 ? Frame.create!(game: @game, player: player, position: i, final_frame: true) : Frame.create!(game: @game, player: player, position: i + 1)\n end\n end\n players = @game.players.map{ |player| { \"#{player.name}\": player.id } }\n process_response(@game.present?, \"Congratulations, you started a new game. Here's your game id: #{@game.id} and player data: #{players}\", @game.id)\n }\n end",
"def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\t\t\n\t\t@team.player1 = Player.new(params[:player1]); @team.player2 = Player.new(params[:player2]); @team.player3 = Player.new(params[:player3]);\n\t\t@team.player4 = Player.new(params[:player4]); @team.player5 = Player.new(params[:player5]); @team.player6 = Player.new(params[:player6]);\n\t\t@team.player7 = Player.new(params[:player7]); @team.player8 = Player.new(params[:player8]); @team.player9 = Player.new(params[:player9]);\n\t\t@team.player10 = Player.new(params[:player10]); @team.player11 = Player.new(params[:player11]); @team.player12 = Player.new(params[:player12]);\n\t\t@team.player13 = Player.new(params[:player13]); @team.player14 = Player.new(params[:player14]); @team.player15 = Player.new(params[:player15]);\n\t\t@team.player16 = Player.new(params[:player16]); @team.player18 = Player.new(params[:player18]); @team.player19 = Player.new(params[:player19]);\n\t\t@team.player20 = Player.new(params[:player20]);\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(@team, :notice => 'Team was successfully created.') }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tournament = Tournament.new(tournament_params)\n\n @tournament.qualifier_stage = false\n @tournament.main_stage = false\n\n puts @tournament.name\n puts @tournament.event\n #below is for testing purposes, for Challonge\n #if working, remove the comment\n api = Challonge.new()\n raw_response = api.create_tournament(@tournament.name, @tournament.event)\n response = JSON.parse(raw_response)\n @tournament.challonge_tournament_id = response[\"tournament\"][\"id\"]\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render :show, status: :created, location: @tournament }\n else\n format.html { render :new }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_players\n Team.all.each do |team|\n loc = team.home_url.index('/_/')\n url = team.home_url.insert(loc, '/roster')\n doc = Nokogiri::HTML(open(url))\n players = doc.css('div.mod-content tr.oddrow, div.mod-content tr.evenrow')\n players.each do |player|\n player_url = player.css('td a').attr('href').to_s\n espn_id = player_url[player_url.index('/_/id/') + 6, 7]\n name = player.css('td')[1].text\n height = player.css('td')[3].text\n height_array = height.split('-')\n height = (height_array.first.to_i * 12 ) + height_array.last.to_i\n new_player = Player.find_or_initialize_by(espn_id: espn_id)\n new_player.team = team\n new_player.number = player.css('td')[0].text\n new_player.first_name = name.rpartition(' ').first\n new_player.last_name = name.rpartition(' ').last\n new_player.position = player.css('td')[2].text\n new_player.height = height\n new_player.weight = player.css('td')[4].text\n new_player.year = player.css('td')[5].text\n new_player.hometown = player.css('td')[6].text\n new_player.save\n end\n end\n redirect_to teams_path \n end",
"def create\n server = params[:summoner][:server].downcase\n name = params[:summoner][:name].downcase\n\n @summoner = Summoner.new(summoner_params)\n @summoner.user_id = current_user.id\n\n search_string = \"https://community-league-of-legends.p.mashape.com/api/v1.0/#{server}/summoner/getSummonerByName/#{name}\"\n response = Unirest.get(search_string)\n\n if response.code == 200 && response.body[\"summonerLevel\"] == 30\n @summoner.name = response.body[\"name\"]\n @summoner.icon_id = response.body[\"profileIconId\"]\n @summoner.riot_id = response.body[\"summonerId\"]\n @summoner.acct_id = response.body[\"acctId\"]\n \n search_string = \"https://community-league-of-legends.p.mashape.com/api/v1.0/#{server}/summoner/getLeagueForPlayer/#{@summoner.riot_id}\"\n response = Unirest.get(search_string)\n\n if response.code == 200\n response.body[\"entries\"][\"array\"].each do |entry|\n if entry[\"playerOrTeamName\"] == response.body[\"requestorsName\"]\n @summoner.league = entry\n end\n end\n end\n\n search_string = \"https://community-league-of-legends.p.mashape.com/api/v1.0/#{server}/summoner/retrieveTopPlayedChampions/#{@summoner.acct_id}\"\n response = Unirest.get(search_string)\n\n if response.code == 200\n @summoner.most_played = {}\n response.body[\"array\"].each do |value|\n value[\"stats\"][\"array\"].each do |stat|\n if stat[\"statType\"] == \"TOTAL_SESSIONS_PLAYED\"\n @summoner.most_played[\"#{stat[\"championId\"]}\"] = \"#{stat[\"value\"]}\"\n end\n end\n end\n end\n\n search_string = \"https://community-league-of-legends.p.mashape.com/api/v1.0/#{server}/summoner/getSummonerHonor/#{@summoner.acct_id}\"\n response = Unirest.get(search_string)\n\n if response.code == 200\n @summoner.honor = response.body\n end\n end\n\n respond_to do |format|\n if @summoner.save\n format.html { redirect_to @summoner, notice: 'Summoner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @summoner }\n else\n format.html { render action: 'new' }\n format.json { render json: @summoner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_matches(upcoming, num_matches, sport)\n num_matches.times do \n # create a new match\n match = Match.new\n \n if upcoming\n match.date_time = (Time.now+rand(11000000))\n match.is_completed = 0\n else\n match.date_time = (Time.now-rand(11000000))\n match.is_completed = 1\n end\n\n match.date_time = match.format_date_time.to_datetime\n \n # create two match_teams\n num_match_teams = 2\n\n create_match_teams(num_match_teams, match, sport)\n \n match.name = \"#{match.teams[0].name} vs #{match.teams[1].name}\"\n \n if !match.save\n puts \"failed to save match in db\"\n end\n end\nend",
"def create_team_poolplay\n pool = self.poolplay_teams # Team objects\n save_team_play_to_database(tournament_id, pool, \"poolplay\")\n end",
"def create\n @game = Game.new(game_params)\n scores = params[:score].split(\"-\")\n params[:player].each do |team_number, players|\n players.each do |player_name|\n player = Player.find_by(name: player_name)\n participation = Participation.create(player: player, team_number: team_number.to_i, score: scores[team_number.to_i]) \n if participation.valid?\n @game.participations << participation \n end\n end\n end\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to games_url, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @player = Player.new(player_params)\n\n respond_to do |format|\n if @player.save\n @players = Player.all\n @players.each do |p|\n if p.id != @player.id\n @team = Team.create(name: p.name[0, 3] + @player.name[0, 3] + (p.id + @player.id).to_s, player_ids: [p.id, @player.id])\n else\n end\n end\n format.html { redirect_to @player, notice: 'Player was successfully created.' }\n format.json { render :show, status: :created, location: @player }\n else\n format.html { render :new }\n format.json { render json: @player.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ln = params['league']['league_name']\n admin_id = params['league']['admin_id']\n\n @leagues = League.where(:league_name => ln).first\n\n if @leagues\n redirect_to new_league_path, :notice => 'This league already exists, please choose a different league name'\n else\n @league = League.new(league_params)\n \n respond_to do |format|\n if @league.save\n @newuser = LeagueUser.create(:user_id => admin_id, :league_id => @league.id)\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\n end",
"def create_teams_for_sport(sport, num_players)\n current_year = Time.new.year\n classes = (current_year..current_year+4).to_a # for the players\n\n College.all.each do |c|\n team = Team.new\n team.college = c # for now\n team.name = c.name\n team.description = sport.description\n team.sport = sport\n\n # players\n create_players(team, classes, num_players)\n team.save \n end \nend",
"def create\n starts_at = Time.parse(params[:starts_at])\n finishes_at = Time.parse(params[:finishes_at])\n @league = League.new(params[:league].merge(:rounds_played => 0, :starts_at => starts_at, :finishes_at => finishes_at))\n\n respond_to do |format|\n if @league.save\n flash[:notice] = 'Liga bola úspešne vytvorená.'\n format.html { redirect_to(@league) }\n format.xml { render :xml => @league, :status => :created, :location => @league }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @game = current_user.games_as_player1.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n populate_players\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @league = League.new(league_params)\n if @league.save\n render json: @league\n else\n render error: { error: \"Unable to create league.\"}, status: 400\n end\n end",
"def create_players\n players = []\n players << create_player('player_1')\n players << create_player('player_2')\n players\n end",
"def create\n p = game_params\n\n home_team_name = p.delete(:home_team_name)\n away_team_name = p.delete(:away_team_name)\n p[:home_team_id] = find_or_create_team(home_team_name).try(:id)\n p[:away_team_id] = find_or_create_team(away_team_name).try(:id)\n\n @game = Game.new(p)\n @game.user = current_user\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, notice: 'Game was successfully created.' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @league = League.new(league_params)\n @league.owner = current_user.id\n @league.state = 'created'\n\n if @league.save\n render json: @league, status: :created\n else\n render json: @league.errors, status: :unprocessable_entity\n end\n end",
"def create_team(db, name, wins, losses, count)\n stars = set_stars(count) # Set num of stars each team receives\n quality = set_quality(stars) # Set quality of team, based on stars \n\n team_creation = <<-SQL\n INSERT INTO teams (name, stars, quality, wins, losses)\n VALUES (?, ?, ?, ?, ?)\n SQL\n\n db.execute(team_creation, [name, stars, quality, wins, losses])\nend",
"def create\n @game_set = GameSet.find(params[:game_set_id])\n @game = @game_set.games.build(params[:game])\n @match = @game_set.match\n @hangout = @match.hangout\n @league = @hangout.league\n\n\n if !@league.structured && !@match.in_progress\n @game.plays_ins.each do |pi|\n team_name = pi.player_names.reject(&:blank?).sort.join(\" & \")\n\n if Team.find_by_name(team_name).present?\n t = Team.find_by_name(team_name)\n pi.team_id = t.id\n t.registrations.create(:league_id => @league.id) if t.registration(@league).nil?\n @hangout.teams << t\n else\n t = Team.create(:name => team_name)\n pi.player_names.reject(&:blank?).sort.each do |p|\n t.players << Player.find_by_username(p.scan(/\\((.*?)\\)/))\n end\n pi.team_id = t.id\n t.registrations.create(:league_id => @league.id)\n @hangout.teams << t\n end\n end\n end\n\n respond_to do |format|\n if @game.save\n if @game_set.set_winner\n if @match.set_winner\n if @league.structured\n format.html { redirect_to @league, :notice => \"#{@game.winner.name} beat #{@game.loser.name}!\"}\n else\n format.html { redirect_to edit_league_hangout_path(:league_id => @league.id, :id => @hangout), :notice => \"#{@game.winner.name} beat #{@game.loser.name}!\"}\n end\n else\n format.html { redirect_to edit_match_path(@match), :notice => \"#{@game.winner.name} won the set!\"}\n end\n else\n format.html { redirect_to edit_game_set_path(@game_set), :notice => \"#{@game.winner.name} won the game!\"}\n end\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n\n calculategeneraltable(@game.tournament_id, @game.home_team)\n calculategeneraltable(@game.tournament_id, @game.visit_team)\n\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_list_of_players\nend",
"def create\n @counter = 0\n @teamstat = Teamstat.new(teamstat_params)\n\n @teamstat.toon_db = @teamstat.input.strip.split(/[\\r\\n ,]+/)\n @teamstat.toon_db.pop if @teamstat.toon_db[-1]==\"\\r\\n\"\n \n @teamstat.toon_db.each { |toonrealm| add_toon(toonrealm)}\n\n respond_to do |format|\n if @teamstat.save\n format.html { redirect_to @teamstat, notice: 'Teamstat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teamstat }\n else\n format.html { render action: 'new' }\n format.json { render json: @teamstat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n sport_id = user_session.get(:filter_sport_id) # okay that's how mistakes happen.... TODO!!!\n sport = Sport.find(sport_id)\n team_points = Hash.new(0)\n team_games = Hash.new(0)\n team_goals_for = Hash.new(0)\n team_goals_against = Hash.new(0)\n\n sport.leagues.each do |league|\n league.games.each do |game| #iterate through EVERY game in EVERY league, calculate points, set it in team table\n if game.tie == false and not game.winner_id.nil? # no tie and winner exists\n team_points[game.winner_id] += 2\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n elsif game.tie == true\n team_points[game.team_1_id] += 1\n team_points[game.team_2_id] += 1\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n end # else, game has not been played yet\n\n # go through all the sets and calculate goal difference\n game.gamesets.each do |set|\n team_goals_for[game.team_1_id] += set.points_team_1.to_i\n team_goals_for[game.team_2_id] += set.points_team_2.to_i\n team_goals_against[game.team_1_id] += set.points_team_2.to_i\n team_goals_against[game.team_2_id] += set.points_team_1.to_i\n end\n\n end\n\n league.teams.each do |team|\n team.points = team_points[team.id] #|| 0 should work without this\n team.game_count = team_games[team.id]\n team.goals_for = team_goals_for[team.id]\n team.goals_against = team_goals_against[team.id]\n team.goals_difference = team_goals_for[team.id] - team_goals_against[team.id]\n team.save\n end\n end\n redirect_to rankings_path, success: t(:object_created)\n end",
"def new\n\t\t@tournaments = Tournament.where('clientkey=?', current_user.id).collect {|t| [ t.name,t.id]}\n\t\t@tournaments << ['', -2]\n\t\t@tournaments = @tournaments.sort_by{|k| k[0]}\n\t\t\n\t\t@venues = Venue.where('clientkey=?', current_user.id).collect {|t| [ t.venuename,t.id]}\n\t\t@venues << ['', -2]\n\t\t@venues = @venues.sort_by{|k| k[0]}\n\t\t\n\t\t@matches = Match.find_by_sql(\"select distinct m.id, to_char(matchdate, 'YYYY-MM-DD')||' '||t.teamname||' - '||t1.teamname as match from matches m inner join (select distinct teamid, clientkey, teamname from teams) t on m.teamidone=t.teamid and m.clientkey = t.clientkey inner join (select distinct teamid, clientkey, teamname from teams) t1 on m.teamidtwo=t1.teamid and m.clientkey = t1.clientkey where m.clientkey = \"+current_user.id.to_s+ \" order by m.id desc\").collect {|m| [ m.match,m.id]}\n\t\t@matches << ['', -2]\n\t\t@matches = @matches.sort_by{|k| k[0]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @external }\n end\n end",
"def create\n puts(params);\n @player = Player.new(player_params)\n \n respond_to do |format|\n if @player.save\n # Tell the playerMailer to send a welcome email after save\n # @user_player = Userplayer.new(user_id: @user.id, player_id: @player_id)\n # if @user_player.save\n @tournament.players << @player\n # @tournament.update_attribute(num_players: @tournament.num_players + 1)\n format.html { redirect_to(root_path, notice: 'player was successfully added.') }\n format.json { render json: @player, status: :created, location: @player }\n # end\n else\n format.html { render action: 'new' }\n format.json { render json: @player.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"def new\n @game = Game.new\n @home_team = Team.new\n @away_team = Team.new\n @players = Player.order :firstname, :lastname\n \n names = [\"Predators\", \"Lions\", \"Railers\", \n \"Tornadoes\", \"Steamrollers\", \"Beachcombers\",\n \"Gladiators\", \"Gorillas\", \"Jugernauts\"].sort_by { rand }\n @home_team.name = names.pop\n @away_team.name = names.pop\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def create_game(user1, game_id, players, type)\n game_factory = ConnectGameFactory.new(players.to_i, type.to_sym)\n @game_list[game_id] = GameInfo.new(game_factory.connect_game, game_factory.game_state, nil, user1, nil)\n ''\n end",
"def create\n puts params\n game = CreateGame.new(\n max_rounds: params[:max_rounds],\n draw_time: params[:draw_time],\n ).perform\n player = CreatePlayer.new(\n username: params[:username],\n game: game,\n creator: true\n ).perform\n\n if game.persisted? && player.persisted?\n session[:uuid] = player.uuid\n redirect_to player_path\n else\n render json: { ok: 'gra nie zapisana :(' }\n end\n end",
"def create\n @team = current_user.teams.new(team_params)\n @league = League.find_by(id: params[:league_id])\n @team.league = @league\n if @team.save\n LeagueInvite.where(email: current_user.email, league: @league).destroy_all\n flash[:success] = \"Added team to league\"\n if @league.teams.count == 10 && current_season = Season.current.first\n if LeagueSeason.where(league: @league, season: current_season).count == 0\n LeagueSeason.create(league: @league, season: current_season)\n end\n end\n redirect_to league_players_path(@league)\n else\n render action: :new\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",
"def generate_teams(teams_by_division, division, divisionObj)\n puts division\n teams_by_division[division].each do |team|\n teamObj = Team.create!(name: team)\n # make a different manager for each team\n managerObj = User.create!(first_name: team, \n last_name: \"Manager\", \n email: \"manager+#{team}@gmail.com\", \n password: \"123456\", \n password_confirmation: \"123456\")\n TeamManager.create!(user_id: managerObj.id, team_id: teamObj.id)\n # Add Team to Division\n TeamDivision.create!(team_id: teamObj.id, division_id: divisionObj.id)\n #populate the team roster\n 10.times do |r|\n userObj = User.create!(first_name: Faker::Name.first_name, \n last_name: Faker::Name.last_name, \n email: \"testEmail-#{team}#{r}@test.com\", \n password: \"123456\", \n password_confirmation: \"123456\")\n\n TeamPlayer.create!(user_id: userObj.id, team_id: teamObj.id)\n end\n end\n end",
"def create\n @stat_of_player_of_team_of_match = StatOfPlayerOfTeamOfMatch.new(stat_of_player_of_team_of_match_params)\n\n respond_to do |format|\n if @stat_of_player_of_team_of_match.save\n format.html { redirect_to @stat_of_player_of_team_of_match, notice: 'Stat of player of team of match was successfully created.' }\n format.json { render :show, status: :created, location: @stat_of_player_of_team_of_match }\n else\n format.html { render :new }\n format.json { render json: @stat_of_player_of_team_of_match.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_champions(champion_data)\n champions = champion_data.keys\n champions.each do |champion|\n key = champion_data[champion][\"key\"]\n champion_name = champion_data[champion][\"name\"]\n Champion.create(champ_id: key, name: champion_name)\n end\nend",
"def create\n # @tournament = Tournament.new(tournament_params)\n #\n # if @tournament.save\n # render :show, status: :created, location: @tournament\n # else\n # render json: @tournament.errors, status: :unprocessable_entity\n # end\n end",
"def create\n @fantasy_team_player = FantasyTeamPlayer.create(team_id: @team.id, player_id: params[:player_id])\n unless @fantasy_team_player.new_record?\n render json: @fantasy_team_player, status: :ok, include: [:player]\n else\n render json: error_messages_on_create, status: :unprocessable_entity\n end\n end",
"def create\n @local_league = LocalLeague.new(params[:local_league])\n\n respond_to do |format|\n if @local_league.save\n format.html { redirect_to @local_league, notice: 'Local league was successfully created.' }\n format.json { render json: @local_league, status: :created, location: @local_league }\n else\n format.html { render action: \"new\" }\n format.json { render json: @local_league.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end",
"def create_table(name, min_players = 2, blinds = 1)\n\t\traise \"No player yet!\" unless @player_id\n\t\t@table_response = new_sub(@discovery['tables']['url'],\n\t\t\t\t@discovery['tables']['capability'])\n\t\t@create_table_channel = new_channel(@discovery['create_table']['url'],\n\t\t\t\t@discovery['create_table']['capability'])\n\t\t@table_response.last = (Time.now.to_i * 1000) - 5\n\t\t@table_response.add_listener('table_response') {|m| my_table_created(m)}\n\t\t@table_response.start_listening\n\t\t@create_table_channel.publish({'name' => name, 'id' => @player_id,\n\t\t\t'min_players' => min_players, 'blinds' => blinds}.to_json)\n\tend",
"def create_demo_tournament\n name = I18n.t(\"quick_start.tournament_name\")\n desc = I18n.t(\"quick_start.tournament_desc\")\n\n make_demo_tournament(self, name, desc)\n end",
"def create\n if get_login.nil? then\n raise 'only logged in users can create new leagues'\n end\n \n @league = League.new(params[:league])\n\n respond_to do |format|\n if @league.save\n format.html { redirect_to(@league, :notice => 'League was successfully created.') }\n format.xml { render :xml => @league, :status => :created, :location => @league }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @leagues = League.all\n @league = League.new #Create user in index\n end",
"def new\n @team = Team.new\n\n\t\t@player1 = Player.new; @player2 = Player.new; @player3 = Player.new;\n\t\t@player4 = Player.new; @player5 = Player.new; @player6 = Player.new;\n\t\t@player7 = Player.new; @player8 = Player.new; @player9 = Player.new;\n\t\t@player10 = Player.new; @player11 = Player.new; @player12 = Player.new\n\t\t@player13 = Player.new; @player14 = Player.new; @player15 = Player.new;\n\t\t@player16 = Player.new; @player18 = Player.new; @player19 = Player.new;\n\t\t@player20 = Player.new;\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def create\n @team = Team.find_by_name(params[:team][:team_name])\n if @team.nil?\n @team = Team.new(captain_id: params[:team][:captain_id],\n\t\t team_name: params[:team][:team_name])\n\n respond_to do |format|\n if @team.save\n format.json { render json: @team, status: :created, location: @team }\n if params[:players]\n \tTeamPlayers.create(params[:players], team_name: @team.name)\n end\n else\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n else \n Team.update(params[:team])\n end\n end",
"def fill_team_with_players (team, player, shirt_number)\n\t@db.execute(\"INSERT INTO #{team} (player_name, player_number) VALUES (?,?)\",[player, shirt_number])\nend",
"def create\n unless current_user.admin?\n redirect_to :tournaments, flash: {error: 'Only administrators can create new tournaments.'}\n return\n end\n\n @tournament = Tournament.new(tournament_params)\n\n if @tournament.save\n # now create the TournamentLanguages\n TournamentLanguage::LanguageOptions.each do |(name, key)|\n if params['languages'][key] == \"1\"\n TournamentLanguage.create(language: name, tournament_id: @tournament.tournament_id)\n end\n end\n redirect_to @tournament, flash: {success: 'Tournament was created!'}\n else\n redirect_to @tournament, flash: {error: \"Failed to create tournament: #{@tournament.errors.full_messages}\"}\n end\n end",
"def create\n @game = Game.new\n #create the first player\n first_player = Player.new\n first_player.name = params[:first_player_name]\n first_player.game = @game\n\n #create the second player\n second_player = Player.new\n second_player.name = params[:second_player_name]\n second_player.game = @game\n\n # add first and second players to the game object\n @game.first_player = first_player\n @game.second_player = second_player\n\n respond_to do |format|\n if @game.save\n #create a new game round using a redirect to new_game_round_path\n format.html { redirect_to new_game_round_path(@game), notice: t(\"games.successfully_created\") }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_game(outcome, league_id, timestamp)\n database do |db|\n # get unix time\n timestamp ||= Time.now.to_i\n\n # get next game id\n game_id = 1 + db.get_first_value('SELECT GameID FROM Game\n ORDER BY GameID DESC LIMIT 1')\n\n # insert new game into Game table\n outcome.each do |player_id, score|\n db.execute 'INSERT INTO Game\n VALUES\n (:game_id, :player_id, :league_id, :score, :timestamp)',\n game_id, player_id, league_id, score, timestamp\n end\n\n # calling recalc with timestamp means we update elo properly for the\n # new game, regardless of the time it was played\n recalc(league_id, timestamp)\n\n players = outcome.keys.collect do |player_id|\n {\n name: name(player_id, league_id),\n elo: elo(player_id, game_id, league_id),\n delta: elo_change(player_id, game_id, league_id)\n }\n end\n\n slack_url = db.get_first_value 'SELECT Value FROM Config\n WHERE Setting = \"SlackUrl\"'\n\n unless (league_id != 1 && league_id != 41) || slack_url.empty?\n text = \"Game added: #{game_to_s(game_id, false, league_id)}\"\n attachments = [{\n author_name: \"See the leaderboard\",\n author_link: \"http://foosey.futbol/#/redirect/\" + (league_id == 1 ? \"wca-dev\" : \"wca-cornhole\"),\n fields: players.collect do |p|\n delta = p[:delta] >= 0 ? \"+#{p[:delta]}\" : p[:delta]\n {\n title: p[:name],\n value: \"#{p[:elo]} (#{delta})\",\n short: true\n }\n end\n }]\n message_slack(text, attachments, slack_url, league_id)\n end\n\n return {\n gameID: game_id,\n players: players\n }\n end\nend",
"def create\n @game_tournament = GameTournament.new(params[:game_tournament])\n\n respond_to do |format|\n if @game_tournament.save\n format.html { redirect_to @game_tournament, notice: 'Game tournament was successfully created.' }\n format.json { render json: @game_tournament, status: :created, location: @game_tournament }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_game = helpers.generate_game(params[\"game_name\"])\n\n slack_id = params[\"slack_id\"]\n\n response_url = params[\"response_url\"]\n\n @game = Game.new(new_game.new_game_data)\n\n if @game.save\n player = Player.exists?(slack_id: \"#{slack_id}\")\n if player\n player_records = Player.find_by(slack_id: \"#{slack_id}\")\n Rails.logger.info player_records[\"id\"].inspect\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\", player_id: \"#{player_records[\"id\"]}\"}\n else\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\"}\n end\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n\n word_blanks = new_game.display_word_state\n\n HTTParty.post(response_url, \n {\n body: {\"text\" => \"#{word_blanks}\",\"response_type\" => \"in_channel\"}.to_json,\n headers: {\n \"Content-Type\" => \"application/json\"\n }\n }\n )\n \n end",
"def initialize_roster \n Nokogiri::HTML(open(@url)).css(\"tbody tr\").each do |tr|\n hash = {name: \"\", number: \"\", unit: \"\", position: \"\", height: \"\", weight: \"\", age: \"\", team: self, url: \"\"}\n array = tr.css(\"td\")[0..5]\n hash[:name] = array[0].css('a').attribute('title').value\n hash[:number] = array[1].text.strip.to_i\n hash[:position] = array[2].text.strip\n hash[:height] = array[3].text.strip\n hash[:weight] = array[4].text.strip.to_i\n hash[:age] = array[5].text.strip.to_i\n hash[:url] = @url + tr.css(\"a\").attribute(\"href\").value.split(\"/\")[-1] + \"/\"\n new_player = Player.new(hash)\n @roster << new_player\n end\n @roster\n end",
"def create\n @player_statistic = PlayerStatistic.new(params[:player_statistic])\n\n respond_to do |format|\n if @player_statistic.save\n format.html { redirect_to @player_statistic, notice: 'Player statistic was successfully created.' }\n format.json { render json: @player_statistic, status: :created, location: @player_statistic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_statistic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_by_tabbie_or_user\n #we may call this from /control/teams or /registration/individual\n \n @tournament = Tournament.find(safe_params[:id]);\n @emails = safe_params[:emails]; #need this incase we render\n @name = safe_params[:name];\n @list = @tournament.get_sorted_teams;\n @msg = SmallNotice.new;\n @user = current_user;\n\n #n will determine how many speakers we are building the team out of\n @n = GlobalConstants::FORMAT[:bp][:num_speakers_per_team];\n \n #check to see if the players existed\n #we have also generalized this accross debating formats\n users = [];\n (1..@n).each { |i|\n users.push(User.where(email: @emails[i-1]).first);\n #u[i] will be nil or a user object\n\n #might as well do error checking immediatley\n if users[i-1].nil?\n @msg.add(:error, \"Could not find member #{i}.\");\n render(render_place());\n return;\n end\n }\n\n #check memebrs are from same institution (in IF one day)\n #first get institution ids\n institution_ids = []\n users.each { |u|\n institution_ids.push(u.institution.id);\n }\n\n #### FOR HYBRID ###\n #@institution_id = GlobalConstants::HYBRID_INSTITUTION;\n #else\n @institution_id = users[0][:institution_id]; #just take it from one of the them\n\n #if this is not from tabbie, \n #if this is a capped/restricted tournament, the members have to be from the user's institution\n #if this is an open tournament, the current user needs to be the president of the team being made\n #if completely open, at least one member needs to be the current_user\n if render_place().split('/').last == \"individual\"\n if @tournament.tournament_setting[:registration] != \n GlobalConstants::SETTINGS_VALUES[:registration][\"Completely open\"]\n institution_ids.each { |i|\n if i != @user.institution_id\n @msg.add(:error, \"You can only make teams for people in your institution.\")\n render(render_place());\n return;\n end\n }\n else #completely open\n foundSelf = false; #assume self not in the list\n users.each { |u|\n if u == current_user\n foundSelf = true;\n end\n }\n if !foundSelf\n @msg.add(:error, \"You must be in the team you register\")\n render(render_place());\n return;\n end\n end\n end\n\n #should only be one unique id if not an open tournament...\n #NEED TO INCORPORATE THE ABILITY TO HAVE PEOPLE FROM DIFF INST IF MANUAL REGO BUT STILL AND OPEN\n if institution_ids.uniq.count != 1\n @msg.add(:error, \"Teams members are not from the same institution.\");\n render(render_place());\n return;\n end\n\n #check users are in no other teams for this tournament\n #we think coming from the user side is better\n i = 1;\n users.each { |u|\n u.teams.each { |w|\n if w.tournament_id == @tournament.id\n @msg.add(:error, \"Member #{i} is already competing in another team.\");\n render(render_place());\n return;\n end\n }\n i = i + 1;\n }\n \n #check the users are not also adjs\n i = 1;\n users.each { |u|\n u.tournament_attendees.each { |w|\n if (w.tournament_id == @tournament.id) && \n (w.role == GlobalConstants::TOURNAMENT_ROLES[:adjudicator])\n \n @msg.add(:error, \"Member #{i} is already an adjudicator.\");\n render(render_place());\n return;\n end\n }\n i = i + 1;\n }\n \n #at this point we will go a head and set up for saving\n @team = Team.new(name: safe_params[:name], institution_id: institution_ids[0],\n tournament_id: @tournament.id, points: 0, total_speaks: 0);\n \n #generalized way to add in users, good for varribale number (2-3) speakers per team\n #which is needed for different formats of debating\n i = 1;\n users.each { |u|\n @team[(\"member_#{i}_id\").to_sym] = u.id;\n i = i + 1;\n }\n\n if @team.save()\n #in this case, we must update the attendees table\n \n #gerenalized adding to tournament attendee\n users.each { |u|\n \tTournamentAttendee.new(user_id: u[:id], tournament_id: @tournament[:id],\n \t\t\t\t\t\t\t\t role: GlobalConstants::TOURNAMENT_ROLES[:debater],\n \t\t\t\t\t\t\t\t institution_id: @institution_id).save();\n }\n \n #@msg.add(:success, \"Team Created!\"); #make sure the flash is below the form\n #redirect needs to use flash\n flash[:success] = \"Team Created.\"\n redirect_to(redirect_place());\n else\n #so we need both flash and normal error rendering thing\n #lets fluralize the flash and then port over the error messages\n #while keeping an eye on what the 'shared/_error_messages' does\n \n load_errors(@team);\n render render_place();\n return;\n end\n end",
"def create\n @tournament = Tournament.new(tournament_params)\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render :show, status: :created, location: @tournament }\n else\n format.html { render :new }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_player_team\n\t# User inputs team name\n\tp \"Enter team name\"\n\t@team_name = gets.chomp!\n\t# Table creation SQL command\n\tcreate_table_cmd = %(\n\tCREATE TABLE IF NOT EXISTS #{@team_name}(\n\t\tid INTEGER PRIMARY KEY,\n\t\tplayer_name VARCHAR(255),\n\t\tplayer_number INT,\n\t\tFOREIGN KEY (player_number) REFERENCES player_position(id)\n\t);\n\t)\n\n\t# Execute create table command\n\t@db.execute(create_table_cmd)\nend",
"def create\n #directions = Score::DIRECTIONS.map{|k,v| k}\n #directions.shuffle!\n params[:game].merge!({:meeting_id => @meeting.id})\n @game = Game.create!(params[:game])\n participant_ids = params[:participants].collect{|id| id.to_i} if params[:participants]\n participant_ids.each do |id|\n score = Score.new\n score.game_id = @game.id\n score.participant_id = id.to_i\n #score.direction = directions.shift\n score.save!\n end\n\n respond_to do |format|\n if @game\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_table(name, min_players = 2, blinds = 1)\n\t\traise \"No player yet!\" unless @player_id\n\t\t@table_response = new_sub(@discovery['tables'])\n\t\t@create_table_channel = new_channel(@discovery['create_table'])\n\t\t@table_response.last = ((Time.now.to_i - 5) * 1000 * 1000)\n\t\t@table_response.add_listener('message', 'table_response') {|m|\n begin\n my_table_created(m.content)\n rescue\n puts \"Error with my table created: #{$!.inspect}\"\n end\n }\n\t\t@table_response.start_listening\n\t\t@create_table_channel.publish({'name' => name, 'id' => @player_id,\n\t\t\t'min_players' => min_players, 'blinds' => blinds}.to_json)\n\tend",
"def create\n json = ActiveSupport::JSON.decode(params[:player])\n @player = Player.new\n @player.gender = json[\"gender\"]\n @player.username = json[\"username\"]\n @player.uuid = json[\"uuid\"]\n @player.last_location = json[\"location\"]\n @player.player_monsters = [ PlayerMonster.new({ :nickname => json[\"starting_monster\"][\"nickname\"],\n :monster_id => json[\"starting_monster\"][\"id\"],\n :caught_location => json[\"location\"]\n }) ]\n if @player.save\n render :json => { :success => true, :player => @player } , :status => 200\n else\n render :json => { :success => false, :message => @player.errors } , :status => 400\n end\n end",
"def create\n @tournament = Tournament.new(params[:tournament])\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render json: @tournament, status: :created, location: @tournament }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @compare_columns = Game.column_names\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_players\n\t\t\t\tnum_players.times do |i|\n\t\t\t\t\tplayer_class = Merlion::Player\n\t\t\t\t\tself.players[i] = create_player({ seat: i, class: player_class })\n\t\t\t\tend\n\t\t\tend",
"def create\n @game = Game.new(params[:game])\n @corporations = Corporation.order(:faction, :slogan)\n @runners = Runner.order(:faction, :name)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teams\n number_of_teams.to_i.times do |i|\n self.teams << Team.create!(:name => TEAM_NAMES[i])\n end\n end",
"def create\n party = []\n (1..6).each do |p_number|\n level = params[:dungeon_instance][\"hero#{p_number}_level\"].to_i\n party << level if level > 0\n end\n\n dungeon = Dungeon.new\n dungeon.generate( params[:dungeon_instance][:size].to_i, party,\n encounters_difficulty: params[:dungeon_instance][:difficulty].to_sym )\n # p dungeon.to_json\n\n @dungeon_instance = DungeonInstance.new( dungeon_instance_params.merge( dungeon_data: dungeon.to_json ) )\n\n respond_to do |format|\n if current_user.dungeon_instances << @dungeon_instance\n format.html { redirect_to dungeon_instance_play_path( @dungeon_instance ), notice: 'Dungeon instance was successfully created.' }\n else\n format.html { redirect_to dungeon_instances_path, error: 'Dungeon instance was successfully created.' }\n end\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 new\n @game_set = GameSet.find(params[:game_set_id])\n @match = @game_set.match\n @game = @game_set.games.build\n @hangout = @match.hangout\n @league = @match.league\n @teams = @league.structured ? @league.teams : @hangout.teams\n @game.team_one_winner ||= true\n \n @p1 = @game.plays_ins.build\n @p2 = @game.plays_ins.build\n\n if @match.in_progress\n @team1 = @match.games.first.plays_ins.last.team\n @team2 = @match.games.first.plays_ins.first.team\n\n @p1.team_id = @team1.id\n @p2.team_id = @team2.id\n else\n @team1 = @team2 = @teams\n end\n\n\n @p1.build_scores(@league)\n @p2.build_scores(@league)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end",
"def create_line_game\n project = Project.where(name: 'DozoR').first || Project.create(name: 'DozoR', owner: 'Алесь Жук', css_class: 'dozor')\n format = Format.where(name: 'Klad').first || Format.create(name: \"Klad\", organizer: \"Lightpower\", show_in_archives: true, project: project, css_class: nil)\n game = Game.where(game_type: 'line').last || Game.create(number: \"1\", name: \"Тестовая игра\", game_type: \"line\", start_date: \"2013-07-28 15:00:00\", finish_date: \"2013-07-31 15:00:00\", price: 0, area: nil, image_html: \"<img src=\\\"http://neobychnye-zaprosy.ru/pict/box.png\\\">\", preview: nil, legend: 'Тестовая игра и, соответственно, тестовая игра.', brief_place: 'Дома', dopy_list: '- Хорошее настроение', is_active: true, is_archived: false, prepare_url: nil, discuss_url: nil, format: format)\n GameConfig.create(time: 0, bonus: 0, total_bonus: 0, game: game) if game.config.blank?\n game.reload\n\n @users = User.where('email ILIKE ?', 'u_@ex.ua')\n @users = [User.create(email: 'u1@ex.ua', password: '123456', password_confirmation: '123456'),\n User.create(email: 'u2@ex.ua', password: '123456', password_confirmation: '123456') ] if @users.blank?\n @teams = Team.where('name LIKE ?', 'Team_')\n @teams = [Team.create(name: 'Team1', alternative_name: 'Team 1', image_url: '/images/test.png', user_id: @users.first.id),\n Team.create(name: 'Team2', alternative_name: 'Team 2', image_url: '/images/test2.png', user_id: @users.last.id) ] if @teams.blank?\n @users.first.team = @teams.first\n @users.first.save\n @users.last.team = @teams.last\n @users.last.save\n\n debugger\n # Requests to game\n GameRequest.where(game_id: game.id, team_id: @teams.map(&:id)).map(&:delete) # delete just in case\n @teams.each { |team| GameRequest.create(game: game, team: team, is_accepted: true) }\n\n if game.zones.blank?\n Zone.create(game: game, number: 1, name: 'Зона 1', image_url: '/image/test1.png')\n Zone.create(game: game, number: 2, name: 'Зона 2', image_url: '/image/test2.png')\n game.reload\n end\n\n # Tasks with codes and included tasks\n\n game.zones.all.each do |zone|\n\n # task 1 - 1 code\n task_number = zone.new_task_number\n task = Task.create(game: game, number: task_number, name: \"Задание №#{task_number}\", code_quota: 0, # all codes\n data: '<b>Четыре колобка свалились под мост.</b> Коды задания: <font color=\\'orange\\'>D номер зоны R + (номер задания*10 + номер кода)</font>',\n duration: 60, zone: zone)\n # Code\n code_number = task.new_code_number\n code = Code.create(game: game, task: task, number: code_number,\n name: '',\n bonus: 0,\n ko: '1+',\n info: 'Под лавочкой',\n color: 'red')\n CodeString.create(game: game, data: \"D#{zone.number}R#{ + task_number*10 + code_number}\", code: code)\n task.codes << code\n task.reload\n zone.reload\n\n # 2 hints for each task\n Hint.create(game: game, task: task, number: 1, delay: 20, cost: -1, data: '<i>Читайте задание внимательнее!</i>')\n Hint.create(game: game, task: task, number: 2, delay: 40, cost: -1, data: '<i>Как найти коды, выделено оранжевым.</i>')\n\n\n # Task 2 - 10 codes\n task_number = zone.new_task_number\n task = Task.create(game: game, number: task_number, name: \"Задание №#{task_number}\", code_quota: -1, # all minus one\n data: '<b>Большой поиск.</b> Коды задания: <font color=\\'orange\\'>D номер зоны R + (номер задания*10 + номер кода)</font>',\n duration: 50, zone: zone)\n # Codes\n infos = %w(Первый Второй Третий Четвёртый Пятый Шестой Седьмой Восьмой Девятый Десятый)\n 10.times do\n code_number = task.new_code_number\n code = Code.create(game: game, task: task, number: code_number,\n name: '',\n bonus: 0,\n ko: '1+',\n info: infos[code_number - 1],\n color: 'blue')\n CodeString.create(game: game, data: \"D#{zone.number}R#{ + task_number*10 + code_number}\", code: code)\n task.codes << code\n task.reload\n end\n zone.reload\n\n # 2 hints for each task\n Hint.create(game: game, task: task, number: 1, delay: 15, cost: -1, data: '<i>Коды можно подобрать.</i>')\n Hint.create(game: game, task: task, number: 2, delay: 30, cost: -1, data: '<i>Как вычислить коды, выделено оранжевым.</i>')\n\n end\n\n game\nend",
"def create\n @player_game_stat = PlayerGameStat.new(params[:player_game_stat])\n\n respond_to do |format|\n if @player_game_stat.save\n format.html { redirect_to @player_game_stat, notice: 'Player game stat was successfully created.' }\n format.json { render json: @player_game_stat, status: :created, location: @player_game_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_game_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_tournament(file, user_id, arg={})\n opt = Hash.new\n case file\n when \"bunratty_masters_2011.tab\", \"kilkenny_masters_2011.tab\"\n opt[:fide] = arg.has_key?(:fide) ? arg[:fide] : true\n when \"junior_championships_u19_2010.txt\"\n opt[:start] = arg[:start].presence || \"2010-04-11\"\n opt[:name] = arg[:name].presence || \"U-19 All Ireland\"\n when \"junior_championships_u19_2010.zip\"\n opt[:start] = arg[:start].presence || \"2010-04-11\"\n end\n parser = get_parser(file)\n begin\n icut = parser.parse_file!(test_file_path(file), opt)\n rescue ArgumentError\n icut = parser.parse_file!(test_file_path(file))\n end\n tournament = Tournament.build_from_icut(icut)\n tournament.user_id = user_id\n tournament.save!\n tournament.upload = FactoryGirl.create(:upload, name: file, user_id: user_id, tournament_id: tournament.id)\n tournament.save!\n tournament.renumber_opponents\n tournament\nend",
"def create\n @nhl_team = @pool.nhl_teams.new(nhl_team_params)\n\n respond_to do |format|\n if @nhl_team.save\n format.html { redirect_to pool_nhl_teams_path, notice: 'Nhl team was successfully created.' }\n format.json { render :show, status: :created, location: @nhl_team }\n else\n format.html { render :new }\n format.json { render json: @nhl_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @player = Player.new(player_params)\n @player.user = current_user\n # automatically create a new team for the user if there isn't one already\n unless @player.team || @player.name.blank?\n team = Team.find_or_initialize_by(name: \"#{@player.name}'s Team\", code: @player.name.upcase)\n @player.team = team if team.save\n end\n respond_to do |format|\n if @player.save\n format.html { redirect_to(@player, :notice => 'Player was successfully created.') }\n format.xml { render :xml => @player, :status => :created, :location => @player }\n else\n team.destroy if team\n format.html { render :action => \"new\" }\n format.xml { render :xml => @player.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n params[:players].each do |player_name|\n p = Player.new\n p.name = player_name\n p.game = @game\n p.save!\n end\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n #@unplayed = other_playerdiv_players_array(get_playerdiv().division_id,current_player.id)\n @unplayed = unplayed_playerdiv_players(get_playerdiv().division_id,current_player.id)\n #We need to edit the params here a bit!\n #Fix players 2s elo player_id, easypeasy.\n params['match']['rankings_attributes']['1']['player_id'] = params['match']['results_attributes']['1']['player_id']\n player1 = params['match']['results_attributes']['0']['player_id']\n player2 = params['match']['results_attributes']['1']['player_id']\n player1_score = params['match']['results_attributes']['0']['score']\n player2_score = params['match']['results_attributes']['1']['score']\n\n #Add new elo scores \n if params['match']['results_attributes']['0']['score'] > params['match']['results_attributes']['1']['score']\n elo_scores = update_elo_score(params['match']['results_attributes']['0']['player_id'],params['match']['results_attributes']['1']['player_id']) \n params['match']['rankings_attributes']['0']['score'] = elo_scores.first \n params['match']['rankings_attributes']['1']['score'] = elo_scores.last\n elsif params['match']['results_attributes']['0']['score'] < params['match']['results_attributes']['1']['score']\n elo_scores = update_elo_score(params['match']['results_attributes']['1']['player_id'],params['match']['results_attributes']['0']['player_id']) \n params['match']['rankings_attributes']['1']['score'] = elo_scores.first \n params['match']['rankings_attributes']['0']['score'] = elo_scores.last\n elsif\n elo_scores = dont_update_elo_score(params['match']['results_attributes']['0']['player_id'],params['match']['results_attributes']['1']['player_id']) \n params['match']['rankings_attributes']['0']['score'] = elo_scores.first \n params['match']['rankings_attributes']['1']['score'] = elo_scores.last \n end\n\n ## We want to break out and return to the new match page with a warning if the score is 3-3.\n if player1_score == \"3\" && player2_score == \"3\"\n respond_to do |format|\n format.html { redirect_to new_match_path, :alert => '3-3 is not a valid score' }\n end\n # format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n else \n @match = Match.new(params[:match])\n respond_to do |format|\n if @match.save\n if Rails.env.production?\n player1_info = Player.find(player1)\n if player1_info.twitter.blank?\n player1_name = player1_info.name\n else \n if player1_info.twitter.include? \"@\"\n player1_name = player1_info.twitter\n else \n player1_name = [\"@\",player1_info.twitter].join(\"\")\n end\n end\n\n player2_info = Player.find(player2)\n if player2_info.twitter.blank?\n player2_name = player2_info.name\n else \n if player2_info.twitter.include? \"@\"\n player2_name = player2_info.twitter\n else \n player2_name = [\"@\",player2_info.twitter].join(\"\")\n end\n end\n end\n## Messaging: sending tweets and emails. \n if Rails.env.development?\n if player1_score == \"-1\" or player2_score == \"-1\"\n\n else\n Twitter.configure do |config|\n config.consumer_key = \"1XjVDsxhid6RGC2L87iOw\"\n config.consumer_secret = \"3D9GIbIEfiKqSMDzHTunAPJ0Cb3jGMpxTGJ5SBKXcZQ\"\n config.oauth_token = \"167934744-nQHj7SI2fmR9kKgp0xPgqxKThzo3b8E5Zm57LtXh\"\n config.oauth_token_secret = \"w151Vhz4TQ5cMaCGEeJPZyeHfw13X4PgvIek4UXhzk\"\n end\n tweet = [\"Result just in: \", player1_name, \" \", player1_score, \" - \", player2_score, \" \",player2_name].join(\"\")\n @twitter = Twitter::Client.new\n @twitter.update(tweet) \n end\n elsif Rails.env.production? \n if player1_score == \"-1\" or player2_score == \"-1\"\n\n else\n Twitter.configure do |config|\n config.consumer_key = \"MmLpCfZryJpziDQrP6v2fA\"\n config.consumer_secret = \"r1JnVOv0fqpKWf85PYy7NqIeujLlso7Rz77dMBz0GJM\"\n config.oauth_token = \"304956678-t1zBhgd9WPsLt2iPziMtMJUky7N67At8sBJOLVtE\"\n config.oauth_token_secret = \"S1Y9hkH9Sx9HOvXHzFDpceX1JyNZjKveaWmUl0QaMQ\"\n end\n tweet = [\"Result just in, \", Player.find(player1).name, \" \", player1_score, \" - \", player2_score, \" \",Player.find(player2).name].join(\"\")\n @twitter = Twitter::Client.new\n @twitter.update(tweet) \n end\n ResultMailer.result_email(params['match']['rankings_attributes']['0']['player_id'],params['match']['rankings_attributes']['1']['player_id'],params['match']['results_attributes']['0']['score'],params['match']['results_attributes']['1']['score']).deliver\n end\n \n \n \n format.html { redirect_to(@match, :notice => \"Your match has been entered successfully\") }\n format.xml { render :xml => @match, :status => :created, :location => @match } \n else\n format.html { redirect_to new_match_path, :alert => 'You did not enter any scores' }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end\nend",
"def create\n @tournament = Tournament.new(tournament_params)\n\n @tournament.current_round = 0\n @tournament.state = false\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tournament }\n\n # Create all rounds when tournament is created\n @tournament.round_no.times do |x|\n @round = Round.new\n @round.round_no = x + 1\n @round.tournament_id = @tournament.id\n @round.name = @tournament.name + \" round \" + (x + 1).to_s \n @round.turn_duration = 7\n @round.save\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_data\n completes = load_save\n ACHIEVEMENTS.each do |index, content|\n title, passed, description = content\n completed = completes.include?(index)\n @data_achievements[index] = Achievement.new(title, description, completed)\n end\n end",
"def add_player(league_id, name, slack_name = '', admin = false, active = true)\n database do |db|\n db.execute 'INSERT INTO Player\n (LeagueID, DisplayName, SlackName, Admin, Active)\n VALUES\n (:league_id, :name, :slack_name, :admin, :active)',\n league_id, name, slack_name, admin ? 1 : 0, active ? 1 : 0\n recalc_elo(Time.now.to_i, league_id)\n return db.get_first_value 'SELECT PlayerID from Player\n WHERE DisplayName = :name\n AND LeagueID = :league_id\n COLLATE NOCASE',\n name, league_id\n end\nend",
"def create_players(team, classes, num_players)\n num_players.times do\n player = Player.new\n player.first_name = Faker::Name.first_name \n player.last_name = Faker::Name.last_name \n player.team = team\n player.class_of = classes.sample\n player.save\n end\nend",
"def generate_teams\n \t\t#seems redundant..just want to make sure I have actual players. Could remove this and stick with what is passed in player_id params\n \t\tselected_players = Player.find(setup_params[:player_id])\n \t\tselected_players_id = selected_players.map(&:id)\n \t\tavailable_players = Player.where.not(id: selected_players_id)\n\n \t\tgame = Game.new_game\n \t\tgame.generate_random_teams(selected_players);\n\n \t\trender partial: \"setup_game_modal\", locals: { selected_players: selected_players, available_players: available_players, game: game}\n \tend",
"def generate_player(player_id)\n generate_name.merge(\n {\n player_id: player_id,\n player_birthday: generate_birth_date,\n team_id: $teams.sample\n }\n )\nend",
"def create\n @game = Game.find(params[:game_id])\n if @game.password == params[:game_password] then\n @team = Team.new\n @team.name = params[:name]\n @team.game_id = params[:game_id]\n \n @leader = Player.find(params[:leader_id])\n @team.leader_id = @leader.id\n\n respond_to do |format|\n if @team.save\n format.xml { render :xml => @team, :status => :created, :location => @team }\n format.json { render :json => @team, :status => :created, :location => @team }\n @leader.team_id = @team.id\n @leader.save\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 new\n @bestgame = Bestgame.new\n @player_select_data = Player.all.collect{|p| [p.name, p.id]}\n @lineup_select_data = \"\"\n @non_lineup_select_data = Player.all.collect{|p| [p.name, p.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def create\n\n Campaign.transaction do\n new_players_creation_result = true\n params['players'].each do |player|\n user = User.find( player )\n new_players_creation_result &= Player.create_new_player( @campaign, user )\n\n if @campaign.players.count >= @campaign.max_players\n @campaign.players_choose_faction!\n end\n end\n\n respond_to do |format|\n if new_players_creation_result\n format.html { redirect_to campaigns_path, notice: t( '.success' ) }\n\n else\n format.html { render :new }\n\n end\n end\n end\n end",
"def create\n @player_game_statistic = PlayerGameStatistic.new(player_game_statistic_params)\n\n respond_to do |format|\n if @player_game_statistic.save\n #format.html { redirect_to @player_game_statistic, notice: 'Player game statistic was successfully created.' }\n format.json { render :show, status: :created, location: @player_game_statistic }\n else\n format.html { render :new }\n format.json { render json: @player_game_statistic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @match = Match.new(match_params)\n if @match.save\n # destroying first record in schedule for displaying current match in view\n @thisround = Round.last\n @thisround.schedule.shift\n @thisround.save\n @team_one = @match.team_ids.first\n @team_two = @match.team_ids.last\n @player_one_id = Team.find(@team_one).players.first.id\n @player_two_id = Team.find(@team_one).players.last.id\n @player_three_id = Team.find(@team_two).players.first.id\n @player_four_id = Team.find(@team_two).players.last.id\n \n @team_one_wins = 0\n @team_one_losses = 0\n @team_one_ties = 0\n @team_one_goals_for = @match.home\n @team_one_goals_against = @match.away\n \n @team_two_wins = 0\n @team_two_losses = 0\n @team_two_ties = 0\n @team_two_goals_for = @match.away\n @team_two_goals_against = @match.home\n \n @match_balance = 0\n \n \n \n if @match.home > @match.away\n @team_one_wins = 1\n @team_two_losses = 1\n @goal_difference = @match.home - @match.away\n end\n if @match.home < @match.away\n @team_one_losses = 1 \n @team_two_wins = 1\n @goal_difference = @match.away - @match.home\n\n end\n if @match.home == @match.away\n @team_one_ties = 1 \n @team_two_ties = 1\n @goal_difference = 0\n end\n if @goal_difference > 0\n @match_balance = (@goal_difference.fdiv(2).round(0) * 20)\n end\n if @match.bet == 1\n @match_balance += 20\n end\n \n \n \n @statistic_player_one_all_time = StatisticAllTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_all_time = StatisticAllTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_all_time = StatisticAllTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_all_time = StatisticAllTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_time = StatisticLastTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_time = StatisticLastTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_time = StatisticLastTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_time = StatisticLastTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_season = StatisticLastSeason.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_season = StatisticLastSeason.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_season = StatisticLastSeason.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_season = StatisticLastSeason.where(\"player_id = #{@player_four_id}\").last\n \n if @statistic_player_one_all_time == nil\n @statistic_player_one_all_time = StatisticAllTime.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_all_time == nil\n @statistic_player_two_all_time = StatisticAllTime.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_all_time == nil\n @statistic_player_three_all_time = StatisticAllTime.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_all_time == nil\n @statistic_player_four_all_time = StatisticAllTime.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n if @statistic_player_one_last_time == nil || (@statistic_player_one_last_time.created_at + 16.hours) < Time.now \n @statistic_player_one_last_time = StatisticLastTime.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_last_time == nil || (@statistic_player_two_last_time.created_at + 16.hours) < Time.now \n @statistic_player_two_last_time = StatisticLastTime.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_last_time == nil || (@statistic_player_three_last_time.created_at + 16.hours) < Time.now \n @statistic_player_three_last_time = StatisticLastTime.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_last_time == nil || (@statistic_player_four_last_time.created_at + 16.hours) < Time.now \n @statistic_player_four_last_time = StatisticLastTime.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n if @statistic_player_one_last_season == nil || (@statistic_player_one_last_season.created_at + 365.days) < Time.now \n @statistic_player_one_last_season = StatisticLastSeason.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_last_season == nil || (@statistic_player_two_last_season.created_at + 365.days) < Time.now \n @statistic_player_two_last_season = StatisticLastSeason.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_last_season == nil || (@statistic_player_three_last_season.created_at + 365.days) < Time.now \n @statistic_player_three_last_season = StatisticLastSeason.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_last_season == nil || (@statistic_player_four_last_season.created_at + 365.days) < Time.now \n @statistic_player_four_last_season = StatisticLastSeason.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n \n @statistic_player_one_all_time = StatisticAllTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_all_time = StatisticAllTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_all_time = StatisticAllTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_all_time = StatisticAllTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_time = StatisticLastTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_time = StatisticLastTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_time = StatisticLastTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_time = StatisticLastTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_season = StatisticLastSeason.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_season = StatisticLastSeason.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_season = StatisticLastSeason.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_season = StatisticLastSeason.where(\"player_id = #{@player_four_id}\").last\n \n #this part is saving stats-table pre-match for sending info to event \n @players = Player.all\n @all_time_players = []\n @last_time_players = []\n @last_season_players = []\n @players.each do |player|\n if player.statistic_all_times.any?\n @all_time_players.push({\"player\" => player, \"player_balance\" => player.statistic_all_times.last.balance})\n end\n if player.statistic_last_times.any?\n @last_time_players.push({\"player\" => player, \"player_balance\" => player.statistic_last_times.last.balance})\n end\n if player.statistic_last_seasons.any?\n @last_season_players.push({\"player\" => player, \"player_balance\" => player.statistic_last_seasons.last.balance})\n end\n end\n @all_time_players_sorted = @all_time_players.sort_by { |k| k[\"player_balance\"] }.reverse\n @last_time_players_sorted = @last_time_players.sort_by { |k| k[\"player_balance\"] }.reverse\n @last_season_players_sorted = @last_season_players.sort_by { |k| k[\"player_balance\"] }.reverse\n \n #<-----\n\n \n if @team_one_wins > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_all_time.balance + @match_balance)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_all_time.balance + @match_balance)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_all_time.balance - @match_balance)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_all_time.balance - @match_balance)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_last_time.balance + @match_balance)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_last_time.balance + @match_balance)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_last_time.balance - @match_balance)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_last_time.balance - @match_balance)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_last_season.balance + @match_balance)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_last_season.balance + @match_balance)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_last_season.balance - @match_balance)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_last_season.balance - @match_balance)\n \n end\n if @team_one_losses > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_all_time.balance - @match_balance)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_all_time.balance - @match_balance)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_all_time.balance + @match_balance)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_all_time.balance + @match_balance)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_last_time.balance - @match_balance)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_last_time.balance - @match_balance)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_last_time.balance + @match_balance)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_last_time.balance + @match_balance)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_last_season.balance - @match_balance)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_last_season.balance - @match_balance)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_last_season.balance + @match_balance)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_last_season.balance + @match_balance)\n \n end\n if @team_one_ties > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_all_time.tie_streak + 1)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_all_time.tie_streak + 1)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_all_time.tie_streak + 1)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_all_time.tie_streak + 1)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_last_time.tie_streak + 1)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_last_time.tie_streak + 1)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_last_time.tie_streak + 1)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_last_time.tie_streak + 1)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_last_season.tie_streak + 1)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_last_season.tie_streak + 1)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_last_season.tie_streak + 1)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_last_season.tie_streak + 1)\n \n end \n respond_with @match, location: create_event(@match, @all_time_players_sorted, @last_season_players_sorted, @last_time_players_sorted)\n end\n end",
"def process_data\n @list_to_process.each do |player|\n # if player team is not already on the list, it will be calculated and added\n current_team = @teams.find { |team| team.name == player.equipo }\n if current_team.nil?\n current_team = Team.new(player.equipo, @list_to_process, @config)\n current_team.calculate_percentage\n @teams << current_team\n end\n\n # do calculations\n meta = get_meta_from_config_list(@config, player.nivel)\n player.calculate_salary(current_team.percentage, meta)\n @players_to_return << player\n end\n @players_to_return.map do |player|\n PlayerResponse.new(\n nombre: player.nombre,\n goles_minimos: player.goles_minimos,\n goles: player.goles,\n sueldo: player.sueldo,\n bono: player.bono,\n sueldo_completo: player.sueldo_completo,\n equipo: player.equipo\n )\n end\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def load_players\n\t\tif self.new_record? && self.players.empty?\n\t\t\tself.user_ids.shuffle!.each_with_index do |user_id, index|\n\t\t\t\tself.players.build(position: index, user_id: user_id)\n\t \tend\n\t end\n \tend",
"def player_creation\n @players = []\n @available_roles_to_pick = ROLES.keys.shuffle\n @number_players = 0\n\n prompt_number_of_players\n\n @epidemic_cards_number = 0\n determine_epidemic_cards_number\n\n determine_deal_player_card_number\n create_players\n prompt_player_info\n end",
"def player_creator(data_var,name)\r\n\tdata_var.execute(\"INSERT INTO players (name,placing) VALUES (?,?)\",[name,\"no place\"])\r\nend",
"def generate_player\n ret_val = nil\n msg = \"no changes made\"\n if (!ranking_player.nil?) and !has_base_player\n ret_val = PlayersHelper.generate_player_from_url(ranking_player)\n if !ret_val.nil?\n self.player = ret_val\n if base_player_country_id != base_country_id \\\n and !base_player_country.nil?\n self.country = base_player_country\n end\n self.resolved = true\n self.save!\n msg = \"Created new player \" + base_player_name + \"/\" + \\\n base_player_code + \"/id=\" + ret_val.id.to_s\n else\n msg = \"Player creation failed from url: \" + rp_url\n end\n end\n\n SystemLog.log(msg)\n ret_val\n end"
] |
[
"0.67178106",
"0.6679277",
"0.6521614",
"0.6490447",
"0.64522433",
"0.6435048",
"0.6409999",
"0.6368255",
"0.63620615",
"0.6346649",
"0.63338155",
"0.63176423",
"0.62978214",
"0.62587976",
"0.62456095",
"0.62323886",
"0.621037",
"0.61967593",
"0.6187602",
"0.6168517",
"0.61406046",
"0.6119311",
"0.61182165",
"0.6102742",
"0.6102245",
"0.6099856",
"0.6084956",
"0.6078672",
"0.6066882",
"0.60605794",
"0.6035665",
"0.6014424",
"0.60033983",
"0.59926",
"0.5986329",
"0.5977642",
"0.59759915",
"0.59728223",
"0.5972614",
"0.59708065",
"0.59629136",
"0.59564894",
"0.5950723",
"0.59499794",
"0.5945011",
"0.59239846",
"0.5920598",
"0.59183043",
"0.5913136",
"0.5902147",
"0.5901966",
"0.58963853",
"0.58954877",
"0.58880574",
"0.5879567",
"0.584567",
"0.58386886",
"0.5838183",
"0.5836434",
"0.5834191",
"0.5824958",
"0.5821908",
"0.5814012",
"0.5812464",
"0.5811976",
"0.5808753",
"0.5806955",
"0.58064795",
"0.5805129",
"0.5794985",
"0.57933605",
"0.5792868",
"0.5783665",
"0.57805663",
"0.5776942",
"0.5773373",
"0.5768288",
"0.5766791",
"0.5761908",
"0.5758488",
"0.5754008",
"0.5741476",
"0.57403487",
"0.5736862",
"0.573594",
"0.5735452",
"0.5734362",
"0.573386",
"0.5731833",
"0.57288253",
"0.572605",
"0.572554",
"0.57245344",
"0.572365",
"0.5719382",
"0.57122225",
"0.5710641",
"0.5707662",
"0.5704893",
"0.5704384"
] |
0.758154
|
0
|
The default 'sync' method only selects among a list of registered values.
|
def sync
unless self.class.values
self.devfail "No values defined for %s" %
self.class.name
end
# Set ourselves to whatever our should value is.
self.set(self.should)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sync=(arg0)\n end",
"def sync=(p1)\n #This is a stub, used for indexing\n end",
"def sync_list(options, force = false)\n (get_list(options, force)['ID'] rescue nil) || create_list(options)\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]\n super(sync_list.to_json)\n end",
"def deep_sync(collection)\n if collection.is_a? Hash\n collection.each_with_object({}) do |(k, v), hsh|\n hsh[k] = deep_sync(v)\n end\n elsif collection.is_a? Array\n collection.map { |i| deep_sync(i) }\n else\n collection.respond_to?(:__sync) ? collection.__sync : collection\n end\n end",
"def sync()\n #This is a stub, used for indexing\n end",
"def old_sync=(_arg0); end",
"def sync_all_data\n return if self.disabled?\n self.sync_availability\n self.sync_rate\n self.sync_stop_sell\n self.sync_min_stay\n\n if self.channel == GtaTravelChannel.first\n self.sync_gta_travel_cta\n self.sync_gta_travel_ctb\n else\n self.sync_cta if Constant::SUPPORT_CTA.include?(self.channel)\n self.sync_ctd if Constant::SUPPORT_CTD.include?(self.channel)\n end\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def sync_options; @sync_options ||= table_sync.sync_options; end",
"def sync=\n end",
"def sync *attributes\n self.class.define_method(:sync_attributes) do\n ActiveSync::Sync.sync_attributes(self, attributes)\n end\n define_method(:sync_record) do\n ActiveSync::Sync.sync_record(self, attributes)\n end\n define_method(:sync_associations) do\n ActiveSync::Sync.sync_associations(self, attributes)\n end\n end",
"def sync_data\n\t\tSYNC_TABLES.each do |sync|\n\t\t\tself.sync_table(sync)\n\t\tend\n\tend",
"def syncronize(upn_or_id, c = User)\n syncronize_with_select(upn_or_id, nil, c)\n end",
"def sync; end",
"def old_sync; end",
"def sync\n end",
"def sync\n end",
"def all_items\n @allitems ||= syncitems :lastsync => \"1970-01-01 00:00:00\"\n end",
"def sync(&b)\n @m.synchronize &b\n end",
"def sync_filters\n super.presence || default_sync_filters\n end",
"def sync\n run 'sync', :quiet => true\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def sync\n @sync ||= Sync.new self\n end",
"def sync(&block)\n queue SyncCommand, [], {}, &block\n end",
"def select_multiple(*values)\n clear\n values.flatten.each{ |value| select(value) }\n end",
"def fsync()\n #This is a stub, used for indexing\n end",
"def lock_list\n super\n end",
"def sweetist_sync_option_values(option_values_arr)\n sweetist_option_values = option_values_arr.map do |ov_hash|\n option_value_match = nil\n # check if syncing pack_size as an option_value\n unless ov_hash.fetch(:option_type,{}).fetch(:name,'').to_s.downcase == 'size'\n option_value_match = self.integration_item.integration_sync_matches.find_or_create_by(\n integration_syncable_id: ov_hash['id'],\n integration_syncable_type: \"Spree::OptionValue\"\n )\n end\n payload = sweetist_map_to_sweetist_option_value(ov_hash)\n sweetist_option_type_id = payload.fetch(:option_value, {}).fetch(:option_type_id)\n\n # if we have a match saved && found in Sweetist\n if option_value_match.try(:sync_id) && send_request(\"#{ENV['SWEETIST_INTEGRATION_URL']}/api/option_values/#{option_value_match.sync_id}?token=#{ENV['SWEETIST_API_KEY']}\").code.to_i == 200\n push_request = send_request(\"#{ENV['SWEETIST_INTEGRATION_URL']}/api/option_values/#{option_value_match.sync_id}?token=#{ENV['SWEETIST_API_KEY']}\", :patch, payload)\n # no match saved or not found or syncing pack_size as an option_value\n else\n get_request = send_request(\"#{ENV['SWEETIST_INTEGRATION_URL']}/api/option_values?q[option_type_id_eq]=#{sweetist_option_type_id}&q[name_eq]=#{ov_hash.fetch(:name,'')}&token=#{ENV['SWEETIST_API_KEY']}\")\n sweetist_option_value = JSON.parse(get_request.body).first\n if sweetist_option_value\n sweetist_ov_id = sweetist_option_value.fetch('id')\n push_request = send_request(\"#{ENV['SWEETIST_INTEGRATION_URL']}/api/option_values/#{sweetist_ov_id}?token=#{ENV['SWEETIST_API_KEY']}\", :patch, payload)\n else\n push_request = send_request(\"#{ENV['SWEETIST_INTEGRATION_URL']}/api/option_values/?token=#{ENV['SWEETIST_API_KEY']}\", :post, payload)\n end\n end\n new_sweetist_option_value = JSON.parse(push_request.body)\n option_value_match.update_columns(sync_id: new_sweetist_option_value.fetch('id',nil)) if option_value_match.present?\n\n new_sweetist_option_value\n end\n end",
"def sync(sync_token: nil, **query, &block)\n return sync_old(sync_token: sync_token, **query) unless block_given?\n\n query = {\n # override default locale for sync queries\n locale: nil\n }.merge(\n if sync_token\n { sync_token: sync_token }\n else\n { initial: true }\n end\n ).merge(query)\n\n _instrument 'sync', sync_token: sync_token, query: query do\n resp = get('sync', query)\n resp = SyncResponse.new(resp)\n resp.assert_ok!\n\n resp.each_page do |page|\n page.page_items.each(&block)\n sync_token = resp.next_sync_token\n end\n end\n\n sync_token\n end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync(from=:rb)\n\t\t\tif @unlock\n\t\t\t\t@unlock=nil #to avoid the same update several times\n\t\t\t\t## Dyndoc.warn \"rb sync (from #{from}):\",ids(:rb)\n\t\t\t\t@vectors[from] > @ary unless from==:rb\n\t\t\t\t## Dyndoc.warn \"new ary\",[@vectors[from].name,@vectors[from].value,@ary]\n\t\t\t\t([:jl,:r]-[from]).each do |to|\n\t\t\t\t\t## Dyndoc.warn \"rb sync (to #{to})\"\n\t\t\t\t\t@vectors[to] < @ary\n\t\t\t\t\t## Dyndoc.warn \"@vectors[#{to}].value\", @vectors[to].value\n\t\t\t\tend\n\t\t\t\t@unlock=true\n\t\t\tend\n\t\tend",
"def sync_trackables\n action = :activate\n trackables_to_sync.each do |group|\n group.each do |kind,names|\n toggle_trackable(kind, names, action) if names.present?\n end\n action = :deactivate\n end\n end",
"def sync\n OPENERP_MAPPING_SEED.map do |openerp_model, rails_data|\n rails_model = rails_data.camelize.constantize\n \n print_syncing(openerp_model, rails_model)\n rails_model.sync(openerp_model) \n\n end\n end",
"def sync(params)\n if params.has_key?(:group)\n group = params[:group]\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would sync configurations for load balancer #{@config[:host]} to group #{group}\",\n :tags => [:f5, :dryrun])\n else\n notify(:msg => \"[#{@name}] Syncing configurations for load balancer #{@config[:host]} to group #{group}\",\n :tags => [:f5, :trace])\n with_f5('System.ConfigSync') do\n synchronize_to_group(group)\n end\n end\n else\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would sync configurations for load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n else\n notify(:msg => \"[#{@name}] Syncing configurations for load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n with_f5('System.ConfigSync') do\n synchronize_configuration('CONFIGSYNC_ALL')\n end\n end\n end\n nil\n end",
"def synchronization=(value)\n @synchronization = value\n end",
"def servers\n sync{@servers.keys}\n end",
"def taskforce_select(enum, &block)\n Enumerator.new do |current_value| # this default serves as the new generator for the enum generator to processed\n enum.each do|value| # this iterates careful through enum passed \n current_value.yield value if block.call(value) #only provide a value if its within check by code blocks\n end\n end\n end",
"def sync\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") % {class: self.class, method: __method__}\n end",
"def set_multiple(options)\n options.each do |option, value|\n set(option, value)\n end\n end",
"def allowed_domain_guids_for_sync_app=(value)\n @allowed_domain_guids_for_sync_app = value\n end",
"def sync_options\n @sync_options ||= session.configuration.options_for_table(left_table)\n end",
"def bitbucket_syncs_list(opts = {})\n data, _status_code, _headers = bitbucket_syncs_list_with_http_info(opts)\n data\n end",
"def each_available_target\n return enum_for(__method__) if !block_given?\n each_available_autosync_target do |path, t|\n op = SyncAll.new(path, config_dir: config_dir)\n op.each_target do |config, target|\n yield(config, target)\n end\n end\n end",
"def sync\n self.disabled_reason = nil\n if valid?\n execute_sync\n true\n else\n false\n end\n end",
"def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }\n c.save\n end\n end\n end",
"def synchronize(mapping)\n Synchronizer.new(mapping).run(@changes)\n end",
"def sync\n cached_dataset(:_sync) do\n clone(:async=>false)\n end\n end",
"def sync_one(name)\n each_difference({ name => one_local(name) }, false) { |name, diffs| sync_difference(name, diffs) }\n end",
"def preset_eager_sync\n store = options.shift || :memory\n store = SYNC_STORES[store]&.call(config, *options) if store.is_a?(Symbol)\n self.store = store\n end",
"def async_pick(*column_names)\n async.pick(*column_names)\n end",
"def synchronize_all_methods; end",
"def sync\n student_attributes = []\n \n #EXAMPLE [:@name, :@age, :@hometown]\n instance_variables.each do |i|\n # from :@name\n student_attributes << i.to_s.delete(\"@\") # to name\n \n end\n \n query_components_array = []\n\n student_attributes.each do |a|\n\n value = self.send(a) # self.name .... self.send(\"name\")\n\n if value.is_a?(Integer)\n query_componenets_array << \"#{a} = #{value}\"\n else\n query_componenets_array << \"#{a} = '#{value}'\"\n end\n end\n query_string = query_components_array.join(\", \")\n \n # The following connects classes to tables:\n DATABASE.execute(\"UPDATE students SET #{query_string} WHERE id = #{id}\")\n end",
"def select_values values\n return unless values\n values.each do |val|\n row = @list.index val\n add_row_selection_interval row, row unless row.nil?\n end\n end",
"def mark_as_unsync(order_ids)\r\n order_ids = [order_ids] unless order_ids.is_a?(Array)\r\n @customer.sales_orders.update_all \"synchronized = false\", [\"id in (?)\", order_ids]\r\n end",
"def sync\n each_difference(local_resources, true) { |name, diffs| sync_difference(name, diffs) }\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def call(value)\n coerced = value.map { |item| super(item) }\n\n @set ? Set.new(coerced) : coerced\n end",
"def tsync=(value)\n set_attr(:tsync, value ? 1 : 0)\n @tsync = value\n end",
"def sync(_nthRun = :all)\n doWithNthRun(_nthRun){|_run|\n _run.reload() ;\n }\n end",
"def are_synced\n where(sync_status: true).to_a\n end",
"def broadcast_sync(meth, *args)\n @listeners.select { |listener| listener.class.ann(meth, :stem_sync) }.each { |listener| listener.respond meth, *args }\n end",
"def tsync\n @tmutex.synchronize do\n yield\n end\n end",
"def sync!(options) # semi-public.\n # TODO: merge this into Sync::Run or something and use in Struct, too, so we don't\n # need the representer anymore?\n options_for_sync = sync_options(Options[options])\n\n schema.each(options_for_sync) do |dfn|\n property_value = sync_read(dfn) #\n\n unless dfn[:nested]\n mapper.send(dfn.setter, property_value) # always sync the property\n next\n end\n\n # First, call sync! on nested model(s).\n nested_model = PropertyProcessor.new(dfn, self, property_value).() { |twin| twin.sync!({}) }\n next if nested_model.nil?\n\n # Then, write nested model to parent model, e.g. model.songs = [<Song>]\n mapper.send(dfn.setter, nested_model) # @model.artist = <Artist>\n end\n\n model\n end",
"def worker_set(limit = 5, options={})\n #TODO: add priority to this.\n options = {:lock_name=>nil,:limit=>limit, :order=>[:time.asc]}.merge(options)\n current.all(options)\n end",
"def execute_sync\n @env.primary_vm.run_action(Vagrant::Mirror::Middleware::Sync)\n end",
"def insync?(current_value)\n if current_value.is_a? Array and @should.is_a? Array\n current_value.sort == @should.sort\n else\n current_value == @should\n end\n end",
"def set(values); end",
"def fetch_and_enqueue(force_all_syncs=false)\n begin\n if force_all_syncs\n query = db.fetch(%Q(\n SELECT r.name, r.id FROM #{relation} r, users u WHERE\n (r.state = '#{CartoDB::Synchronization::Member::STATE_SUCCESS}'\n OR r.state = '#{CartoDB::Synchronization::Member::STATE_SYNCING}')\n AND u.id = user_id AND u.state = '#{Carto::User::STATE_ACTIVE}'\n ))\n else\n query = db.fetch(%Q(\n SELECT r.name, r.id, r.user_id FROM #{relation} r, users u\n WHERE EXTRACT(EPOCH FROM r.run_at) < #{Time.now.utc.to_f}\n AND u.id = user_id AND u.state = '#{Carto::User::STATE_ACTIVE}'\n AND\n (\n r.state = '#{CartoDB::Synchronization::Member::STATE_SUCCESS}'\n OR (r.state = '#{CartoDB::Synchronization::Member::STATE_FAILURE}'\n AND r.retried_times < #{CartoDB::Synchronization::Member::MAX_RETRIES})\n )\n ORDER BY ran_at\n ))\n end\n success = true\n rescue Exception => e\n success = false\n print_log(\"ERROR fetching sync tables: #{e.message}, #{e.backtrace}\", true)\n end\n\n if success\n print_log \"Fetched #{query.count} records\"\n force_all_syncs ? enqueue_all(query) : enqueue_rate_limited(query)\n end\n\n self\n end",
"def configsyncd_state(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end",
"def exec_sync\n raise \"You must override `exec_sync' in your class\"\n end",
"def shared_list_values\n list_value_custom_fields_enabled_on_project = CustomField.enabled_on_project(self).where(:field_format => 'project_list_value')\n\n if new_record?\n ::ProjectEnumeration.\n joins(:project).\n preload(:project, :custom_field).\n for_list_values.\n where(\"#{Project.table_name}.status <> ? AND #{::ProjectEnumeration.table_name}.sharing = 'system'\", ::Project::STATUS_ARCHIVED).\n where(:custom_field_id => list_value_custom_fields_enabled_on_project).\n order_by_custom_field_then_position\n else\n @shared_list_values ||= begin\n r = root? ? self : root\n ::ProjectEnumeration.\n joins(:project).\n preload(:project, :custom_field).\n for_list_values.\n where(\"#{Project.table_name}.id = #{id}\" +\n \" OR (#{Project.table_name}.status <> #{::Project::STATUS_ARCHIVED} AND (\" +\n \" #{::ProjectEnumeration.table_name}.sharing = 'system'\" +\n \" OR (#{Project.table_name}.lft >= #{r.lft} AND #{Project.table_name}.rgt <= #{r.rgt} AND #{::ProjectEnumeration.table_name}.sharing = 'tree')\" +\n \" OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{::ProjectEnumeration.table_name}.sharing IN ('hierarchy', 'descendants'))\" +\n \" OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{::ProjectEnumeration.table_name}.sharing = 'hierarchy')\" +\n \"))\").\n where(:custom_field_id => list_value_custom_fields_enabled_on_project).\n order_by_custom_field_then_position\n end\n end\n end",
"def arm_sync\n val = wordread(:sync_arm)\n val &= ~1 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 1)\n wordwrite(:sync_arm, val)\n end",
"def sync\n TaskwarriorWeb::Command.new(:sync, nil, nil).run\n end",
"def sync\n if not cloned?\n clone\n else\n update\n end\n end",
"def mon_synchronize(&b)\n @mon_data.synchronize(&b)\n end",
"def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end",
"def each_autosync_target\n return enum_for(__method__) if !block_given?\n targets.each_value do |targets|\n targets.each { |t| yield(t) }\n end\n end",
"def synchronize(updater); end",
"def sync_local\n sync_hash = {\n ['~/Library/Application\\\\ Support/Firefox', '~/Library/Application\\\\ Support/Quicksilver',\n '~/Library/Preferences' ] =>'library/',\n ['~/.boson', '~/.sake', '~/.cronrc', '~/.gemrc', '~/.gitconfig', '~/.gem/specs']=>'dotfiles/',\n }\n sync_hash.each do |src, dest|\n src.each do |e| \n cmd = \"rsync -av #{e} #{File.join('~/backup', dest)}\"\n system cmd\n end\n end\n end",
"def sync_list(list_type)\n \n #Update account_info \n #TODO make sure this isn't called four times if all lists are syncghronized together\n @account_info = @authenticator.get_account\n\n \n #lists_array is the array that stores the user's lists of the given type\n #For example, @locations\n \n lists_array = self.send(\"#{list_type}s\")\n \n\n #Add any new locations\n new_lists = lists_array.keys.select{|list| list.brand_new}\n \n #TODO rewrite this to use only one API query, if API supports it\n unless new_lists.empty? #Won't be redundant if/when the loop is eliminated\n new_lists.each do |list| \n @authenticator.send(\"add_#{list_type}\", list.json_parsed)\n list.no_longer_new!\n end\n end\n \n #Delete any deleted locations \n\n #Get all the lists that have been deleted locally \n del_lists = lists_array.values.select{|list| list.deleted}\n\n unless del_lists.empty?\n del_lists.each do |list|\n @authenticator.send(\"delete_#{list_type}\", list.json_parsed)}\n lists_array.delete(list.id)\n list.delete!\n list.edit_saved\n end\n end\n \n #TODO delete the lists locally if they have been deleted on the server\n\n #Only fetch from server and do conflict resolution if the last edit on the server was later than the last sync for the list\n \n if self.send(\"lastedit_#{list_type}\") > self.send(\"last_#{list_type}_sync\") \n\n #Get the lists\n lists = @authenticator.send(\"get_#{list}s\")\n\n locally_edited = []\n \n lists.each do |list|\n if not lists_array[list.id]\n #If for some reason we don't have the list locally, store the list locally and move on.\n lists_array[list.id]\n else\n #Otherwise, compare modification times, update local copy when necessary, and resolve editing conflicts\n \n if self.send(\"lastedit_#{list}\") > lists_array[task.id].last_mod\n #The server-stored list was modified more recently than the local task\n #TODO make sure the list object is unique by ID\n \n lists_array[list.id].json_parsed = list.json_parsed\n lists_array[list.id].edit_saved\n else\n #The local list was modified more recently than the server-stored task\n #Assume the local copy is more accurate if the two timestamps are somehow the same\n locally_edited.push(lists_array[task.id])\n @authenticator.send(\"edit_#{list}\", list.json_parsed) unless list.deleted?\n list.edit_saved\n end\n end\n end\n end\n\n\n #TODO will this work if it is not public?\n self.send(\"last#{list_type}_sync=\", Time.now)\n \n #Remove all locally deleted lists of this type\n self.send(\"#{list_type}s=\", lists_array.values.select{|list| not list.deleted})\n\n #All of the lists have now been synchronized since they were last created\n self.send(\"#{list_type}s\").each{|list| list.no_longer_new!}\n end",
"def selectize_multi_select(key, *values)\n values.flatten.each do |value|\n open_selectize_chooser(key)\n execute_script(\"\n #{find_selectized_control_js(key)}.querySelector('input').value = '#{value}';\n document.querySelector$('##{key}.selectized').selectize.createItem();\n \")\n end\n end",
"def touch_sync\n self.lastSyncAt = Time.now if self.respond_to?(:lastSyncAt=)\n end",
"def synchronize!(updater); end",
"def sync_type\n if %w(blacklist whitelist).include?(type = self['type'])\n type\n end\n end",
"def sync\n model_ids_that_exist = []\n\n @model_class.all.each do |model|\n model_ids_that_exist << model.id\n if are_different?(@database_event_registry.event_for(model), model)\n create_or_recreate_event(model)\n end\n end\n @database_event_registry.unregister_all_except(model_ids_that_exist)\n end",
"def set_value_list\n @value_list = ValueList.find(params[:id])\n end",
"def ensure_all\n sync do\n devices.each { |dev| ct.group.devices.provide(dev) }\n end\n end",
"def remote_sync_if_necessary(options={})\n false\n end",
"def gen_sw_sync\n val = wordread(:sync_arm)\n val &= ~0x10 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 0x10)\n wordwrite(:sync_arm, val)\n end",
"def marked_choices_unique\n return if not_registered\n marked_choices.map do |c|\n c.length == 1 ? c.first : nil\n end\n end",
"def import_valuesets\n logger.debug 'Sync valuesets '\n # get all of the versions and valuesets and map them together\n # this is cleaner and easier than getting the vs and the getting all of it's versions\n # separately\n valuesets = vads_client.getAllValueSets.getValueSets\n versions = vads_client.getAllValueSetVersions.getValueSetVersions\n temp = {}\n logger.debug\n valuesets.each do |vs|\n temp[vs.oid] = { valueset: vs, versions: [] }\n end\n\n versions.each do |ver|\n temp[ver.valueSetOid][:versions] << ver\n end\n @valuesets = temp.values\n @valuesets.each do |vs|\n logger.debug \"working valueset #{vs[:valueset].name}\"\n import_versions(vs)\n end\n end",
"def sync(&block)\r\n thread_lock.synchronize &block\r\n end"
] |
[
"0.5767916",
"0.56994826",
"0.5566776",
"0.5537269",
"0.55282736",
"0.55224544",
"0.5499396",
"0.5482373",
"0.54822874",
"0.54822874",
"0.54822874",
"0.5458811",
"0.5404174",
"0.53347",
"0.5268865",
"0.5262589",
"0.52565765",
"0.51960444",
"0.51954657",
"0.51954657",
"0.51721746",
"0.51640385",
"0.51618147",
"0.5127156",
"0.5126441",
"0.5126441",
"0.51055074",
"0.5078259",
"0.5065482",
"0.5050992",
"0.5046597",
"0.5014312",
"0.4998434",
"0.4998434",
"0.4998434",
"0.49952635",
"0.4960219",
"0.4952854",
"0.49484596",
"0.4913854",
"0.49071163",
"0.4896367",
"0.4843932",
"0.4832889",
"0.48154005",
"0.4814861",
"0.48128656",
"0.48083195",
"0.4804418",
"0.48031542",
"0.48028806",
"0.47916895",
"0.47898778",
"0.47733805",
"0.47643578",
"0.47566476",
"0.4747756",
"0.47428435",
"0.47359872",
"0.4720143",
"0.47123393",
"0.47123393",
"0.47123393",
"0.47123393",
"0.4710971",
"0.46992862",
"0.46959487",
"0.46948233",
"0.469036",
"0.46885005",
"0.46758285",
"0.46649605",
"0.46556678",
"0.4654216",
"0.46510172",
"0.46385282",
"0.4634362",
"0.46156234",
"0.46117967",
"0.4604137",
"0.46012905",
"0.46003696",
"0.45976788",
"0.4596888",
"0.4595025",
"0.45906928",
"0.45903817",
"0.4589829",
"0.4588075",
"0.45858282",
"0.4581215",
"0.4579383",
"0.4558332",
"0.45527023",
"0.4548833",
"0.45416215",
"0.45386112",
"0.45384195",
"0.45325872",
"0.45305672"
] |
0.53846395
|
13
|
==== Insert 'presenter'like methods below if necessary
|
def delete_user user
user.deleted? ? @view.restore_user_link(user, 'data-turbolinks'=> false) : @view.delete_link(user, 'data-turbolinks'=> false)
if user.deleted?
@view.restore_user_link(user, 'data-turbolinks' => false)
else
"<i class='far fa-lg fa-trash-alt cursor-pointer' id='kt_sweetalert_demo_#{user.id}'></i>
<script type='text/javascript'>
$('[id^=kt_sweetalert_demo_]').click(function (e) {
Swal.fire({
title: 'Are you sure?',
text: 'If Delete Permanently checked, You will not be able to recover this User!',
input: 'checkbox',
inputPlaceholder: 'Delete Permanently',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then(function (result) {
if (result.isConfirmed) {
if(result.value) {
$.ajax({
url: '/users/#{user.id}/really_destroy',
type: 'delete',
success: function(response){
Swal.fire(
'Deleted!',
'User has been deleted Permanently.',
'success'
).then(function() {
window.location.reload();
});
}
})
}
else {
$.ajax({
url:'users/#{user.id}',
type: 'delete',
success: function(response){
Swal.fire(
'Soft Deleted',
'User has been soft deleted.',
'success'
).then(function() {
window.location.reload();
});
}
})
}
} else if (result.dismiss === 'cancel') {
Swal.fire(
'Cancelled',
'User is not deleted',
'error'
)
}
});
});
</script>
".html_safe
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def presenter\n self\n end",
"def show_presenter\n TextPresenter\n end",
"def presenters\n raise NotImplementedError\n end",
"def implementation; end",
"def implementation; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods() end",
"def expose; end",
"def _view; end",
"def define_presenter_method!(methods, &block)\n if methods.size != 1\n Kernel.abort \"[ERROR] You are providing a block for the `#{methods.join(', ')}` methods, \" \\\n \"but you can only provide a block for a single presenter at a time.\\n #{caller.second}\"\n end\n presenter_method = methods.first\n define_method presenter_method, &block\n private presenter_method\n end",
"def initialize( * )\n\t\tsuper\n\t\t@presenter = self.setup_presentation_layer\n\tend",
"def presents(_obj)\n raise NotImplementedError\n end",
"def expose_presenter(*method_names)\n presenters_module = Module.new do\n method_names.each do |name|\n module_eval <<-ruby_eval, __FILE__, __LINE__ + 1\n def #{name}\n controller.send('#{Presenter.method_name_for(name)}')\n end\n ruby_eval\n end\n end\n helper presenters_module\n end",
"def presenter\n @presenter ||= presenter_class.new(@collection).tap do |p|\n p.render_context = view_context\n end\n end",
"def presenter\n @presenter ||= presenter_class.new(@collection).tap do |p|\n p.render_context = view_context\n end\n end",
"def show\n #TODO: this needs to be locked down\n self.not_implemented\n end",
"def private; end",
"def delegating_method; end",
"def delegate_method; end",
"def show\n @presenter = @entity.presenter\n end",
"def provider; end",
"def view_flow; end",
"def view; end",
"def json_presenter_class\n self.class.json_presenter_class\n end",
"def presenter(document)\n presenter_class.new(document, self)\n end",
"def presenter(name, opt={})\n attribute(name) | maybe(to_presentation(name, opt))\n end",
"def show\n # No implementation needed\n end",
"def show\n # No implementation needed\n end",
"def render!; raise NotImplementedError end",
"def presenter(document)\n case action_name\n when 'show', 'citation'\n show_presenter(document)\n when 'index'\n index_presenter(document)\n else\n Deprecation.warn(Blacklight::BlacklightHelperBehavior, \"Unable to determine presenter type for #{action_name} on #{controller_name}, falling back on deprecated Blacklight::DocumentPresenter\")\n presenter_class.new(document, self)\n end\n end",
"def show\n #not needed for our implementation\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def inner_presenter\n @inner_presenter ||= GentleREST::Presenter.new\n return @inner_presenter\n end",
"def generate_presenter\n @presenter = nil\n @presenter = ((self.class.name.gsub!('Controller', '').singularize + 'Presenter').constantize).new unless defined?((self.class.name.gsub!('Controller', '').singularize + 'Presenter').constantize.to_s).nil?\n end",
"def show\n raise NotImplementedError\n end",
"def wrapper; end",
"def widget\n end",
"def widget\n end",
"def render\n # To be implemented.\n end",
"def interface; end",
"def interface; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def private_method\n end",
"def work_presenter\n @work_presenter||= CurationConcerns::GenericWorkShowPresenter.new(\n SolrDocument.find(work_id),\n Ability.new(nil)\n )\n end",
"def public; end",
"def public; end",
"def custom; end",
"def custom; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def protected_method\n end",
"def method_missing(method, *args, &block) \n return super unless part(method)\n part(method).render\n end",
"def public_method; end",
"def design\r\n \r\n end",
"def show() end",
"def show() end",
"def show() end",
"def rendered; end",
"def accessibility; end",
"def file_presenter_class\n CollectionShowPresenter\n end",
"def prepare_instance_variables_for_batch_control_display\n super\n @incorporate_collection_presenter = build_incorporate_collection_presenter\n end",
"def show_presenter\n # CurationConcerns::WorkShowPresenter\n ::SamplePresenter\n end",
"def work_presenter\n @work_presenter||= CurationConcerns::GenericWorkShowPresenter.new(\n SolrDocument.find(work_id),\n Ability.new(nil)\n )\n end",
"def show?; end",
"def overview\n\n end",
"def call\n # implement in subclasses\n end",
"def display\n # Don't no why i thought i would need that. or if i need this.\n end",
"def renderer; end",
"def overrides; end",
"def displayed?; end",
"def set_page_presenter(action, page_presenter)\n\n\n\n\n\n\n\n if action.to_s == \"index\" && page_presenter[:as]\n\n\n\n index_class = find_index_class(page_presenter[:as])\n\n\n\n page_presenter_key = index_class.index_name.to_sym\n\n\n\n set_index_presenter page_presenter_key, page_presenter\n\n\n\n else\n\n\n\n page_presenters[action.to_sym] = page_presenter\n\n\n\n end\n\n\n\n\n\n\n\n end",
"def view_renderer; end",
"def view_renderer; end",
"def render\n end",
"def set_presenter\n @presenter = Presenter.find(params[:id])\n end",
"def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end",
"def render\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end"
] |
[
"0.73215747",
"0.64770687",
"0.6407835",
"0.62353384",
"0.62353384",
"0.6227446",
"0.6227446",
"0.6227446",
"0.6227446",
"0.6208145",
"0.6196868",
"0.61720157",
"0.60887784",
"0.6047495",
"0.60456544",
"0.5983047",
"0.597256",
"0.597256",
"0.5960645",
"0.59560406",
"0.5932622",
"0.592389",
"0.5920675",
"0.58908683",
"0.5879646",
"0.58680934",
"0.5848718",
"0.58070785",
"0.58005375",
"0.57745075",
"0.57745075",
"0.5771981",
"0.57678294",
"0.57674587",
"0.576041",
"0.576041",
"0.576041",
"0.5754395",
"0.57381743",
"0.5715396",
"0.5714201",
"0.57129955",
"0.57129955",
"0.5707565",
"0.57032347",
"0.57032347",
"0.56981623",
"0.56981623",
"0.56981623",
"0.56981623",
"0.56981623",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.567886",
"0.5667957",
"0.563705",
"0.5629207",
"0.5629207",
"0.5619078",
"0.5619078",
"0.56112266",
"0.56112266",
"0.56112266",
"0.56112266",
"0.56112266",
"0.56093204",
"0.5596653",
"0.5579895",
"0.55693585",
"0.556174",
"0.556174",
"0.556174",
"0.55565625",
"0.55484676",
"0.5545749",
"0.55430734",
"0.55374354",
"0.55339915",
"0.5525223",
"0.55242515",
"0.55209374",
"0.55200595",
"0.5514476",
"0.5509996",
"0.5502917",
"0.549081",
"0.5481398",
"0.5481398",
"0.5474332",
"0.54644185",
"0.5464037",
"0.5459764"
] |
0.0
|
-1
|
Directly create pieces and add them to the pieces collection.
|
def initialize_board
# Non-pawns for black player:
Rook.create(x_position: 1, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Knight.create(x_position: 2, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Bishop.create(x_position: 3, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Queen.create(x_position: 4, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
King.create(x_position: 5, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Bishop.create(x_position: 6, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Knight.create(x_position: 7, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
Rook.create(x_position: 8, y_position: 1, game_id: id, color: "black", player_id: black_player_id)
# Non-pawns for white player:
Rook.create(x_position: 1, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Knight.create(x_position: 2, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Bishop.create(x_position: 3, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Queen.create(x_position: 4, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
King.create(x_position: 5, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Bishop.create(x_position: 6, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Knight.create(x_position: 7, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
Rook.create(x_position: 8, y_position: 8, game_id: id, color: "white", player_id: white_player_id)
# Pawns for both players:
for i in 1..8
Pawn.create(color: "black", x_position: i, y_position: 2, game_id: id, player_id: black_player_id)
Pawn.create(color: "white", x_position: i, y_position: 7, game_id: id, player_id: white_player_id)
end
self.counter = 0
# Saves the counter to the database.
self.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_pieces(color)\n 8.times { @pieces << Pawn.new(color) }\n 2.times do\n @pieces << Rook.new(color)\n @pieces << Bishop.new(color)\n @pieces << Knight.new(color)\n end\n @pieces << Queen.new(color)\n @pieces << King.new(color)\n end",
"def create_piece\n @in_play = @current_piece.new(@object_array, @window)\n\n # Create the ghost piece give the piece in play\n calculate_ghost_piece\n end",
"def place_pieces\n colors = [:black, :white]\n piece_classes = [King, Queen, Bishop, Knight, Rook, Pawn]\n\n colors.each do |color|\n piece_classes.each do |piece|\n piece.starting_positions(color).each do |pos|\n add_piece(piece.new(color, self, pos), pos)\n end\n end\n end\n end",
"def assign_pieces\n @pieces = Array.new(@number_of_pieces).map do\n piece = assign_until_unique(Piece.new)\n coordinates << piece.coordinates\n piece\n end\n end",
"def create_initial_pieces\n WHITE_INITIAL_POSITIONS.each do |position|\n @white_pieces << CheckerPiece.new(self, position, :white)\n end\n BLACK_INITIAL_POSITIONS.each do |position|\n @black_pieces << CheckerPiece.new(self, position, :black)\n end\n end",
"def set_pieces\n # white pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 2, color: 'white', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 1, color: 'white', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 1, color: 'white', active: true)\n King.create(game_id: id, x_position: 5, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 1, color: 'white', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 1, color: 'white', active: true)\n # black pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 7, color: 'black', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 8, color: 'black', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 8, color: 'black', active: true)\n King.create(game_id: id, x_position: 5, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 8, color: 'black', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 8, color: 'black', active: true)\n end",
"def build_pieces\n (1..8).each do |i|\n Pawn.new(2, i, \"white\") \n end\n Rook.new(1, 1, \"white\")\n Knight.new(1, 2, \"white\")\n Bishop.new(1, 3, \"white\")\n Queen.new(1, 4, \"white\")\n King.new(1, 5, \"white\")\n Bishop.new(1, 6, \"white\")\n Knight.new(1, 7, \"white\")\n Rook.new(1, 8, \"white\")\n (1..8).each do |i|\n Pawn.new(7, i, \"black\") \n end\n Rook.new(8, 1, \"black\")\n Knight.new(8, 2, \"black\")\n Bishop.new(8, 3, \"black\")\n Queen.new(8, 4, \"black\")\n King.new(8, 5, \"black\")\n Bishop.new(8, 6, \"black\")\n Knight.new(8, 7, \"black\")\n Rook.new(8, 8, \"black\")\n end",
"def set_pieces\n @pieces.each do |piece|\n y , x = piece.location\n @rows[y][x] = piece\n end\n end",
"def createPieces(initial_id, number_of_pieces, width, height, tokens, input)\n raise \"Invalid number of pieces: #{number_of_pieces}\" if number_of_pieces < 1\n piece = Pentomino::Pieces::Piece.new\n var = Pentomino::Pieces::PieceVariant.new(width, height)\n var.fill(tokens, initial_id)\n 8.times do |index| #piece may have up to 8 variants\n piece.addVariant(var)\n var = var.rotate\n var = var.flip if index == 3\n end\n input.addPiece(piece)\n (number_of_pieces - 1).times do |index|\n piece = piece.cloneWithNewID(initial_id + 1 + index)\n input.addPiece(piece)\n end\n end",
"def add_piece(piece, pos)\n self[pos] = piece.class.new(pos, self, piece.colour)\n end",
"def setup\n setup_major_pieces\n setup_pawns\n end",
"def set_pieces\n\t\t(0..7).each do |row|\n\t\t\tcase row\n\t\t\twhen 0\n\t\t\t\tplace_special_pieces(row, :white)\n\t\t\twhen 1\n\t\t\t\tplace_pawns(row, :white)\n\t\t\twhen 6\n\t\t\t\tplace_pawns(row, :black)\n\t\t\twhen 7\n\t\t\t\tplace_special_pieces(row, :black)\n\t\t\tend\n\t\tend\n\tend",
"def addPiece(piece)\n @pieces[@pieces.count] = piece\n end",
"def add_piece(coords, piece)\n @grid[coords[0]][coords[1]] = piece\n end",
"def build_blocks\n new_blocks = []\n current_rotated_blocks.each do |block|\n block_actor = @stage.create_actor :block,\n x: block[0] * BLOCK_SIZE + @falling_piece.x,\n y: block[1] * BLOCK_SIZE + @falling_piece.y,\n grid_offset_x: block[0],\n grid_offset_y: block[1],\n image: @falling_piece.image\n\n new_blocks << block_actor\n end\n # Destroy ourselves, leaving only the blocks behind\n @falling_piece.remove\n\n new_blocks\n end",
"def initial_piece_placements\n self.grid.each_with_index do |row, row_idx|\n row.each_with_index do |cell, cell_idx|\n pos = [row_idx, cell_idx]\n if pos.all? {|coord| coord.even?} || pos.all? {|coord| coord.odd?}\n if row_idx < 3\n self[pos] = Piece.new(self, pos, :white)\n elsif row_idx >= 5\n self[pos] = Piece.new(self, pos, :black)\n end\n end\n end\n end\n end",
"def initialize pieces=nil\n @squares = []\n for i in 0...64 do\n @squares[i] = Square.new \n end\n\n @pieces = pieces\n @pieces ||= createPieceHash\n @rules = ChessRules.new\n end",
"def place_initial_pieces\n x = @board.get_size/2\n y = @board.get_size/2\n \n @board.place_piece(x, y, @players[0])\n @board.place_piece(x - 1, y, @players[1])\n @board.place_piece(x, y - 1, @players[1])\n @board.place_piece(x -1, y - 1, @players[0])\n end",
"def add_piece(piece, pos)\n\n end",
"def make_pieces(first_position, color, rows, direction)\n switch = Hash[1, 0, 0, 1]\n start_column = first_position[1]\n start_row = first_position[0]\n num_pieces = size/2\n rows.times do |row_num|\n num_pieces.times do |col_num|\n col_num *= 2\n position = [start_row + (row_num * direction), start_column + col_num]\n Piece.new(position, self, color)\n end\n start_column = switch[start_column]\n end\n end",
"def place_special_pieces(row, color)\n\t\t@board[0][row].piece = Rook.new(color)\n\t\t@board[1][row].piece = Knight.new(color)\n\t\t@board[2][row].piece = Bishop.new(color)\n\t\t@board[3][row].piece = King.new(color)\n\t\t@board[4][row].piece = Queen.new(color)\n\t\t@board[5][row].piece = Bishop.new(color)\n\t\t@board[6][row].piece = Knight.new(color)\n\t\t@board[7][row].piece = Rook.new(color)\n\tend",
"def update_piece_information\n self.update_attributes({\n :vertical_pieces => @cutter.vertical_pieces, \n :horizontal_pieces => @cutter.horizontal_pieces, \n :vertical_piece_size => @cutter.real_piece_size, \n :horizontal_piece_size => @cutter.real_piece_size,\n :image_width => @cutter.image_width,\n :image_height => @cutter.image_height})\n end",
"def pieces\n list = []\n n = @data['info']['pieces'].bytesize / PIECE_SIZE\n n.times do |i|\n list << @data['info']['pieces'][(i * PIECE_SIZE)..(i * PIECE_SIZE + PIECE_SIZE - 1)]\n end\n list\n end",
"def assign_pieces(player)\n if player.num == 1\n piece_color = \"W\"\n else\n piece_color = \"B\"\n end\n\n @board.each do |row|\n row.each do |piece|\n \n if !piece.nil?\n if piece.color == piece_color\n player.pieces << piece\n piece.player = player\n end\n end\n end\n end \n end",
"def update_pieces(data)\n _pieces = pieces.map do |piece|\n _data = data.inject({}) do |tbl, (key, val)|\n tbl.tap {|x| x[key] = val.kind_of?(Proc) ? val.call(piece) : val}\n end\n piece.set(_data)\n end\n set(pieces: _pieces)\n end",
"def initialize\n @config = Outpost::Config.setup\n @squares = Outpost::Squares::Create.squares self\n reset_cycled_colors\n @pieces = Outpost::Piece::Create.pieces self\n setup_pieces\n end",
"def populate_board!\n # white pieces\n # creates the 8 pawn pieces across the board\n 8.times do |i|\n # sets game_id in Piece model to current id in Game\n # color is boolean - true for white, false for black\n Pawn.create(game_id: id, x_coord: i, y_coord: 1, color: true, captured: false)\n end\n # creates the 2 rook, knight, and bishop pieces on opposite sides of the board\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n\n Queen.create(game_id: id, x_coord: 3, y_coord: 0, color: true, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 0, color: true, captured: false)\n\n # black pieces\n 8.times do |i|\n Pawn.create(game_id: id, x_coord: i, y_coord: 6, color: false, captured: false)\n end\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n Queen.create(game_id: id, x_coord: 3, y_coord: 7, color: false, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 7, color: false, captured: false)\n end",
"def populate!()\n\n tile_factory = TileFactory.new()\n livingbeing_factory = LivingBeingFactory.new()\n\n @m.times do |y|\n @n.times do |x|\n\n # Water vs Ground\n location = Location.new(@n, @m, x, y)\n wg = tile_factory.create(Utils.generate_random_percentage(), location)\n\n if wg\n\n @tiles[x][y] = wg\n else\n\n raise StandardError.new(\"Incorrect Percentages less than 100\")\n end\n\n # If tile is Ground type...\n if @tiles[x][y].is_a?(Ground)\n \n lb = livingbeing_factory.create(Utils.generate_random_percentage())\n\n @tiles[x][y].livingbeing = lb if lb\n end\n end\n end\n\n self\n end",
"def add_pawn\r\n #White pawns\r\n (0..7).each do |col|\r\n pos = [6, col]\r\n \r\n self[pos] = Pawn.new(:white,rows,pos,:Wpawn)\r\n end\r\n\r\n #Black pawns\r\n (0..7).each do |col|\r\n pos = [1, col]\r\n \r\n self[pos] = Pawn.new(:black,rows,pos,:Bpawn)\r\n end\r\n\r\n end",
"def place_piece(piece, pos)\n self[pos] = piece\n end",
"def push(piece)\n set(pieces: pieces + [piece])\n end",
"def put(ps)\n @piece += ps\n self\n end",
"def initialize name, piece\n\t\t\t@name = name\n\t\t\t@piece = piece\n\t\tend",
"def initialize(setup)\n @grid = Array.new(8) { Array.new(8, nil)}\n\n if setup\n setup_pieces\n end\n end",
"def create_collections\n self.collections.each do |c|\n self.add_collection(c)\n end\n end",
"def create\n @piece = Piece.new(piece_params)\n @piece.user_id = current_user.id\n @piece.hidden = false\n @piece.featured = false\n\n respond_to do |format|\n if @piece.save\n format.html { redirect_to @piece, notice: 'Piece was successfully created.' }\n format.json { render :show, status: :created, location: @piece }\n else\n format.html { render :new }\n format.json { render json: @piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_piece klass, blk=nil, value=nil\r\n# puts \"building #{klass.name} with #{value.inspect}\"\r\n elem = value ? klass.new(value) : klass.new\r\n @parent << elem\r\n if blk\r\n parent = @parent\r\n @parent = elem\r\n blk.call\r\n @parent = parent\r\n end\r\n end",
"def create\n @piece = Piece.new(piece_params)\n\n respond_to do |format|\n if @piece.save\n format.html { redirect_to @piece, notice: 'Piece was successfully created.' }\n format.json { render :show, status: :created, location: @piece }\n else\n format.html { render :new }\n format.json { render json: @piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def starting_pieces(color)\n #8 pieces total\n i = (color == :white) ? [0,1] : [6,7]\n\n 8.times do |j| #build back row pieces\n if (j+i[0]).odd?\n c = Piece.new(color, [i[0],j])\n @pieces << c\n end\n end\n\n 8.times do |j| #build front row pieces\n if (j+i[0]).even?\n c = Piece.new(color, [i[1],j])\n @pieces << c\n end\n end\n end",
"def generate_pieces(trim: true)\n piece_matrixes = []\n\n while matrix.any? { |v| v == false }\n piece_matrix = Matrix3D.from_dimensions(width, height, depth, false)\n next_piece_index = piece_matrixes.size\n\n # Get initial position\n coords = find_initial_coordinates\n\n piece_matrix.set(*coords, true)\n # Record the piece index in the matrix. Makes it easier\n # to merge small pieces into adjacent pieces.\n matrix.set(*coords, next_piece_index)\n unblocked_positions = []\n add_new_position(unblocked_positions, coords)\n\n piece_length = 1\n\n while piece_length <= max_length && unblocked_positions.any?\n # Use the most recent block 70% of the time\n # Actually it looks much cooler if we do this 100% of the time.\n position_index = unblocked_positions.size - 1\n # if rng.rand(10) < 7\n # unblocked_positions.size - 1\n # else\n # unblocked_positions.size.times.to_a.sample(random: rng)\n # end\n position = unblocked_positions[position_index]\n # Update the available moves\n position[:available_moves] = available_moves(position[:coords], matrix)\n if position[:available_moves].empty?\n # No available moves, so delete this position\n unblocked_positions.delete_at(position_index)\n next\n end\n\n # Pick a random move\n x, y, z = position[:available_moves].sample(random: rng)\n piece_matrix.set(x, y, z, true)\n matrix.set(x, y, z, next_piece_index)\n add_new_position(unblocked_positions, [x, y, z])\n piece_length += 1\n end\n\n piece_matrixes << piece_matrix\n end\n\n # Merge small pieces into adjacent pieces\n loop do\n piece_index = piece_matrixes.find_index do |m|\n m && m.count { |v| v == true } < min_length\n end\n break unless piece_index\n\n piece_matrix = piece_matrixes[piece_index]\n\n # Choose a random piece with an adjacent block\n directions = [\n [0, 1], [1, 1], [2, 1], [0, -1], [1, -1], [2, -1]\n ]\n loop do\n raise 'Directions should never be empty!' if directions.empty?\n\n direction = directions.sample(random: rng)\n directions.delete(direction)\n\n # puts \"Direction: #{direction}\"\n\n coord = piece_matrix.find_coord { |v| v == true }.map(&:dup)\n\n # puts \"Coordinate: #{coord}\"\n\n adjacent_piece_index = piece_index\n loop do\n coord[direction[0]] += direction[1]\n # puts \"==========> #{coord}\"\n\n # Keep going until we hit the boundary\n break unless matrix.within_bounds?(*coord)\n\n adjacent_piece_index = matrix.get(*coord)\n\n # Keep going until we leave this piece\n break if adjacent_piece_index != piece_index\n end\n\n next if adjacent_piece_index == piece_index\n\n adjacent_piece = piece_matrixes[adjacent_piece_index]\n\n # Add this piece's blocks to the adjacent piece\n piece_matrix.each do |value, xa, ya, za|\n next unless value == true\n\n adjacent_piece.set(xa, ya, za, true)\n\n # Update the index in the main matrix\n matrix.set(xa, ya, za, adjacent_piece_index)\n end\n\n break\n end\n\n # Important - Don't delete the pieces! This screws up the\n # indexes in the matrix. Just set them to nil\n piece_matrixes[piece_index] = nil\n end\n\n piece_matrixes.each do |pm|\n next if pm.nil?\n\n unless trim\n pieces << [[0, 0, 0], pm]\n next\n end\n\n # Trim the matrix down to the minimum size.\n trim_result = pm.trim(true)\n\n # Use the offset as the piece position\n pieces << [trim_result[:offset], trim_result[:matrix]]\n end\n\n # binding.pry\n\n pieces\n end",
"def place_pawns\r\n $board.each_index do |x|\r\n $board[x][1] = Pawn.new('white')\r\n $board[x][6] = Pawn.new('black')\r\n end\r\n end",
"def calculate_ghost_piece\n # Duplicate the oiece that is in play\n @ghost_piece = @in_play.class.new(@object_array, @window)\n @ghost_piece.position[:x] = @in_play.position[:x]\n @ghost_piece.position[:y] = @in_play.position[:y]\n\n # Change the values of the ghost piece array so that the opacity color can be applied\n @ghost_piece.object_array = @in_play.object_array.map do |row|\n row.map { |cell| cell.zero? ? 0 : cell + 10 }\n end\n\n # Move the ghost piece down as far as it can go\n @ghost_piece.hard_drop(main_piece: false)\n end",
"def << part\n @parts << part\n end",
"def create\n @artpiece = Artpiece.new(params[:artpiece])\n @artist = Artist.find(params[:artpiece][:artist_id])\n @artist.artpieces << @artpiece\n\n if @artpiece.save\n @image_name = \"#{sprintf(\"%03d\", @artpiece.id)}.jpg\"\n @directory = \"public/images/artcat/pieces\"\n # create the file path\n @path = File.join(@directory, @image_name)\n # write the file\n File.open(@path, \"wb\") { |f| f.write(params[:picture].read) }\n redirect_to(@artist, :notice => 'Artpiece was successfully created.')\n end\n end",
"def draw_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n @pieces[x][y] = draw_piece(x,y,@board.state[x][y]) unless @board.state[x][y].nil?\n end\n end\nend",
"def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end",
"def build\n \n data = heading(:css_location => \"css/html-cutlist.css\").to_s\n \n data += page_title().to_s\n \n # Get all the parts in an array of part hashes.\n all_parts = @parts.grouped\n\n # # Sort parts.\n # all_parts = all_parts.sort { |a, b|\n # a['material'] <=> b['material']\n # # a['thickness'] <=> b['thickness']\n # # a['width'] <=> b['width']\n # # a['length'] <=> b['length']\n # }\n\n # Create an empty array of materials.\n materials = []\n\n # Put all the materials in the list\n all_parts.each { |p|\n materials.push(p['material']) \n }\n\n # Make sure there is only one of each material.\n materials = materials.uniq\n\n # Create a blank hash to put sorted parts into.\n grouped_parts = {}\n\n # Create a new list of hashes that represent the material and then the parts \n # that are of that material (a blank hash).\n materials.each { |m| \n grouped_parts[m] = {}\n }\n\n # Loop through each part, adding it to the right key in the sorted_list.\n all_parts.each { |p| \n\n # Go through the list of materials.\n materials.each { |m|\n\n if p['material'] == m\n \n # If the \"round_dimensions\" setting is on, round the dimension to \n # three decimal places so we don't have a lot of entries in the \n # grouped_parts list like \"3.750000001\", \"3.750000002\", etc... but \n # instead have one entry like \"3.750\". This way grouping behaves \n # as expected.\n rounded_thickness = @options['round_dimensions'] ? format(\"%0.3f\", p['thickness']).to_f : p['thickness']\n \n # Check to see if there is a key for this thickness and if there is \n # append the part to the array of parts.\n if grouped_parts[m][rounded_thickness]\n grouped_parts[m][rounded_thickness] += [p]\n # If there isn't a key for this thickness, create it now and add the \n # part array.\n else\n grouped_parts[m][rounded_thickness] = [p]\n end\n\n end\n\n }\n\n }\n \n # Sort by materials.\n parts_by_material = grouped_parts.sort { |a,b|\n a[0] <=> b[0]\n }\n\n # List all the parts, grouped.\n parts_by_material.each { |t| # t for thickness.\n\n # Sort thicknesses.\n parts_by_thickness = t[1].sort { |a,b|\n a[0] <=> b[0]\n }\n parts_by_thickness.reverse!\n\n # Go through each thickness key.\n parts_by_thickness.each { |p| # p for parts\n\n # Sort parts by width, then length.\n parts = p[1].sort { |a,b|\n a['width'] <=> b['width']\n # TODO: Get sub-sorting by length.\n # a['length'] <=> b['length']\n }\n parts.reverse!\n \n # Create a parts array to store the parts in.\n parts_array = []\n \n # Go through the parts that are of a specific thickness.\n parts.each { |part| \n \n # Check if part is a sheet good.\n if @options[\"show_sheets\"] && part['is_sheet']\n parts_array.push(part)\n end\n\n # Check if part is solid stock.\n if @options[\"show_solids\"] && part['is_solid']\n parts_array.push(part)\n end\n\n # Check if part is hardware.\n if @options[\"show_hardware\"] && part['is_hardware']\n parts_array.push(part)\n end\n # puts \"#{p['sub_assembly']} -- #{p['part_name']} -- #{p['quantity']} -- #{p['material']} -- Sheet? #{p['is_sheet']} -- Solid? #{p['is_solid']} -- Hardware? #{p['is_hardware']} -- #{p['width']} x #{p['length']} x #{p['thickness']}\"\n \n }\n \n # If there are items in the parts_array, then add the section heading \n # and the array of parts. If there are no parts, show nothing.\n if parts_array.length != 0\n data += section_heading(\"#{p[0].to_fraction(true)} #{t[0]}\")\n data += rows(parts_array)\n end\n \n # TODO: Put section footer here, if needed...\n \n }\n }\n \n data += footer().to_s\n \n # Return the results.\n data\n \n end",
"def populate_board\n black = \"black\"\n white = \"white\"\n\n white_pawns = [\"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\"]\n black_pawns = [\"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\"]\n\n # create white pawns\n white_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(white, pos)\n end\n\n # create white pieces\n @board.nodes[\"E1\"].piece = create_king(white, \"E1\")\n @board.nodes[\"D1\"].piece = create_queen(white, \"D1\")\n @board.nodes[\"C1\"].piece = create_bishop(white, \"C1\")\n @board.nodes[\"F1\"].piece = create_bishop(white, \"F1\")\n @board.nodes[\"B1\"].piece = create_knight(white, \"B1\")\n @board.nodes[\"G1\"].piece = create_knight(white, \"G1\")\n @board.nodes[\"A1\"].piece = create_rook(white, \"A1\")\n @board.nodes[\"H1\"].piece = create_rook(white, \"H1\")\n\n # create black pawns\n black_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(black, pos)\n end\n\n # create black pieces\n @board.nodes[\"E8\"].piece = create_king(black, \"E8\")\n @board.nodes[\"D8\"].piece = create_queen(black, \"D8\")\n @board.nodes[\"C8\"].piece = create_bishop(black, \"C8\")\n @board.nodes[\"F8\"].piece = create_bishop(black, \"F8\")\n @board.nodes[\"B8\"].piece = create_knight(black, \"B8\")\n @board.nodes[\"G8\"].piece = create_knight(black, \"G8\")\n @board.nodes[\"A8\"].piece = create_rook(black, \"A8\")\n @board.nodes[\"H8\"].piece = create_rook(black, \"H8\")\n\n end",
"def assign_next_piece\n # Remove the current next_piece from the 'bag' so that it canot be selected again\n @pieces -= [@next_piece]\n\n # Re-populate the pieces array if it becones empty\n @pieces = [IPiece, JPiece, LPiece, OPiece, SPiece, TPiece, ZPiece] if @pieces.length.zero?\n\n # Assign new current piece and randomly select next piece from pieces array\n @current_piece = @next_piece\n @next_piece = @pieces.sample\n end",
"def create\n @content_piece = ContentPiece.new(params[:content_piece])\n\n respond_to do |format|\n if @content_piece.save\n format.html { redirect_to @content_piece, notice: 'Content piece was successfully created.' }\n format.json { render json: @content_piece, status: :created, location: @content_piece }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_piece(piece,x,y) \n piece.points.each { |point| \n #puts \"Inserting #{point[0]},#{point[1]} to #{x},#{y}\" \n @pole[x+point[0]][y-point[1]] = piece.name\n }\n end",
"def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end",
"def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end",
"def piece_finished\n blocks = build_blocks\n blocks.each do |block|\n @field[\n @falling_piece.grid_position.y + block.grid_offset_y\n ][\n @falling_piece.grid_position.x + block.grid_offset_x\n ] = block\n end\n\n new_piece\n check_row_removal\n end",
"def setup( )\n\t\t\t(\"a\"..\"h\").each do |f|\n\t\t\t\t@squares[\"#{f}2\"] = Chess::Pawn.new(self, \"#{f}2\", :white)\n\t\t\t\t@squares[\"#{f}7\"] = Chess::Pawn.new(self, \"#{f}7\", :black)\n\t\t\tend\n\t\t\t[\"a\", \"h\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Rook.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Rook.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t[\"b\", \"g\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Knight.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Knight.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t[\"c\", \"f\"].each do |f|\n\t\t\t\t@squares[\"#{f}1\"] = Chess::Bishop.new(self, \"#{f}1\", :white)\n\t\t\t\t@squares[\"#{f}8\"] = Chess::Bishop.new(self, \"#{f}8\", :black)\n\t\t\tend\n\t\t\t@squares[\"d1\"] = Chess::Queen.new(self, \"d1\", :white)\n\t\t\t@squares[\"d8\"] = Chess::Queen.new(self, \"d8\", :black)\n\t\t\t@squares[\"e1\"] = Chess::King.new(self, \"e1\", :white)\n\t\t\t@squares[\"e8\"] = Chess::King.new(self, \"e8\", :black)\n\t\tend",
"def make_and_populate_collection(samples, collection_type: nil,\n first_collection: nil,\n add_column_wise: false,\n label_plates: false)\n\n if collection_type.nil? && first_collection.nil?\n ProtocolError 'Either collection_type or first_collection must be given'\n end\n\n unless collection_type.nil? || first_collection.nil?\n ProtocolError 'Both collection_type and first_collection cannot be given'\n end\n\n capacity = nil\n if collection_type.nil?\n collection_type = first_collection.object_type.name\n capacity = first_collection.capacity\n remaining_space = first_collection.get_empty.length\n add_samples_to_collection(samples[0...remaining_space - 1],\n first_collection,\n label_plates: label_plates,\n add_column_wise: add_column_wise)\n samples = samples.drop(remaining_space)\n else\n obj_type = ObjectType.find_by_name(collection_type)\n capacity = obj_type.columns * obj_type.rows\n end\n\n collections = []\n collections.push(first_collection) unless first_collection.nil?\n grouped_samples = samples.in_groups_of(capacity, false)\n grouped_samples.each do |sub_samples|\n collection = make_new_plate(collection_type, label_plate: label_plates)\n add_samples_to_collection(sub_samples, collection, \n add_column_wise: add_column_wise)\n collections.push(collection)\n end\n collections\n end",
"def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end",
"def place_piece(piece, pos)\n raise 'position not empty' unless empty?(pos)\n \n self[pos] = piece\n end",
"def add_pools(collection:, pooling_groups:)\n microtiter_plate = MicrotiterPlateFactory.build(\n collection: collection,\n group_size: 1,\n method: :row_wise\n )\n add_provenance(\n microtiter_plate: microtiter_plate,\n pooling_groups: pooling_groups\n )\n end",
"def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def populate_board(board)\n #Fills in the top and bottom rows\n [0, 7].each do |row|\n 4.times do |col|\n board[row][col] = create_piece(row, col)\n board[row][(7-col)] = create_piece(row, (7-col))\n end\n end\n\n #Fills in the pawns\n 8.times do |col|\n board[1][col] = BlackPawn.new(1, col)\n board[6][col] = WhitePawn.new(6, col)\n end\n\n board\n end",
"def create_cards\r\n @cards.each{|e| e.create}\r\n @symbols_card.each{|e| e.create}\r\n @cards_rotated.each{|e| e.create}\r\n end",
"def initialize\n @piece_count = 0\n\n @grid = []\n (0..6).each do |col|\n @grid[col] = []\n (0..5).each do |row|\n @grid[col][row] = \"-\"\n end\n end\n end",
"def initialize(color)\n @color = color\n # hash of all pieces and their current positions\n @player_piece_set = Hash.new(0)\n @pieces = Hash.new\n\n # assign each player a full set of pieces\n end",
"def initialize\n @coordinates = Array.new(2)\n @piece = nil\n end",
"def many &blk\r\n build_piece AnyNumber, blk\r\n end",
"def dup\n empty_board = Board.new(false)\n pieces.each do |piece|\n temp_color = (piece.color == :red) ? :red : :white\n temp_pos = [piece.pos[0], piece.pos[1]]\n temp_kinged = piece.kinged\n temp_piece = Piece.new(empty_board, temp_color, temp_pos, temp_kinged)\n\n # empty_board.add_piece(Piece.new(empty_board, temp_color, temp_pos, temp_kinged), temp_pos)\n end\n\n empty_board\n # duped_rows = rows.map(&:dup)\n #\n # duped_rows.each_with_index do |row, row_idx|\n # row.each_index do |col_idx|\n # next if duped_rows[row_idx].nil?\n # current_cell = duped_rows[row_idx][col_idx]\n #\n # next if current_cell.nil?\n # duped_rows[row_idx][col_idx] = current_cell.dup\n # end\n # end\n # duped_board = self.class.new(duped_rows, false)\n # duped_board.pieces.each do |piece|\n # piece.board = duped_board\n # end\n # duped_board\n\n end",
"def dup\n duped_board = Board.new(false)\n\n figures.each do |piece|\n duped_board[piece.position] = piece.class.new(duped_board, piece.color, piece.position.dup)\n end\n\n duped_board\n end",
"def test_pieces\n @board = MyTestBoard.new\n \n all_test_pieces = [[[[0, 0], [1, 0], [0, 1], [1, 1]]], # square (only needs one)\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [0, -1]]), # T\n [[[0, 0], [-1, 0], [1, 0], [2, 0]], # long (only needs two)\n [[0, 0], [0, -1], [0, 1], [0, 2]]],\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [1, 1]]), # L\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [-1, 1]]), # inverted L\n MyPiece.rotations([[0, 0], [-1, 0], [0, -1], [1, -1]]), # S\n MyPiece.rotations([[0, 0], [1, 0], [0, -1], [-1, -1]]), # Z\n MyPiece.rotations([[0, 0], [1, 0], [0, 1], [1, 1], [1, 2]]), # ::.\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [2, 0], [3, 0]]), # .....\n MyPiece.rotations([[0, 0], [1, 0], [1, 1]])] # .:\n\n all_pieces_rotations = [] \n\n # get all the individual rotations into an array\n (0..all_test_pieces.size-1).each { |oi| \n all_pieces_rotations += all_test_pieces[oi]\n }\n \n # get a new piece with a specific rotation and delete it\n (0..1000).each { |index| \n @piece = MyPiece.next_piece(@board)\n all_pieces_rotations.delete(@piece.current_rotation)}\n\n # all pieces have been generated and deleted\n assert_equal([], all_pieces_rotations)\n\n # same for the cheating piece\n cheat_piece = MyPiece.rotations([[0, 0]]) # .\n @piece = MyPiece.cheat_next_piece(@board)\n cheat_piece.delete(@piece.current_rotation)\n assert_equal([], cheat_piece)\n end",
"def add_piece(piece,position)\n\t\tposition_grille = convert_position_to_array(position)\n\t\tx = position_grille[0]\n\t\ty = position_grille[1]\n\t\t@board[x][y] = piece\n\t\t@coordinate = [x,y]\n\tend",
"def addPiece(piece)\n if piece.instance_of?(Piece) && @piece == nil\n @piece = piece\n @piece.location = self\n return true\n end\n false\n end",
"def make_children(depth_layer)\n @childless.each do |node|\n coords = generate_children_coordinates(node.x, node.y)\n coords.each do |x,y|\n child = Move.new(x,y,depth_layer,[],node)\n node.children ||= []\n node.children << child\n @node_count += 1\n end\n end\n #generate coordinates for children\n #creates child nodes with child coordinates, appropriate depth attribute, appropriate parent node attribute)\n end",
"def populate_board\n back_row = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n\n black_back_row = []\n back_row.each_with_index do |piece_class, j|\n black_back_row << piece_class.new(self, :black, [0, j])\n end\n board[0] = black_back_row\n \n black_front_row = []\n (0..7).each {|idx| black_front_row << Pawn.new(self, :black, [1, idx])}\n board[1] = black_front_row\n \n (2..5).each do |row|\n board[row] = Array.new(8) {NullPiece.instance} \n end\n \n white_front_row = []\n 8.times {|idx| white_front_row << Pawn.new(self, :white, [6, idx])}\n board[6] = white_front_row\n \n white_back_row = []\n back_row.each_with_index do |piece_class, j|\n white_back_row << piece_class.new(self, :white, [7, j])\n end\n board[7] = white_back_row\n end",
"def put_pawns\n row = 1\n color = \"w\"\n 2.times do\n @@board[row].each_index do |i|\n @@board[row][i] = Pawn.new(i, row, color)\n end\n row = 6\n color = \"b\"\n end\n end",
"def allocate(parts); end",
"def test_init\n #@board[0][5].piece = Bishop.new(@board[0][5], \"♗\", \"white\")\n @board[0][4].piece = King.new(@board[0][4], \"♔\", 'white')\n\n @board[7][4].piece = Queen.new(@board[7][4], \"♛\", \"black\" )\n @board[7][3].piece = Rook.new(@board[7][3], \"♜\", \"black\")\n @board[7][5].piece = Rook.new(@board[7][5], \"♜\", \"black\")\n end",
"def populate\n black = [\n Rook.new(:black, self, [0,0], \" ♜ \"),\n Knight.new(:black, self, [0,1], \" ♞ \"),\n Bishop.new(:black, self, [0,2], \" ♝ \"),\n Queen.new(:black, self, [0,3], \" ♛ \"),\n King.new(:black, self, [0,4], \" ♚ \"),\n Bishop.new(:black, self, [0,5], \" ♝ \"),\n Knight.new(:black, self, [0,6],\" ♞ \"),\n Rook.new(:black, self, [0,7], \" ♜ \")\n ]\n white = [\n Rook.new(:white, self, [7,0], \" ♖ \"),\n Knight.new(:white, self, [7,1], \" ♘ \"),\n Bishop.new(:white, self, [7,2], \" ♗ \"),\n Queen.new(:white, self, [7,3], \" ♕ \"),\n King.new(:white, self, [7,4], \" ♔ \"),\n Bishop.new(:white, self, [7,5], \" ♗ \"),\n Knight.new(:white, self, [7,6], \" ♘ \"),\n Rook.new(:white, self, [7,7], \" ♖ \")\n ]\n\n @grid.each_with_index do |row, i|\n row.each_with_index do |column, j|\n pos = [i, j]\n if i == 0\n self[pos]= black[j]\n @black_pieces << black[j]\n elsif i == 7\n self[pos]= white[j]\n @white_pieces << white[j]\n elsif i == 1\n black_pawn = Pawn.new(:black, self, pos, \" ♟ \")\n self[pos]= black_pawn\n @black_pieces << black_pawn\n elsif i == 6\n white_pawn = Pawn.new(:white, self, pos, \" ♙ \")\n self[pos] = white_pawn\n @white_pieces << white_pawn\n end\n end\n end\n\n @grid\n end",
"def create_piece(row, col)\n if col == 0 || col == 7\n return Rook.new(row, col, row)\n elsif col == 1 || col == 6\n return Knight.new(row, col, row)\n elsif col == 2 || col == 5\n return Bishop.new(row, col, row)\n elsif col == 4\n return King.new(row, col, row)\n else\n return Queen.new(row, col, row)\n end\n end",
"def create_one(test_detail)\n j= test_detail.part_count - 1\n for i in 0..j\n balloon = Balloon.new\n balloons << balloon\n balloon.bart = self\n balloon.save\n end\n end",
"def add_to_cell(piece)\n cell = read_cell(piece.x, piece.y)\n cell.push(piece)\n end",
"def place_piece(piece)\n piece.piece_cells.each_with_index do |row, j|\n row.each_with_index do |cell, i|\n @cells[piece.y + j][piece.x + i] = 1 if cell == 1\n end\n end\n end",
"def create_children\n @moves.each do |i|\n if @children.include?(i) == false && !i.nil?\n tmp = Knight.new(i)\n @children.push(tmp)\n end\n end\n @children\n end",
"def piece_params\n params.require(:piece).permit(:name, :type, :description, :price, :image_url)\n end",
"def compact_pieces\n @recheck = false\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j+1].nil? #drop pieces down\n @recheck = true\n @board[i][j+1] = @board[i][j]\n @board[i][j] = nil \n elsif j == 0 and @board[i][j].nil? #replace pieces at top\n @recheck = true\n @board[i][j] = Piece.new\n end\n end\n end\n if @startup and @recheck #fast setup of board before update + anim loops start\n compact_pieces\n clear_matches\n end \n end",
"def make_and_populate_collection(samples, collection_type: nil,\n first_collection: nil,\n label_plates: false)\n\n if collection_type.nil? && first_collection.nil?\n ProtocolError 'Either collection_type or first_collection must be given'\n end\n\n unless collection_type.nil? || first_collection.nil?\n raise 'Both collection_type and first_collection cannot be given'\n end\n\n capacity = nil\n if collection_type.nil?\n collection_type = first_collection.object_type.name\n capacity = first_collection.capacity\n remaining_space = first_collection.get_empty.length\n add_samples_to_collection(samples[0...remaining_space - 1],\n first_collection)\n samples = samples.drop(remaining_space)\n else\n obj_type = ObjectType.find_by_name(collection_type)\n raise collection_type.to_s unless obj_type.present?\n capacity = obj_type.columns * obj_type.rows\n end\n\n collections = []\n collections.push(first_collection) unless first_collection.nil?\n grouped_samples = samples.in_groups_of(capacity, false)\n grouped_samples.each do |sub_samples|\n collection = make_new_plate(collection_type, label_plate: label_plates)\n add_samples_to_collection(sub_samples, collection)\n collections.push(collection)\n end\n collections\n end",
"def dup_board\n new_board = Board.new(false)\n self.grid.each_with_index do |row, i|\n row.each_with_index do |object, j|\n pos = [i, j]\n if object.nil?\n new_board[pos] = nil\n else\n new_board[pos] = Piece.new(object.color, pos, new_board)\n end\n end\n end\n\n new_board\n end",
"def put(square, piece)\n remove(square)\n\n @pieces[square] = piece.piece_type\n\n mask = BB_SQUARES[square]\n\n if piece.piece_type == PAWN\n @pawns = @pawns | mask\n elsif piece.piece_type == KNIGHT\n @knights = @knights | mask\n elsif piece.piece_type == BISHOP\n @bishops = @bishops | mask\n elsif piece.piece_type == ROOK\n @rooks = @rooks | mask\n elsif piece.piece_type == QUEEN\n @queens = @queens | mask\n elsif piece.piece_type == KING\n @kings = @kings | mask\n @king_squares[piece.color] = square\n end\n\n @occupied = @occupied ^ mask\n @occupied_co[piece.color] = @occupied_co[piece.color] ^ mask\n @occupied_l90 = @occupied_l90 ^ BB_SQUARES[SQUARES_L90[square]]\n @occupied_r45 = @occupied_r45 ^ BB_SQUARES[SQUARES_R45[square]]\n @occupied_l45 = @occupied_l45 ^ BB_SQUARES[SQUARES_L45[square]]\n\n # Update incremental zorbist hash.\n if piece.color == BLACK\n piece_index = (piece.piece_type - 1) * 2\n else\n piece_index = (piece.piece_type - 1) * 2 + 1\n end\n\n @incremental_zobrist_hash = @incremental_zobrist_hash ^ Zobrist::POLYGLOT_RANDOM_ARRAY[64 * piece_index + 8 * rank_index(square) + file_index(square)]\n end",
"def create\n @art_piece = ArtPiece.new(params[:art_piece])\n\n respond_to do |format|\n if @art_piece.save\n format.html { redirect_to @art_piece, notice: 'Art piece was successfully created.' }\n format.json { render json: @art_piece, status: :created, location: @art_piece }\n else\n format.html { render action: \"new\" }\n format.json { render json: @art_piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw_board_start\n #Places the pawns\n 8.times do |x|\n @b[x][1] = @WP\n @b[x][6] = @BP\n end\n #white, on bottom, the opaque pieces\n @b[0][0] = @WR; @b[7][0] = @WR\n @b[1][0] = @WK; @b[6][0] = @WK\n @b[2][0] = @WB; @b[5][0] = @WB\n @b[3][0] = @WQ\n @b[4][0] = @WKg\n #black, on top, the filled in pieces\n @b[0][7] = @BR; @b[7][7] = @BR\n @b[1][7] = @BK; @b[6][7] = @BK\n @b[2][7] = @BB; @b[5][7] = @BB\n @b[3][7] = @BQ\n @b[4][7] = @BKg\n \n #TESTING PIECES HERE\n\n\n draw_board\n end",
"def push *parts\n self.parts.concat parts\n end",
"def next_piece\n if @cheat then\n @current_block = MyPiece.new([[[0,0]]],self)\n @cheat = false\n else\n @current_block= MyPiece.next_piece(self)\n end\n @current_pos = nil\n end",
"def initialize(piece_groups)\n raise \"array expected\" unless piece_groups.is_a?(Array)\n first_element = piece_groups.first\n raise \"nested array expected\" unless first_element == nil || first_element.is_a?(Array)\n @piece_groups = piece_groups\n end",
"def create_representation(pieces_position_list)\n arr = (0..6).to_a.map { |x| [] }\n positions = ('A'..'G').to_a.each_with_index.reduce({}) { |x, i| x.merge(Hash[*i]) }\n pieces_position_list.reduce(arr) do |x, m|\n (pos, color) = m.split(\"_\")\n arr[positions[pos]] << color\n arr\n end\nend",
"def board_dup\n new_board = Board.new(true)\n\n pieces_and_empties.each do |piece|\n x, y = piece.pos\n new_board.board[x][y] = piece.class.new(new_board, piece.color, piece.pos)\n end\n # debugger\n new_board\n end",
"def make_children\n possible = []\n possible.push([@x+2, @y+1]).push([@x+2, @y-1]).push([@x+1, @y+2]).\n push([@x+1, @y-2]).push([@x-1, @y+2]).push([@x-1, @y-2]).\n push([@x-2, @y+1]).push([@x-2, @y-1])\n\n children = possible.select { |coord| coord[0] >= 0 && coord[0] <= 7 && coord[1] >= 0 && coord[1] <= 7 }\n\n children = children.map { |coord| Square.new(coord[0], coord[1], self) }\n @children = children\n end",
"def create_graphics\n create_viewport\n create_background\n create_pokemon_sprite\n create_egg_sprite\n end",
"def create\n @inventory_piece = InventoryPiece.new(inventory_piece_params)\n\n respond_to do |format|\n if @inventory_piece.save\n format.html { redirect_to @inventory_piece, notice: 'Inventory piece was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_piece }\n else\n format.html { render :new }\n format.json { render json: @inventory_piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def compose new_collection, *collections, &block\n @@graph.add(new_collection, collections, operation: :compose, &block)\n end",
"def create\n @gallery_piece = GalleryPiece.new(gallery_piece_params)\n\n respond_to do |format|\n if @gallery_piece.save\n format.html { redirect_to @gallery_piece, notice: 'Gallery piece was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gallery_piece }\n else\n format.html { render action: 'new' }\n format.json { render json: @gallery_piece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def distribute_pieces(move)\n stack = pieces_at(*move.origin).pop(move.size)\n\n move.coordinates.each do |(x, y)|\n @board[x][y].push(stack.pop)\n end\n\n true\n end"
] |
[
"0.7112517",
"0.7023218",
"0.693004",
"0.6795472",
"0.66683185",
"0.6631119",
"0.65143687",
"0.6312446",
"0.6307387",
"0.62863356",
"0.62477255",
"0.6214159",
"0.6166898",
"0.6122845",
"0.6111234",
"0.6048086",
"0.6046464",
"0.58704525",
"0.5864113",
"0.5790549",
"0.5783542",
"0.5776553",
"0.5738392",
"0.5727079",
"0.571759",
"0.5713675",
"0.5670777",
"0.5650571",
"0.5644645",
"0.5631541",
"0.56215996",
"0.558706",
"0.55587643",
"0.5528171",
"0.55262357",
"0.55253655",
"0.5507166",
"0.5493392",
"0.5488615",
"0.5486537",
"0.5471085",
"0.5444046",
"0.5429867",
"0.54279685",
"0.54010713",
"0.5397842",
"0.5397519",
"0.5373054",
"0.53510773",
"0.53488266",
"0.53485423",
"0.53477955",
"0.5344475",
"0.5341135",
"0.5337503",
"0.5318235",
"0.5308104",
"0.530326",
"0.5301235",
"0.5287977",
"0.52869767",
"0.5284751",
"0.52707416",
"0.52591807",
"0.525695",
"0.5255852",
"0.5251819",
"0.5250209",
"0.5248798",
"0.5248371",
"0.5244459",
"0.5232812",
"0.522964",
"0.5228561",
"0.5228144",
"0.52277094",
"0.52255666",
"0.5224464",
"0.5222565",
"0.52212256",
"0.5220166",
"0.5219869",
"0.5218886",
"0.52117646",
"0.52070194",
"0.5204914",
"0.52037793",
"0.519853",
"0.5194038",
"0.5191031",
"0.5185925",
"0.5183403",
"0.51809746",
"0.5162197",
"0.51581454",
"0.51565",
"0.5156122",
"0.51543796",
"0.51524043",
"0.51494867",
"0.5139175"
] |
0.0
|
-1
|
A pull request has been closed
|
def process_closed_pull_request(pull_request)
pr_name = pull_request['base']['repo']['full_name'].to_s
pr_number = pull_request['number'].to_s
pr_key = pr_name + ":" + pr_number
current_commit_hash = pull_request['head']['sha'].to_s
# Delete the PR from the redis store
@redis.del(pr_key)
return 200
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_name + \":\" + pr_number)\n return 200\n end",
"def close_pull_request(repo, number, options = {})\n options.merge! :state => 'closed'\n update_pull_request(repo, number, options)\n end",
"def close_pull(repo, pull_number, options = {})\n options[:state] = 'closed'\n patch \"#{Repository.path repo}/pulls/#{pull_number}\", options\n end",
"def close(number)\n request = get_request_by_number(number)\n repo = github.source_repo\n github.close_issue(repo, request.number)\n unless github.request_exists?('open', request.number)\n puts 'Successfully closed request.'\n end\n end",
"def open_pull_request\n outgoing_pull_requests.find(&:open?)\n end",
"def reopen_pull(repo, pull_number, options = {})\n options[:state] = 'open'\n patch \"#{Repository.path repo}/pulls/#{pull_number}\", options\n end",
"def alert_reserved_and_exit\n cli.say \"The current branch #{config.github_repo}/#{git.current_branch} is a reserved branch and can not have pull requests.\"\n exit 1\n end",
"def destroy\n @pullRequest = PullRequest.find(params[:id])\n\n\t\t@pullRequest.status = \"REJECTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while rejecting the pull request\"}\n end\n end",
"def reject_unauth_pr(pull_comments_url,pull_url,pull_branch)\n return if pull_branch == @auth_branch\n # Add reason for rejection as comment on PR\n add_pr_comment(pull_comments_url,\"Pull requests are only allowed on the #{@auth_branch} branch.\")\n\n # Close PR\n url = pull_url\n payload = {state: 'closed'}\n RestClient.post(\n url,\n payload.to_json,\n @git_headers\n )\n halt 401, \"Pull requests are only allowed on the #{@auth_branch} branch.\"\n end",
"def leave_failure_comment\n most_recent_comment = @pull_request.comments.last || Curry::PullRequestComment.new\n potential_comment = @pull_request.comments.new(\n unauthorized_commit_authors: unauthorized_commit_emails_and_logins\n )\n\n if potential_comment.mentioned_commit_authors != most_recent_comment.mentioned_commit_authors\n @octokit.add_comment(\n @repository.full_name,\n @pull_request.number,\n failure_message\n ).tap do |comment|\n potential_comment.github_id = comment.id\n potential_comment.save!\n end\n else\n most_recent_comment.touch\n end\n end",
"def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end",
"def closed_pull_requests(github_api)\n closed_pull_requests = github_api.pull_requests(full_name, state: 'closed')\n closed_pull_requests.collect do |pr|\n\n was_merged = !!(pr['merged_at'])\n closed = (pr['state'] == 'closed')\n open_time = Chronic.parse(pr['created_at'].to_s).to_time\n close_time = Chronic.parse(pr['closed_at'].to_s).to_time\n\n user = pr['user']\n # Ensure that the user exists before trying to continue\n next unless user\n login = user['login']\n from_community = !(github_api.organization_member?('puppetlabs', login))\n\n Hash[\"pr_number\" => pr['number'],\n \"repo_name\" => name,\n \"repo_owner\" => owner,\n \"merge_status\" => was_merged,\n \"time_closed\" => close_time,\n \"time_opened\" => open_time,\n \"from_community\" => from_community,\n \"closed_v_open\" => closed]\n end\n end",
"def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end",
"def merge_requests_closing_issue_on_merge(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}/closed_by\")\n end",
"def pull_request(branch_name, m = nil)\n Retryable.do { api.pull_requests.list(api.user, api.repo) }.find { |pr| pr[\"head\"][\"ref\"] == branch_name }\n rescue Github::Error::ResourceNotFound\n if m\n m.user.msg \"sorry, but an error occurred while fetching your pull request\"\n end\n end",
"def fetch_closed_pull_requests\n pull_requests = []\n options = { state: \"closed\" }\n\n page_i = 0\n count_pages = calculate_pages(@client, \"pull_requests\", options)\n\n iterate_pages(@client, \"pull_requests\", options) do |new_pr|\n page_i += PER_PAGE_NUMBER\n log_string = \"Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\"\n print_in_same_line(log_string)\n pull_requests.concat(new_pr)\n end\n print_empty_line\n\n Helper.log.info \"Pull Request count: #{pull_requests.count}\"\n pull_requests.map { |pull_request| stringify_keys_deep(pull_request.to_hash) }\n end",
"def reopen!(comment, is_private = false)\n @client.update_bug(id, status: 'REOPENED', comment: { body: comment.to_s, is_private: is_private.to_b })\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if client.issue_comments(SLUG, issue.number).last.user.login == myself\n # No reply from the user, let's close the issue\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\"\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/bunto/bunto/issues/new) if you still experience this problem 👍\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\"\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\"\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `bunto` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def issue_closed(issue_id)\n issue_state_changed(\"Closed\", issue_id, :reported_by)\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if last_responding_user(issue) == myself\n # No reply from the user, let's close the issue\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\")\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/#{SLUG}/issues/new) if you still experience this problem :+1:\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\")\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\")\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `fastlane` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n body << \"Friendly reminder: contributions are always welcome! Check out [CONTRIBUTING.md](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md) for more information on how to help with `fastlane` and feel free to tackle this issue yourself :muscle:\"\n body << \"\\n\\nThis issue will be auto-closed if there is no reply within #{months(ISSUE_CLOSED)}.\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def create_pr\n ErrorEmittingExecutor.execute(\"hub pull-request -f -m '#{COMMIT_DESCRIPTION}'\")\nend",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr)\n merged = !pr[:merged_at].nil?\n git_merged, merge_reason, merge_person = @close_reason[pr[:github_id]]\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad src lines: 0, pr: #{pr[:github_id]}, id: #{pr[:id]}\") end\n\n months_back = 3\n commits_incl_prs = commits_last_x_months(pr, false, months_back)\n prev_pull_reqs = prev_pull_requests(pr,'opened')\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr),\n :forward_links => forward_links?(pr),\n :team_size => team_size_at_open(pr, months_back),\n :num_commits => num_commits(pr),\n :num_commits_open => num_commits_at_open(pr),\n :num_pr_comments => num_pr_comments(pr),\n :num_issue_comments => num_issue_comments(pr),\n :num_commit_comments => num_commit_comments(pr),\n :num_comments => num_pr_comments(pr) + num_issue_comments(pr) + num_commit_comments(pr),\n :num_participants => num_participants(pr),\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => commits_last_x_months(pr, true, months_back) / commits_incl_prs,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr, months_back),\n :commits_to_hottest_file => commits_to_hottest_file(pr, months_back),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr),\n :requester => requester(pr),\n :closer => closer(pr),\n :merger => merge_person,\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr, 'merged').to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr),\n :intra_branch => if intra_branch?(pr) == 1 then true else false end,\n :main_team_member => main_team_member?(pr, months_back),\n :social_connection_tsay => social_connection_tsay?(pr),\n :hotness_vasilescu => hotness_vasilescu(pr, months_back),\n :team_size_vasilescu => team_size_vasilescu(pr, months_back),\n :description_complexity => description_complexity(pr),\n :workload => workload(pr),\n :prior_interaction_issue_events => prior_interaction_issue_events(pr, months_back),\n :prior_interaction_issue_comments => prior_interaction_issue_comments(pr, months_back),\n :prior_interaction_pr_events => prior_interaction_pr_events(pr, months_back),\n :prior_interaction_pr_comments => prior_interaction_pr_comments(pr, months_back),\n :prior_interaction_commits => prior_interaction_commits(pr, months_back),\n :prior_interaction_commit_comments => prior_interaction_commit_comments(pr, months_back),\n :first_response => first_response(pr),\n :ci_latency => ci_latency(pr),\n :ci_errors => ci_errors?(pr),\n :ci_test_failures => ci_test_failures?(pr),\n }\n end",
"def pull_processor(payload)\n pull_request = payload[:pull_request]\n pull_request[:repository] = payload[:repository]\n new_pull = Hubstats::PullRequest.create_or_update(pull_request.with_indifferent_access)\n if payload[:github_action].include?('labeled')\n if payload[:github_action].include?('unlabeled') && payload[:label][:name].include?('qa-approved')\n Hubstats::QaSignoff.remove_signoff(payload[:repository][:id], payload[:pull_request][:id])\n elsif payload[:label][:name].include?('qa-approved')\n Hubstats::QaSignoff.first_or_create(payload[:repository][:id], payload[:pull_request][:id], payload[:sender][:id])\n end\n new_pull.update_label(payload)\n else\n repo_name = Hubstats::Repo.where(id: new_pull.repo_id).first.full_name\n labels = Hubstats::GithubAPI.get_labels_for_pull(repo_name, new_pull.number)\n new_pull.add_labels(labels)\n end\n new_pull.save!\n end",
"def export_pull_request(pull_request_model)\n if pull_request_model.commits.empty?\n return log_with_url(\n severity: :warn,\n message: \"was skipped because the PR has no diff\",\n model: pull_request_model.pull_request,\n model_name: \"pull_request\",\n console: true\n )\n end\n\n pull_requests.push(\n PullRequestExporter.new(\n pull_request_model,\n repository_exporter: self,\n project: project\n )\n )\n end",
"def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end",
"def pull_requests_from_github\n @github.search_issues(\"is:pr state:open user:#{ORGANISATION}\").items\n end",
"def list_closed(number_to_list = 100)\n Octokit.pull_requests(@git_repository, :state => 'closed', :per_page => number_to_list, :sort => 'updated', :direction => 'desc').map {|pull_request| pull_request[:number]}\n end",
"def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend",
"def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end",
"def pull_request\n @pull_request ||= ApiFactory.new 'Repos::PullRequest'\n end",
"def implement_closed_status\n # when closing the baseline, close all estimations of the baseline\n self.estimations.each do |e|\n e.close! unless e.status ==:closed or e.status==:final\n end\n end",
"def pull_request\n @pull_request ||= GitHub::PullRequest.new config.github_repo, pull_request_id\n end",
"def pull; end",
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def test02_post_closed_blog_CancelFlagArticleComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_closed_article)\n\t\t\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def close\n @closed = true\n end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def close args\n change_value \"status\", \"closed\", args\n args.each do |id| \n db, row = validate_id id\n curr_status = row['priority']\n value = curr_status.sub(/P/,'X')\n db.sql_update \"bugs\", id, 'priority', value\n puts \"Updated #{id}'s PRI from #{curr_status} to #{value} \"\n end\n 0\n end",
"def hotfix_close(version)\n print \"Preparing to close the hotfix for app \"\n print @project.current_app.teal\n print \" with version \"\n puts version.teal\n puts\n\n status = `git status`\n if status.include? \"Changes not staged for commit:\"\n raise Dev::Executable::ExecutionError.new \"Your current branch has unstaged changes. Please \"\\\n \"commit or stash them before closing the hotfix.\"\n end\n\n branches = `git branch -a`\n unless branches.include? (\"hotfix/#{version}\\n\")\n raise Dev::Executable::ExecutionError.new \"No hotfix for version '#{version}' could be found \"\\\n \"for this app's repository.\"\n end\n\n print \"\\tClosing.. \"\n exec \"git checkout master\"\n exec \"git merge --no-ff hotfix/#{version}\"\n exec \"git tag -a #{version} -m \\\"hotfix #{version}\\\"\"\n git_output = exec \"git push origin master\"\n if git_output.include?('fatal') or git_output.include?('rejected') or git_output.include?('error')\n print \"X\\n\".red\n puts \"\\t\\tSomething went wrong, take a look at the output from git:\".indianred\n puts \"\\t\\t#{git_output.split(\"\\n\").map(&:squish).join(\"\\n\\t\\t\")}\".indianred\n puts\n else\n print \"√\\n\".green\n puts \"\\t\\tDone. Output from git:\".cadetblue\n puts \"\\t\\t#{git_output.split(\"\\n\").map(&:squish).join(\"\\n\\t\\t\")}\".cadetblue\n\n print \"\\tMerging hotfix on develop..\"\n exec \"git checkout develop\"\n exec \"git merge --no-ff hotfix/#{version}\"\n git_output = exec \"git push origin develop\"\n if git_output.include?('fatal') or git_output.include?('rejected') or git_output.include?('error')\n print \"X\\n\".red\n puts \"\\t\\tSomething went wrong, take a look at the output from git:\".indianred\n puts \"\\t\\t#{git_output.split(\"\\n\").map(&:squish).join(\"\\n\\t\\t\")}\".indianred\n puts\n else\n print \"√\\n\".green\n puts \"\\t\\tDone. Output from git:\".cadetblue\n puts \"\\t\\t#{git_output.split(\"\\n\").map(&:squish).join(\"\\n\\t\\t\")}\".cadetblue\n puts\n end\n exec \"git checkout master\"\n end\n end",
"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 test02_post_closed_board_CancelDeleteNoteOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCancelDelete\n\t\t\n\t\tassert $comment_delete_link.exists?\n\tend",
"def get_pull_requests(repo_full_name)\n @client.pull_requests(repo_full_name, state: 'open')\n end",
"def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end",
"def pull_request_hook\n unless request.request_parameters[:action] == 'opened'\n render(plain: 'Not a newly-opened PR. Uninterested.') && return\n end\n\n pull_request = params[:pull_request]\n\n SmokeDetector.send_message_to_charcoal(\"[PR##{pull_request[:number]}]\"\\\n \"(https://github.com/Charcoal-SE/SmokeDetector/pull/#{pull_request[:number]})\"\\\n \" (\\\"#{pull_request[:title]}\\\") opened by #{pull_request[:user][:login]}\")\n\n unless pull_request[:user][:login] == 'SmokeDetector'\n render(plain: 'Not from SmokeDetector. Uninterested.') && return\n end\n\n text = pull_request[:body]\n\n response_text = ''\n\n # Identify blacklist type and use appropriate search\n\n domains = text.scan(/<!-- METASMOKE-BLACKLIST-WEBSITE (.*?) -->/)\n\n domains.each do |domain|\n domain = domain[0]\n\n num_tps = Post.where('body REGEXP ?', domain).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', domain).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', domain).where(is_naa: true).count\n\n response_text += get_line domain, num_tps, num_fps, num_naa\n end\n\n keywords = text.scan(/<!-- METASMOKE-BLACKLIST-KEYWORD (.*?) -->/)\n\n keywords.each do |keyword|\n keyword = keyword[0]\n\n num_tps = Post.where('body REGEXP ?', keyword).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', keyword).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', keyword).where(is_naa: true).count\n\n response_text += get_line keyword, num_tps, num_fps, num_naa\n end\n\n usernames = text.scan(/<!-- METASMOKE-BLACKLIST-USERNAME (.*?) -->/)\n\n usernames.each do |username|\n username = username[0]\n\n num_tps = Post.where('username REGEXP ?', username).where(is_tp: true).count\n num_fps = Post.where('username REGEXP ?', username).where(is_fp: true).count\n num_naa = Post.where('username REGEXP ?', username).where(is_naa: true).count\n\n response_text += get_line username, num_tps, num_fps, num_naa\n end\n\n watches = text.scan(/<!-- METASMOKE-BLACKLIST-WATCH_KEYWORD (.*?) -->/)\n\n watches.each do |watch|\n watch = watch[0]\n\n num_tps = Post.where('body REGEXP ?', watch).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', watch).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', watch).where(is_naa: true).count\n\n response_text += get_line watch, num_tps, num_fps, num_naa\n end\n\n Octokit.add_comment 'Charcoal-SE/SmokeDetector', pull_request[:number], response_text\n\n render plain: response_text, status: 200\n end",
"def is_branch_build\n self.pull_request_number == '-1'\n end",
"def issue_reopened(issue_id)\n issue_state_changed(\"Reopened\", issue_id, :assigned_to)\n end",
"def send_to_github\n ExceptionHub.current_octokit.create_issue(\"#{ExceptionHub.repo_owner}/#{ExceptionHub.repo_name}\", self.title, self.description, :open_timeout => 5)\n end",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end",
"def closed\n @closed = true\n end",
"def fix_closed_completed_bug(clsd_comp_date, irb_status, exp_date)\n # closed statuses\n cs = [\"Closed/Terminated\", \"Expired\", \"Completed\"]\n if cs.include?(irb_status) and exp_date < Time.now\n clsd_comp_date\n else\n nil\n end\n end",
"def cancel_request_issues_update!(request_issue, request_issues_update, index)\n request_issues_update.canceled!\n @logs.push(\"#{Time.zone.now} ContentionNotFoundRemediation::Log - Number: #{index}\"\\\n \" RIU ID: #{request_issues_update.id}. RI ID: #{request_issue.id}. Cancelling Request Issues Update.\")\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr[:id])\n\n merged = ! pr[:merged_at].nil?\n git_merged = false\n merge_reason = :github\n\n if not merged\n git_merged, merge_reason = merged_with_git?(pr)\n end\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad number of lines: #{0}\") end\n\n commits_last_3_month = commits_last_x_months(pr[:id], false, 3)[0][:num_commits]\n prev_pull_reqs = prev_pull_requests(pr[:id],'opened')[0][:num_pull_reqs]\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr[:login], pr[:project_name], pr[:github_id]),\n :forward_links => forward_links?(pr[:login], pr[:project_name], pr[:github_id]),\n :team_size => team_size_at_open(pr[:id], 3)[0][:teamsize],\n :num_commits => num_commits(pr[:id])[0][:commit_count],\n :num_commit_comments => num_comments(pr[:id])[0][:comment_count],\n :num_issue_comments => num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_comments => num_comments(pr[:id])[0][:comment_count] + num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_participants => num_participants(pr[:id])[0][:participants],\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => ((commits_last_3_month - commits_last_x_months(pr[:id], true, 3)[0][:num_commits]) * 100) / commits_last_3_month,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr[:id], Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 90)),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr[:id])[0][:num_watchers],\n :requester => requester(pr[:id])[0][:login],\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr[:id], 'merged')[0][:num_pull_reqs].to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr[:id])[0][:num_followers],\n :intra_branch => if intra_branch?(pr[:id])[0][:intra_branch] == 1 then true else false end,\n :main_team_member => if main_team_member?(pr[:id])[0][:main_team_member] == 1 then true else false end\n }\n end",
"def local_closed?; end",
"def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end",
"def quit\n @open = false\n 'The library is now closed for renovations.'\n end",
"def test02_closed_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n \tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\tsleep 10 #let content populate\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_closed)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.when_present.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend",
"def close\n\t\tself.status = 'closed'\n\t\tself.save\n\tend",
"def hub_pull_request(message)\n mysystem(\"hub pull-request -m \\\"#{message}\\\"\")\n end",
"def hash_tag_description_issue(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n 0\n end\n end",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D PR-#{pr}`\n end",
"def query_pull_requests\n # This line is where we want to add :accept => 'application/vnd.github.shadow-cat-preview+json' for draft PRs\n pull_requests = github_query(@client) { @client.pull_requests(@repository, :state => 'open', :per_page => 50) }\n\n @pull_request_details = []\n\n pull_requests.each do |p|\n issue = github_query(@client) { @client.issue(@repository, p.number) }\n\n $logger.debug(\"Issue loaded: #{issue}\")\n\n notification_users = Set.new\n\n notification_users << issue.assignee.login if issue.assignee\n\n notification_users << p.user.login if p.user.login\n\n aging_pull_requests_notify = true\n aging_pull_requests_num_days = 7\n\n # TODO: p.head.repo can be null if the fork repo is deleted. Need to protect that here.\n if p.head.repo.nil?\n $logger.info(\"Skipping potential PR (#{p.number}): Forked repo is null (deleted?)\")\n else\n begin\n pb = PotentialBuild.new(@client, @token, p.head.repo.full_name, nil, p.head.sha, p.head.ref, p.head.user.login, nil, nil, p.number, p.base.repo.full_name, p.base.ref)\n configured_notifications = pb.configuration.notification_recipients\n unless configured_notifications.nil?\n $logger.debug(\"Merging notifications user: #{configured_notifications}\")\n notification_users.merge(configured_notifications)\n end\n\n aging_pull_requests_notify = pb.configuration.aging_pull_requests_notification\n aging_pull_requests_num_days = pb.configuration.aging_pull_requests_numdays\n\n if p.head.repo.full_name == p.base.repo.full_name\n $logger.info(\"Skipping pull-request originating from head repo: #{p.number}\")\n else\n $logger.info(\"Found an external PR to add to potential_builds: #{p.number}\")\n @potential_builds << pb\n end\n rescue DecentCIKnownError => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e}\")\n rescue => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e} #{e.backtrace}\")\n end\n end\n # TODO: Should this be here?\n @pull_request_details << {\n :id => p.number,\n :creator => p.user.login,\n :owner => (issue.assignee ? issue.assignee.login : nil),\n :last_updated => issue.updated_at,\n :repo => @repository,\n :notification_users => notification_users,\n :aging_pull_requests_notification => aging_pull_requests_notify,\n :aging_pull_requests_numdays => aging_pull_requests_num_days\n }\n end\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 process_pull_request(req, updated_at, changed_after_eval, comments, settings, merge_pretest_success)\n id = req['number']\n branch = req['base']['ref']\n base_repo = req['base']['repo']['name']\n login = req['user']['login']\n repo_to_pull_request = {base_repo => req}\n pr_base_commit = base_repo_commit_for_pull_req(req)\n all_coreq_triggers_trusted = true\n\n $stderr.puts \"\\n****Processing #{settings['name'].upcase} in '#{branch}' branch for user '#{login}' on: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{base_repo}/pull/#{id}\"\n\n trigger_updated_at, trigger_login = get_trusted_trigger_time(req, comments, settings)\n\n evaluated_time = get_evaluated_time(comments, base_repo, settings)\n\n $stderr.puts \" Updated at: #{updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{changed_after_eval}\"\n $stderr.puts \" Trigger updated at: #{trigger_updated_at}\"\n $stderr.puts \" Evaluated time: #{evaluated_time}\"\n\n # Gather any dependencies from trusted users and add them to the repo_to_pull_request mapping\n $repo_to_pull_regex.each do |repo, regex|\n next if repo == base_repo\n if req['body'] =~ regex\n addtl_pull_id = $2\n all_coreq_triggers_trusted &= add_coreq(addtl_pull_id, repo, login, trigger_login, repo_to_pull_request, settings, trigger_updated_at, Time.parse(req['updated_at']), id, base_repo, comments)\n end\n end\n\n comments.each do |comment|\n $repo_to_pull_regex.each do |repo, regex|\n next if repo == base_repo\n if comment['body'] =~ regex\n addtl_pull_id = $2\n all_coreq_triggers_trusted &= add_coreq(addtl_pull_id, repo, comment['user']['login'], trigger_login, repo_to_pull_request, settings, trigger_updated_at, Time.parse(comment['updated_at']), id, base_repo, comments)\n end\n end\n end\n\n updated_comment = nil\n status = nil\n build_url = nil\n # Find the bot comment for this pull request (or create one)\n process_or_create_comment(id, base_repo, settings, comments) do |comment_id, comment, comment_updated_at|\n submit_test_job = false\n resubmit_test_job = false\n fields = extract_bot_comment_fields(comment, settings)\n # Given the last comment made by the bot, we can determine the state in which evaluation\n # of this pull request ended previously, depending on which we will take different actions\n case fields[:state]\n when :evaluating\n # In this case, we have just made a placeholder comment as we have not seen this pull\n # request previously and are evaluating it for the first time. To move forward, we want\n # to ensure that all of the co-requisite pull requests have no updates more recent than\n # the most recent trigger we have seen.\n # TODO: we should *always* check this, above, not only in this state\n #\n # Two state transitions are possible out of this state:\n # - into the 'waiting for stable build' phase, as we cannot move to begin a test unless\n # the downstream jobs in Jenkins are ready to run them\n # - into the 'running tests' phase, if we have a trusted trigger that covers all the\n # commits in the main pull request and any co-requisites\n $stderr.puts \" Evaluating...\"\n\n if JenkinsAPI.project_stable?(branch, settings)\n # Make sure there is a trigger in place that is still later than the updated dates of each of the pull requests\n if trigger_updated_at\n repo_to_pull_request.each do |repo, pull_request|\n next if repo == base_repo\n if !user_trusted?(pull_request['user']['login'], repo, settings) && trigger_updated_at < Time.parse(pull_request['head']['repo']['updated_at'])\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n break\n end\n end\n # The main pull request and all of the co-requisite pull requests haven't been\n # updated since the last trusted trigger, so we can begin testing\n update_evaluated_markers(repo_to_pull_request, trigger_updated_at, settings)\n submit_test_job = true\n else\n # no trusted trigger statement has been made, so we cannot build or test this pull\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n end\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n\n when :wait_stable_build, :wait_queue_pos, :wait_in_queue\n # In this case, we are in one of two states:\n # 1) waiting for a downstream project in Jenkins to be stable, so we can begin tests\n # 2) determining build queue position\n #\n # Two state transitions are possible from state 1 and 2):\n # - loop back into state 1 (or 2) if the Jenkins project is unstable\n # - into the 'running tests' state if the Jenkins project is stable\n # If the main pull request or any of the co-requisites have been\n # updated since the last time we evaluated the main pull request, we need to re-queue the\n # build and test.\n #\n # TODO: currently, we have one invalid state that will make\n # it through this logic: the cases where we are not in the\n # build queue but have submitted tests. We need to\n # reconsider why this is tolerated\n $stderr.puts \" Waiting...\"\n # Only submit the tests if the project is stable\n if JenkinsAPI.project_stable?(branch, settings)\n submitted_tests = submitted_tests_for_branch(branch)\n if !submitted_tests[settings['name']]\n $stderr.puts \" Checking that evaluated times are still up to date\"\n if changed_after_eval\n resubmit_test_job = true\n else\n submit_test_job = true\n repo_to_pull_request.each do |repo, sub_pull_request|\n next if repo == base_repo\n $stderr.puts \" Checking evaluated time for sub pull request #{sub_pull_request['number']} for repo '#{repo}'\"\n sub_pull_comments = get_comments(sub_pull_request['number'], repo)\n sub_pull_request_updated_at, sub_pull_request_changed_after_eval = get_updated_at(sub_pull_request, sub_pull_comments, settings)\n\n $stderr.puts \" Updated at: #{sub_pull_request_updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{sub_pull_request_changed_after_eval}\"\n if sub_pull_request_changed_after_eval\n resubmit_test_job = true\n break\n end\n end\n end\n else\n $stderr.puts \" Job is already queued\"\n end\n end\n when :running\n # In this state, we have triggered tests and made it through the build queue, so there\n # are running tests\n #\n # There are two state transitions possible from this state:\n # - loop back into this state if the tests are still running\n # - into the appropriate post-build state, of which I know of:\n # - SUCCESS\n # - ABORTED\n # - UNSTABLE\n # - NOT_FOUND\n\n # Capture the build_url from the regex match\n $stderr.puts \" Running: #{fields[:build_url]}consoleFull\"\n\n # If the build is finished, update with the results\n if JenkinsAPI.build_running?(fields[:build_url], branch, settings)\n submitted_tests = submitted_tests_for_branch(branch)\n submitted_tests[settings['name']] = true unless settings['allow_multiple']\n else\n result = JenkinsAPI.build_result(fields[:build_url], branch, settings)\n # Modify a copy so if we use fields below at some later time, we don't get a surprise\n new_fields = fields.dup\n new_fields[:state] = CONTENT_TO_STATE[result]\n updated_comment = compose_bot_comment(settings['test_prefix'], new_fields)\n status = result == 'SUCCESS' ? 'success' : 'failure'\n end\n when :failure\n # In this case, are in the post-test result state, and the tests have failed\n #\n # The two states that we can transition to from here are:\n # - loop back into this state if:\n # - flake enforcement is configured and\n # - there is no comment linking a valid flake issue to the last failed\n # job and\n # - the is no administrative trigger, overriding the check and\n # - the base branch of the pull request has not been updated from the\n # version used to run the tests previous ly\n # - into the testing state if either:\n # - flake enforcement is not configured, or\n # - a contributor has linked the failure to a flake issue, or\n # - an administrator has overriden the check, or\n # - new code has been pushed to the branch since the last time this bot\n # evaluated the pull request\n $stderr.puts \" Job failed: #{comment}\"\n\n flake_config = settings['flake_identification']\n if !flake_config\n # If no flake configuration exists, it's ok to re-submit the job whenever\n # a new trigger is added to the pull request\n $stderr.puts \" No flake identification configuration exists, resubmitting...\"\n resubmit_test_job = true\n else\n # If flake configuration does exist, we have to determine if we are OK to\n # re-submit or not\n $stderr.puts \" Determining if flakes have been identified for failed job: #{fields[:build_url]}\"\n\n admin_trigger_updated_at, _ = get_admin_trigger_time(req, comments, settings)\n admin_trigger_valid = admin_trigger_updated_at && admin_trigger_updated_at > updated_at\n if !admin_trigger_valid && !changed_after_eval\n # If there is nothing else that is going to re-trigger this job, we\n # look to find an explanatory comment. This is a costly process in\n # terms of API calls, so we only do it if we need to.\n explanatory_comment_valid = has_valid_flake_comment?(comments_after(comments, comment_updated_at), flake_config)\n else\n explanatory_comment_valid = false\n end\n\n flake_comment_prefix = flake_denied_prefix(base_repo, settings['name'])\n flake_comment_body = format_flake_comment(flake_comment_prefix, flake_config, settings['repo_to_admin_teams'][base_repo])\n\n # If we can find an explanatory comment with a valid flake issue in it,\n # or we find an admin override comment, or the pull request has had new\n # code added to it since the last evaluation, we know that we are good\n # to resubmit the pull request for testing\n if explanatory_comment_valid || admin_trigger_valid || changed_after_eval\n $stderr.puts format_flake_satisfaction_message(explanatory_comment_valid, admin_trigger_valid, changed_after_eval)\n resubmit_test_job = true\n delete_comment_with_prefix(id, base_repo, flake_comment_prefix, comments)\n else\n $stderr.puts \" Flake identification not satisfied\"\n if trigger_updated_at && trigger_updated_at > evaluated_time\n # If someone's tried to trigger a re-test, but we can't re-test right\n # now, we should leave a helpful message explaining why. If we have\n # previously warned the user about why we couldn't re-test, we should\n # only update the pull request with a new set of reasons if the trigger\n # is newer than our last comment\n previous_warning = get_comment_with_prefix(id, base_repo, flake_comment_prefix, comments)\n if !previous_warning || (previous_warning && trigger_updated_at > Time.parse(previous_warning['updated_at']))\n $stderr.puts \" New reminder comment is appropriate for this pull request\"\n recreate_comment_with_prefix(id, base_repo, flake_comment_prefix, flake_comment_body, comments)\n end\n end\n end\n end\n else\n # In this case, we're in one of three states:\n # 1) ACTION_NOT_MERGE: the pull request is not mergeable and needs a rebase\n # 2) ACTION_NOT_TEAM: the pull request has no trusted triggers\n # 3) the build has finished, with one of the following states:\n # - SUCCESS\n # - ABORTED\n # - UNSTABLE\n # - NOT_FOUND\n #\n # Regardless of the current state, since we have a trusted trigger, we want to\n # re-submit this pull request for testing.\n $stderr.puts \" Finished...\"\n $stderr.puts \" #{comment}\" if (fields[:prefix] == settings['test_prefix'] && fields[:build_url])\n resubmit_test_job = true\n end\n # Once we have considered the current state of the pull request, we need to determine\n # if we are going to submit this pull request for testing\n if resubmit_test_job\n # If analysis of the current state has determined that we should re-submit the job\n # for testing, we need to check that we meet all criteria for resubmission:\n # - is the project stable? [TODO: we seem to be checking this always, move up?]\n # - have there been any changes in the main pull request since the last evaluation?\n # - have there been any changes in the co-requisite pull requests since the last evaluation?\n #\n # TODO: this logic has bled out and should be moved into a function that is called\n # inside of each state case above, instead of being called this way. Ideally each\n # state case above should be able to either submit or not submit tests internally.\n submit_test_job = false\n\n $stderr.puts \" Checking whether we should resubmit\"\n if trigger_updated_at\n # We already trust the primary pull request. Just need to check whether the eval time is older than last update or last trusted trigger.\n if changed_after_eval || (evaluated_time < trigger_updated_at)\n if JenkinsAPI.project_stable?(branch, settings)\n submit_test_job = true\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n end\n\n # Check for any other reason to submit the test job. And make sure non of the sub pull requests have new untrusted changes.\n repo_to_pull_request.each do |repo, sub_pull_request|\n next if repo == base_repo\n\n $stderr.puts \" Checking evaluated time for sub pull request #{sub_pull_request['number']} for repo '#{repo}'\"\n sub_pull_comments = get_comments(sub_pull_request['number'], repo)\n sub_pull_request_updated_at, sub_pull_request_changed_after_eval = get_updated_at(sub_pull_request, sub_pull_comments, settings)\n\n $stderr.puts \" Updated at: #{sub_pull_request_updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{sub_pull_request_changed_after_eval}\"\n\n # Make sure the trigger on the primary pull request is after the updated date of the sub pull request\n # or the user of the sub pull request is trusted\n valid_trigger_comment = trigger_updated_at > sub_pull_request_updated_at\n $stderr.puts \" Has valid trigger comment: #{valid_trigger_comment}\"\n if valid_trigger_comment || user_trusted?(sub_pull_request['user']['login'], repo, settings)\n if sub_pull_request_changed_after_eval\n if JenkinsAPI.project_stable?(branch, settings)\n submit_test_job = true\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n end\n else\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n submit_test_job = false\n break\n end\n end\n else\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n submit_test_job = false\n end\n if submit_test_job\n update_evaluated_markers(repo_to_pull_request, trigger_updated_at, settings)\n end\n end\n\n # To complete the transition into the next phase of the pull request evaluation,\n # we need to take the correct external actions if necessary and update the bot\n # comment to reflect the new state\n if submit_test_job\n delete_comment_with_prefix(id, base_repo, ACTION_PREFIX, comments)\n # Check for pretest_settings_key, so we might skip a round\n # of tests prior to merge\n extended_tests = get_extended_tests(req, comments, branch, settings)\n validate_and_submit_tests(repo_to_pull_request, base_repo, branch, id, comment_id, extended_tests, all_coreq_triggers_trusted, comments, settings, pr_base_commit['sha'])\n elsif updated_comment\n # If we have an `updated_comment`, we have determined which state we want to\n # transition into above literally and simply need to update the comment to\n # reflect that\n recreate_comment(id, comment_id, base_repo, updated_comment)\n repo_to_pull_request.each do |repo, pull_request|\n if status && build_url\n # One of the literal transitions we specify is the transition from running\n # tests to reporting the results, so if a result has been specified we\n # furthermore know that we are transitiong into the post-test state and can\n # update the GitHub pull request status\n commit = last_commit_for_pull_id(pull_request['number'], repo)\n update_status(settings['test_prefix'], commit['sha'], repo, status, build_url, (status == 'success') ? 'Passed' : 'Failed')\n end\n next if repo == base_repo\n # Update coreq comments with appropriate base commit ID\n coreq_fields = extract_bot_comment_fields(updated_comment, settings)\n cr_bot_comment = get_comment_with_prefix(pull_request['number'], repo, settings['test_prefix'])\n coreq_fields[:base_commit] = extract_bot_comment_fields(cr_bot_comment['body'], settings)[:base_commit]\n updated_comment = compose_bot_comment(settings['test_prefix'], coreq_fields)\n recreate_comment_with_prefix(pull_request['number'], repo, settings['test_prefix'], updated_comment)\n end\n elsif !repo_to_pull_request.empty?\n # If we are not running tests and have not specified a literal state to transition\n # into, we have one more transition to check: from post-build sucess to merge\n Properties['settings'].each_value do |s|\n # Check all_coreq_triggers_trusted in case trigger author can't merge all linked repos\n if s['pretest_settings_key'] && merge_pretest_success && all_coreq_triggers_trusted\n if Properties['settings'][s['pretest_settings_key']]['name'] == settings['name']\n if fields[:state] == :success\n build_url = fields[:build_url]\n trusted_trigger_time, trigger_login = get_trusted_trigger_time(req, comments, s)\n if trusted_trigger_time\n begin\n repo_to_pull_request.each do |repo, pull_request|\n test_merge_pull_request(pull_request['number'], repo, s)\n end\n repo_to_pull_request.each do |repo, pull_request|\n $stderr.puts \"\\n*******Merging pretested pull request: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pull/#{pull_request['number']} \"\n merge_pull_request(pull_request['number'], repo, s, build_url)\n end\n rescue Exception => e\n $stderr.puts e.message\n $stderr.puts e.backtrace\n end\n end\n end\n break\n end\n end\n end\n end\n end\n\n end",
"def close\n @rugged_repository.close\n end",
"def test05_post_closed_board_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_success.exists?\n\tend",
"def test03_post_closed_board_CancelDeleteArticleOneComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_article)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCancelDelete\n\t\t\n\t\tassert $comment_delete_link.exists?\n\tend",
"def test02_post_closed_blog_CloseFlagNoteDialog\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Blog Note Comment for close flag #{random}\"\n\t\tsleep 2\n\t\tcommentCloseFlag\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def process_pull_requests(merge_pretest_success)\n pull_requests = []\n mergeability_in_flux = false\n pull_request_statuses = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = {} } }\n $repo_to_pull_regex.keys.each do |repo|\n $stderr.puts \"\\nProcessing repo '#{repo}'\"\n pull_request_statuses[:closed_prs][repo] = \"#{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pulls?q=is%3Apr+is%3Aclosed\"\n list_pull_requests(repo).each do |req|\n id = req['number']\n $stderr.puts \"Analyzing pull request: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pull/#{id}\"\n\n branch = req['base']['ref']\n\n # We only want to consider pull requests into branches we care about\n if $branches.include?(branch) || $branches.include?('*')\n\n $stderr.puts \" Updated at: #{req['updated_at']}\"\n # We only want to consider pull requests that have been modified in\n # the last twelve hours, to stop us from doing extra work when we\n # don't need to. Also, just to ensure that we don't forget a pull\n # request forever on accident, there is a 10% chance we'll consider\n # a pull request even if it is inactive\n if Time.now - Time.parse(req['updated_at']) < (12*60*60) || (rand(20) < 1)\n login = req['user']['login']\n comments = nil\n # Skip if it's not mergeable\n mergeable = is_mergeable?(id, repo)\n $stderr.puts \" Mergeable: #{mergeable}\"\n if mergeable\n comments = get_comments(id, repo) if comments.nil?\n set_mergeable(id, repo, login, comments)\n else\n if set_not_mergeable(id, repo, login) == MERGEABLE\n mergeability_in_flux = true\n end\n next\n end\n\n comments = get_comments(id, repo) if comments.nil?\n\n # We only want to consider pull requests where the last trigger we found\n # is from a trusted user\n permission_denied = Array.new(Properties['settings'].length, false)\n # Has a merge or test been requested by a trusted user?\n Properties['settings'].values.each_with_index do |settings, i|\n updated_at, changed_after_eval = get_updated_at(req, comments, settings)\n trigger_regex = /\\[#{settings['name']}\\]/i\n if req['title'] =~ trigger_regex || req['body'] =~ trigger_regex\n if user_trusted?(login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n next\n else\n $stderr.puts \" User '#{login}' not trusted\"\n permission_denied[i] = true\n end\n end\n\n comments = sort_comments(comments)\n comments.each do |comment|\n if comment['body'] =~ trigger_regex\n comment_login = comment['user']['login']\n if user_trusted?(comment_login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n break\n else\n $stderr.puts \" User '#{comment_login}' not trusted\"\n permission_denied[i] = true\n end\n end\n end\n end\n if permission_denied.include? true\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n end\n else\n $stderr.puts \" Skipping due to age and inactivity\"\n end\n else\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_UNSUPPORTED_BRANCH)\n end\n end\n end\n\n if mergeability_in_flux\n $stderr.puts \"Waiting till next run to see if mergeability is in flux\"\n exit\n end\n\n # Consider the pull requests we have deemed valid in\n # order of the time they were last updated, oldest first\n sorted_pull_requests = pull_requests.sort_by do |req_info|\n req_info[1]\n end\n\n skipped_count = {}\n $branches.each do |branch|\n skipped_count[branch] = {}\n end\n\n # If we're only allowing sequential tests in this tag, we want to find\n # any pull request in the 'running tests' state and signal that there\n # is a test running.\n sorted_pull_requests.each do |req_info|\n req = req_info[0]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n\n if !settings['allow_multiple']\n comments.each do |comment|\n begin\n fields = extract_bot_comment_fields(comment['body'], settings)\n if (comment['user']['login'] == Properties['bot_github_user']) && fields[:state] == :running\n submitted_tests = submitted_tests_for_branch(branch)\n submitted_tests[settings['name']] = true\n break\n end\n rescue Exception => e\n next\n end\n end\n end\n end\n\n sorted_pull_requests.each do |req_info|\n # Process the pull request\n req = req_info[0]\n updated_at = req_info[1]\n changed_after_eval = req_info[2]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n repo = req['base']['repo']['name']\n\n process_pull_request(req, updated_at, changed_after_eval, comments, settings, merge_pretest_success)\n\n submitted_tests = submitted_tests_for_branch(branch)\n\n if !settings['allow_multiple'] && submitted_tests[settings['name']]\n # If we're only allowing sequential tests on this tag and there is a test running,\n # and we are waiting to test, we need to correctly determine the position in the\n # test queue that we are at and post it in a bot comment on the pull request\n comments = get_comments(req['number'], repo)\n\n bot_comment = get_comment_with_prefix(req['number'], repo, settings['test_prefix'], comments)\n if bot_comment\n fields = extract_bot_comment_fields(bot_comment['body'], settings)\n if (waiting_in_queue_state?(fields[:state]))\n skipped_count_branch = skipped_count[branch] ? skipped_count[branch] : skipped_count['*']\n skipped_count_branch[settings['name']] = 0 if skipped_count_branch[settings['name']].nil?\n skipped_count_branch[settings['name']] += 1\n queued_comment = compose_bot_comment(settings['test_prefix'], :state => :wait_in_queue, :content => waiting_in_queue_comment_segment(skipped_count_branch[settings['name']].to_s))\n pull_request_statuses[:enqueued][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:enqueued][req['html_url']][:queue_pos] = skipped_count_branch[settings['name']]\n pull_request_statuses[:enqueued][req['html_url']][:repo] = repo\n create_or_update_comment(req['number'], repo, settings['test_prefix'], queued_comment , comments)\n $stderr.puts \" Pull ##{req['number']} in repo '#{repo}' is at build position ##{skipped_count_branch[settings['name']]}\"\n # Get ahead of the game and pretest requests\n if settings['pretest_settings_key'] && settings['pretest_comment'] && settings['pretest_queue_threshold'] && (skipped_count_branch[settings['name']] >= settings['pretest_queue_threshold'])\n trusted_trigger_time, _ = get_trusted_trigger_time(req, comments, Properties['settings'][settings['pretest_settings_key']])\n create_or_update_comment(req['number'], repo, settings['pretest_comment'].gsub('[', '\\[').gsub(']', '\\]'), settings['pretest_comment'], comments) unless trusted_trigger_time\n end\n elsif fields[:state] == :running\n pull_request_statuses[:running][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:running][req['html_url']][:status] = \"merging\"\n pull_request_statuses[:running][req['html_url']][:repo] = repo\n end\n end\n end\n end\n # Commit merge queue records to disk\n IO.write(MERGE_QUEUE_RECORD, pull_request_statuses.to_json, {:mode => 'w'})\n end",
"def test_pull_request(\n repo_name,\n pull_request_number,\n github_login,\n github_password,\n rspec_test,\n log_file,\n test_message = 'schedule_for_testing'\n )\n # reset everthing to master\n refresh_modules\n checkout_pr(\n repo_name,\n pull_request_number,\n [github_login],\n test_message,\n {\n :login => github_login,\n :password => github_password\n }\n )\n system \"bash -c 'rspec #{rspec_test}; echo $?' 2>&1 | tee #{log_file}\"\n results = File.read(log_file)\n publish_results(\n repo_name,\n pull_request_number,\n results.split(\"\\n\").last == '0' ? 'passed' : 'failed',\n results,\n {\n :login => github_login,\n :password => github_password\n }\n )\n end",
"def pull_requests repo\n name = full_name repo\n \n %w[open closed].reduce([]) do |memo, state|\n memo | octokit.pulls(name, state, :per_page=>100)\n end\n end",
"def pull_request?\n !!issue.pull_request.html_url\n end",
"def pull_request?\n !!issue.pull_request.html_url\n end",
"def close\n tagged_response(\"CLOSE\")\n end",
"def delete(auth, pullRequest)\n\t\t\turi = URI(\"#{auth.url}/#{auth.repo}/pulls/#{pullRequest.prnum}/reviews/#{@id}\")\n\t\t\t\n response = nil\n\t\t\tNet::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n \t\t\t\trequest = Net::HTTP::Delete.new(uri)\n\t\t\t request['Authorization'] = \"token #{auth.token}\"\n\t\t\t request['accept'] = \"application/json\"\n\t\t\t \n \t\t\t\tresponse = http.request request\n\t\t\tend\n\n\t\t\tif response.code.to_i < 200 or response.code.to_i >= 300\n\t\t\t\tputs \"Error: unexpected response code received from server: #{response.code}\"\n\t\t\t\tputs response\n\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\treturn true\n\t\tend",
"def test02_post_open_board_CloseFlagNoteDialog\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCloseFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def close\n @closed = true\n end",
"def pull_request_commits\n @octokit.pull_request_commits(@repository.full_name, @pull_request.number)\n end",
"def test03_post_closed_blog_CloseFlagArticleDialog\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_closed_article)\n\t\t\n\t\tcommentPopSubmit \"Blog Article Comment for flag close #{random}\"\n\t\tsleep 2\n\t\tcommentCloseFlag\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def ensure_pull_request(owner, repo, pullreq_id,\n comments = true, commits = true, history = true,\n state = nil, actor = nil, created_at = nil)\n pulls_reqs = db[:pull_requests]\n\n project = ensure_repo(owner, repo)\n\n if project.nil?\n warn \"Could not find repo #{owner}/#{repo} for retrieving pull request #{pullreq_id}\"\n return\n end\n\n retrieved = retrieve_pull_request(owner, repo, pullreq_id)\n\n if retrieved.nil?\n warn \"Could not retrieve pull_req #{owner}/#{repo} -> #{pullreq_id}\"\n return\n end\n\n base_repo = ensure_repo(retrieved['base']['repo']['owner']['login'],\n retrieved['base']['repo']['name'])\n\n base_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['base']['sha'],\n retrieved['base']['repo']['owner']['login'])\n\n if pr_is_intra_branch(retrieved)\n head_repo = base_repo\n head_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['base']['repo']['owner']['login'])\n debug pr_log_msg(retrieved) + ' is intra-branch'\n else\n head_repo = if pr_has_head_repo(retrieved)\n ensure_repo(retrieved['head']['repo']['owner']['login'],\n retrieved['head']['repo']['name'])\n end\n\n head_commit = if not head_repo.nil?\n ensure_commit(retrieved['head']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['head']['repo']['owner']['login'])\n end\n end\n\n pull_req_user = ensure_user(retrieved['user']['login'], false, false)\n\n merged = if retrieved['merged_at'].nil? then false else true end\n closed = if retrieved['closed_at'].nil? then false else true end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n if pull_req.nil?\n pulls_reqs.insert(\n :head_repo_id => if not head_repo.nil? then head_repo[:id] end,\n :base_repo_id => if not base_repo.nil? then base_repo[:id] end,\n :head_commit_id => if not head_commit.nil? then head_commit[:id] end,\n :base_commit_id => if not base_commit.nil? then base_commit[:id] end,\n :pullreq_id => pullreq_id,\n :intra_branch => pr_is_intra_branch(retrieved)\n )\n info 'Added ' + pr_log_msg(retrieved)\n else\n debug pr_log_msg(retrieved) + ' exists'\n end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n\n # Add a fake (or not so fake) issue in the issues table to serve\n # as root for retrieving discussion comments for this pull request\n issues = db[:issues]\n issue = issues.first(:pull_request_id => pull_req[:id])\n\n if issue.nil?\n issues.insert(:repo_id => base_repo[:id],\n :assignee_id => nil,\n :reporter_id => nil,\n :issue_id => pullreq_id,\n :pull_request => true,\n :pull_request_id => pull_req[:id],\n :created_at => date(retrieved['created_at']))\n debug 'Added accompanying_issue for ' + pr_log_msg(retrieved)\n else\n debug 'Accompanying issue for ' + pr_log_msg(retrieved) + ' exists'\n end\n\n if history\n # Actions on pull requests\n opener = pull_req_user[:login]\n ensure_pull_request_history(pull_req[:id], date(retrieved['created_at']),\n 'opened', opener)\n\n merger = if retrieved['merged_by'].nil? then actor else retrieved['merged_by']['login'] end\n ensure_pull_request_history(pull_req[:id], date(retrieved['merged_at']),\n 'merged', merger) if (merged && state != 'merged')\n\n closer = if merged then merger else actor end\n ensure_pull_request_history(pull_req[:id], date(retrieved['closed_at']),\n 'closed', closer) if (closed && state != 'closed')\n ensure_pull_request_history(pull_req[:id], date(created_at), state, actor) unless state.nil?\n end\n ensure_pull_request_commits(owner, repo, pullreq_id, pull_req, retrieved) if commits\n ensure_pullreq_comments(owner, repo, pullreq_id, pull_req) if comments\n ensure_issue_comments(owner, repo, pullreq_id, pull_req[:id]) if comments\n\n pull_req\n end",
"def test03_post_open_board_CloseFlagArticleDialog\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_open_article)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCloseFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end",
"def unapprove\n if self.build.pull_request_number != '-1'\n # Clear sha and pull request number\n self.new_image.clear_preapproval_information(false)\n else\n self.new_image.approved = false\n end\n\n # Clear fields that mark diff that an action has been taken, so it is listed in the \"Diffs waiting for approval\" section\n self.new_image.user_approved_this_build = false\n self.new_image.save\n self.approved_by = nil\n self.approved = false\n self.save\n end",
"def get_pull_request(pr_id)\n r = BB.get(\"#{BB_API_BASE}/pull-requests/#{pr_id}\")\n raise \"Gotta Problem: #{r.reason_phrase}\" unless 'OK' == r.reason_phrase\n return JSON.parse(r.body)\nend",
"def github_pull\n Extension.github_sync\n end",
"def leave_all_authorized_comment\n @octokit.add_comment(\n @repository.full_name,\n @pull_request.number,\n all_authorized_message\n ).tap do |comment|\n @pull_request.comments.create(github_id: comment.id)\n end\n end",
"def single_pull_request_response(fq_repo_name, pull_request_id)\n repository_url = \"https://api.github.com/repos/#{fq_repo_name}\"\n {\n \"id\" => pull_request_id,\n \"url\" => \"https://api.github.com/repos/#{fq_repo_name}/pulls/#{pull_request_id}\",\n \"number\" => pull_request_id,\n \"repository_url\" => repository_url,\n \"labels\" => [\n {\"name\" => \"bug\"},\n {\"name\" => \"wip\"}\n ],\n \"pull_request\" => {\n \"url\" => \"#{repository_url}/pulls/#{pull_request_id}\"\n }\n }.to_json\n end",
"def test02_open_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n\t\tlogin $user_3_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\t\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend",
"def get_commits(pull_req_id)\n do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls/#{pull_req_id}/commits\", true)\n end",
"def create_pull_request\n unless uploads.empty?\n branch = patch_branch\n create_branch(branch)\n uploads.each do |key, upload|\n client.create_contents(\n repo,\n upload[\"filename\"],\n \"Create #{upload[\"filename\"]}\",\n session[\"file_#{key}\"],\n :branch => branch\n )\n session[\"file_#{key}\"] = nil\n end\n end\n pr = client.create_pull_request(repo, \"master\", branch, form_data[\"title\"], issue_body, :labels => labels)\n pr[\"number\"] if pr\n end",
"def set_pull_request\n @pull_request = PullRequest.find(params[:id])\n end",
"def get_pull_request(repo_full_name, pull_request_id)\n @client.pull_request(repo_full_name, pull_request_id)\n end",
"def do_close; end",
"def clean_coverage_comments(client)\n comment_page = 0\n loop do\n comment_page += 1\n cur_page_comment = client.pull_request_comments(REPO, PULL_REQUEST, { :per_page =>100, :page => comment_page })\n if cur_page_comment.length == 0\n break\n end\n for cmt in cur_page_comment do\n # Remove comments when the comment body meets the REMOVE_PATTERN.\n if cmt.body =~ REMOVE_PATTERN\n client.delete_pull_request_comment(REPO,cmt.id)\n end\n end\n end\nend",
"def reopen\n @closed = false\n self\n end",
"def closed!(level, code, reason, classid, methodid)\n @closed = [level, code, reason, classid, methodid]\n @replies.close\n @basic_gets.close\n @unconfirmed_empty.close\n @consumers.each_value(&:close)\n nil\n end",
"def test03_post_closed_news_CloseFlagArticleDialog\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCloseFlag\n\t\tsleep 1\n\t\t \n\t\tassert $comment_flag_link.exists?\n\tend",
"def closed?\n status == \"closed\"\n end"
] |
[
"0.7414636",
"0.7151129",
"0.68429697",
"0.66125697",
"0.6273422",
"0.6244567",
"0.62148625",
"0.60994726",
"0.6068718",
"0.60340863",
"0.60178643",
"0.5998116",
"0.5937435",
"0.5903284",
"0.58645415",
"0.58507925",
"0.58493114",
"0.58197975",
"0.5797524",
"0.57844937",
"0.57409155",
"0.57051766",
"0.5691396",
"0.5686659",
"0.5674449",
"0.56700784",
"0.5632636",
"0.56259704",
"0.5585283",
"0.5583925",
"0.5558164",
"0.5547552",
"0.55450743",
"0.5508097",
"0.54877293",
"0.5482877",
"0.5475066",
"0.5475066",
"0.5475066",
"0.5475066",
"0.5467896",
"0.54535717",
"0.5421998",
"0.54131776",
"0.5411263",
"0.5398703",
"0.5395249",
"0.539452",
"0.53915685",
"0.53902876",
"0.5390074",
"0.53852004",
"0.5383326",
"0.53737384",
"0.53718483",
"0.53693616",
"0.53661084",
"0.536085",
"0.5359079",
"0.53582335",
"0.5352788",
"0.53513694",
"0.5346999",
"0.5342977",
"0.5340978",
"0.53369147",
"0.5336857",
"0.53351647",
"0.53337854",
"0.53328776",
"0.5329645",
"0.53183824",
"0.5315067",
"0.5312875",
"0.5312875",
"0.5309169",
"0.53088975",
"0.5308363",
"0.5298799",
"0.5291761",
"0.528707",
"0.5285763",
"0.5284426",
"0.5274929",
"0.5274018",
"0.52729356",
"0.52635777",
"0.5261558",
"0.52419776",
"0.5237593",
"0.52352333",
"0.52216303",
"0.52197874",
"0.5213844",
"0.521242",
"0.52086115",
"0.52046216",
"0.52043664",
"0.5193472",
"0.5185317"
] |
0.74483526
|
0
|
An issue comment has been reported
|
def process_created_issue_comment(issue_comment_payload)
pr_name = issue_comment_payload['repository']['full_name'].to_s
pr_number = issue_comment_payload['issue']['number'].to_s
comment_user = issue_comment_payload['comment']['user']['id'].to_s
approvals = parse_comment_body(issue_comment_payload['comment']['body'])
pull_request = @client.pull_request(pr_name, pr_number)
current_commit_hash = pull_request['head']['sha'].to_s
submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end",
"def comment\n @comment ||= client.issue_comments(repository, pr_id).detect do |comment|\n UrlSectionBuilder.match?(comment[:body])\n end\n end",
"def update_comment_text(story_data, bug_task, build_number)\n txt = String.new(FIXED_COMMENT_PREFIX) # comment should always begin with this\n txt << \"Fixed in Git and deployed with build #{build_number}\"\n\n if (story_data.current_state != 'finished' && story_data.current_state != 'delivered' && story_data.current_state != 'accepted')\n txt << \"\\n\\nNOTE: this story is not in the expected status 'Finished'... please verify and update status if necessary\"\n end\n txt\n end",
"def issue_comments(issue)\n klasses = [\"tag-short\"]\n klasses << \"comments-present\" if issue.comments.count > 0\n issue_label(t(\"labels.comments\"), issue.comments.count, klasses)\n end",
"def comment_on(params)\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would comment on issue #{params[:issue]}\",\n :tags => [:jira, :dryrun])\n nil\n else\n key = get_param(params, :issue)\n issue = issueify(key)\n if issue\n comment = Jira4R::V2::RemoteComment.new()\n comment.author = params[:author] || @config[:auth][:username]\n comment.body = params[:comment] || ''\n with_jira do\n addComment(issue.key.upcase, comment)\n end\n notify(:msg => \"[#{@name}] Added a comment to issue #{issue.key}\",\n :tags => [:jira, :trace])\n else\n raise \"Could not find JIRA issue #{params[:issue]}\"\n end\n issue\n end\n end",
"def issue_comment(owner, repo, issue_number, comment)\n Issues.post(\n \"/repos/#{owner}/#{repo}/issues/#{issue_number}/comments\",\n :headers => @auth,\n :body => { :body => comment }.to_json\n )\n end",
"def add_comments_to_issue message, hash, issue, user, cookies, http\n\t# Remove issue# from commit message and parse\n\tmessage_text = message.sub $remove_issue_regex, ''\n\tputs message_text\n\t# First, login to youtrack given above credentials\n\tcomment_url = \"/youtrack/rest/issue/#{issue}/execute\"\n\trequest = Net::HTTP::Post.new(comment_url)\n\trequest.body = \"comment=[#{$repo}.git] #{message_text}&runAs=#{user}\"\n\trequest['Cookie'] = cookies\n http.request(request)\nend",
"def ensure_issue_comment(owner, repo, issue_id, comment_id, pull_req_id = nil)\n issue = if pull_req_id.nil?\n ensure_issue(owner, repo, issue_id, false, false, false)\n else\n db[:issues].first(:pull_request_id => pull_req_id)\n end\n\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving comment #{comment_id}\"\n return\n end\n\n issue_comment_str = \"#{owner}/#{repo} -> #{issue_id}/#{comment_id}\"\n\n curcomment = db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => comment_id)\n if curcomment.nil?\n\n retrieved = retrieve_issue_comment(owner, repo, issue_id, comment_id)\n\n if retrieved.nil?\n warn \"Could not retrieve issue_comment #{issue_comment_str}\"\n return\n end\n\n user = ensure_user(retrieved['user']['login'], false, false)\n\n db[:issue_comments].insert(\n :comment_id => comment_id,\n :issue_id => issue[:id],\n :user_id => unless user.nil? then user[:id] end,\n :created_at => date(retrieved['created_at'])\n )\n\n info \"Added issue_comment #{issue_comment_str}\"\n db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => comment_id)\n else\n debug \"Issue comment #{issue_comment_str} exists\"\n curcomment\n end\n end",
"def on_comment(msg)\n end",
"def add_comment\n @issue.comment @user_message.empty? ? @message : @user_message\n end",
"def add_comment_to_issue(issue_name, comment_text)\n\tissue = @client.Issue.find(issue_name)\n\tcomment = issue.comments.build\n\tcomment.save!(:body => comment_text)\nend",
"def test05_post_closed_board_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_success.exists?\n\tend",
"def process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n plus_ones = @redis.hget(pr_name + \":\" + pr_number, current_commit_hash)\n\n # Ensure that a key actually exists\n if !plus_ones.nil?\n plus_ones_to_add = parse_comment_body(issue_comment_payload['comment']['body'])\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones.to_i + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n @redis.hset(pr_name + \":\" + pr_number, current_commit_hash, plus_ones)\n\n if plus_ones >= NEEDED_PLUS_ONES\n # Set commit status to sucessful\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'success',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has been reached!',\n 'context' => 'robinpowered/commodus'\n }\n )\n else\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'pending',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has yet to be reached.',\n 'context' => 'robinpowered/commodus'\n }\n )\n end\n end\n\n return 200\n end",
"def peer_auditor_issue?\n self.auditor_result == 'Comment'\n end",
"def comment_on_issue(issue_url, comment_body)\n github_api_request 'POST', \"#{issue_url}/comments\", { :body => comment_body }.to_json\n end",
"def test05_post_closed_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend",
"def update_bug(bug_data, bug_task, build_number)\n bug_id = bug_data['id']\n bugproxy = @server.proxy('Bug')\n comments_result = bugproxy.comments({:ids => bug_id})\n #puts comments_result\n comments = comments_result['bugs'][\"#{bug_id}\"]['comments']\n last_comment = comments.last\n\n if last_comment\n if !last_comment['text'].start_with? FIXED_COMMENT_PREFIX\n\n # only add a comment if the state isn't already VERIFIED, REVERIFIED or CLOSED\n status = bug_data['status']\n txt = String.new(FIXED_COMMENT_PREFIX) # comment should always begin with this\n txt << \"Fixed in Git and deployed with build #{build_number}\"\n\n if !(status == 'RESOLVED' || verified_or_closed?(status))\n txt << \"\\n\\nNOTE: it appears that this bug has not been marked resolved yet... please verify and update status if necessary\"\n end\n\n if (!verified_or_closed?(status) && !@dry_run)\n add_comment_response = bugproxy.add_comment({'id' => bug_id, 'comment' => txt})\n\n #puts \"adding comment to bug id #{bug_id}\\n #{txt}\"\n # TODO: add delivered in build field\n # unfortunately it doesn't look like the API gives us a way to update custom fields\n # http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html#fields\n end\n end\n end\n #puts \"Last comment:\\n#{last_comment}\"\n end",
"def comment_added(comment)\n @comment = comment\n @user = @comment.user\n @track = @comment.track\n @project = @track.project\n\n mail to: @user.email,\n bcc: \"pierre@sugaryourcoffee.de, #{@project.user.email}\",\n subject: \"[apptrack] New Comment in Project #{@project.title}\"\n end",
"def post_issue(issue)\n proj = issue[\"project\"][\"name\"]\n cat = issue[\"category\"] ? issue[\"category\"][\"name\"] : nil\n id = issue[\"id\"]\n subject = issue[\"subject\"]\n description = issue[\"description\"]\n author = issue[\"author\"][\"name\"]\n # author_slack = Utils.convert_redmine_name_to_slack author\n assigned_to = issue[\"assigned_to\"] ? issue[\"assigned_to\"][\"name\"] : :not_assigned\n assigned_to_slack = Utils.convert_redmine_name_to_slack assigned_to\n tracker = issue[\"tracker\"][\"name\"]\n url = SlackAPI.url(issue_url(id), \"##{id}\")\n # updated = issue[\"updated_on\"]\n created = issue[\"created_on\"]\n\n description = RedmineSlackGlue.convert_textile_to_markdown(description.gsub(/\\n\\n/,\"\\n\"))\n color = RedmineSlackGlue.priority_to_color(issue[\"priority\"][\"id\"])\n\n puts \"#{issue[\"priority\"][\"id\"]} #{created} #{proj} ##{id} #{cat} #{subject}\" if self.verbose\n\n cat = RedmineSlackGlue.convert_category(cat)\n\n @slack_api.post({\n :channel => \"##{proj.downcase}\",\n :text => \"#{assigned_to_slack}: Ticket #{url} *#{subject}* - #{tracker}#{cat}\",\n :attachments => [{\n :fallback => RedmineSlackGlue.clean_markup(description),\n :color => color,\n :text => description,\n :mrkdwn_in=> [\"text\"]\n }],\n :username => \"#{author}\",\n :icon_url => REDMINE_ICON_URL\n })\n end",
"def leave_failure_comment\n most_recent_comment = @pull_request.comments.last || Curry::PullRequestComment.new\n potential_comment = @pull_request.comments.new(\n unauthorized_commit_authors: unauthorized_commit_emails_and_logins\n )\n\n if potential_comment.mentioned_commit_authors != most_recent_comment.mentioned_commit_authors\n @octokit.add_comment(\n @repository.full_name,\n @pull_request.number,\n failure_message\n ).tap do |comment|\n potential_comment.github_id = comment.id\n potential_comment.save!\n end\n else\n most_recent_comment.touch\n end\n end",
"def num_issue_comments(pr)\n q = <<-QUERY\n select count(*) as issue_comment_count\n from pull_requests pr, issue_comments ic, issues i\n where ic.issue_id=i.id\n and i.issue_id=pr.pullreq_id\n and pr.base_repo_id = i.repo_id\n and pr.id = ?\n and ic.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n db.fetch(q, pr[:id], pr[:id]).first[:issue_comment_count]\n end",
"def update_issue(issue_data, issue_task, build_number)\n \n issue_key = issue_data.key\n comments = @jira.getComments(issue_key)\n last_comment = comments.last\n\n # get the status\n status = STATUS.index(issue_data.status)\n if !status\n puts \"ERROR: unknown status for issue #{issue_key}: \"\n p issue_data\n return\n end\n\n puts \"status for issue #{issue_key} = #{status}\" if @dry_run\n\n # comment will be posted if\n # - the last comment wasn't already from the deploy notify script\n # - if the state is in :notyetstarted, :started, :finished or :rejected mode\n if (last_comment && !last_comment.body.start_with?(FIXED_COMMENT_PREFIX)) || !last_comment\n \n txt = String.new(FIXED_COMMENT_PREFIX) # comment should always begin with this\n txt << \"Fixed in Git and deployed with build #{build_number}\"\n\n if [:notyetstarted, :started, :finished, :rejected].include?(status)\n\n if status != :finished\n txt << \"\\n\\nNOTE: this issue is not in expected finished state... please verify and update status to delivered if necessary\"\n end\n\n comment = Jira4R::V2::RemoteComment.new()\n comment.body = txt\n\n begin\n @jira.addComment(issue_key, comment) if !@dry_run\n rescue => err\n puts \"ERROR: unable to add comment to issue issue #{issue_key}:\\n#{err}\"\n end\n\n # jira won't allow us to update status to delivered unless it's in rejected state\n if status == :finished\n puts \"updating issue #{issue_key} to status delivered\"\n begin\n @jira.progressWorkflowAction(issue_key, JIRA_ACTION_ID[:delivered], []) if !@dry_run\n rescue => err\n puts \"ERROR: unable to update issue #{issue_key}:\\n#{err}\"\n end\n else\n puts \"issue #{issue_key} is in unexpected status #{status}, not updating status.\"\n end\n end\n end\n end",
"def new_comment\n Notifications.new_comment\n end",
"def _comment db, id, text\n rowid = db.sql_comments_insert id, text\n puts \"Comment #{rowid} created\"\n handle = db.db\n \n commcount = handle.get_first_value( \"select count(id) from comments where id = #{id};\" )\n commcount = commcount.to_i\n db.sql_update \"bugs\", id, \"comment_count\", commcount\n rowid = db.sql_logs_insert id, \"comment\", Cmdapp.truncate(text, 50)\n end",
"def ensure_issue_comments(owner, repo, issue_id, pull_req_id = nil)\n currepo = ensure_repo(owner, repo)\n\n if currepo.nil?\n warn \"Could not find repository #{owner}/#{repo} for retrieving issue comments for issue #{issue_id}\"\n return\n end\n\n issue = if pull_req_id.nil?\n ensure_issue(owner, repo, issue_id, false, false, false)\n else\n db[:issues].first(:pull_request_id => pull_req_id)\n end\n\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving issue comments\"\n return\n end\n\n retrieve_issue_comments(owner, repo, issue_id).reduce([]) do |acc, x|\n\n if db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => x['id']).nil?\n acc << x\n else\n acc\n end\n end.map { |x|\n save{ensure_issue_comment(owner, repo, issue_id, x['id'], pull_req_id)}\n }.select{|x| !x.nil?}\n end",
"def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend",
"def test02_post_closed_board_ArticleOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 2\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend",
"def test05_post_closed_news_FlagMediaComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_note)\n\t\t\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_success.exists?\n\tend",
"def test03_post_closed_news_MediaOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend",
"def news_comment_added_with_change(comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => news.recipients,\n :cc => news.watcher_recipients,\n :subject => \"Re: [#{news.project.to_s}] #{l(:label_news)}: #{news.title}\"\n end",
"def redmine_add_comment(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tresulted_task = redmine_check_task(m, params, certificate)\n\t\t\tif ! resulted_task.nil?\n\t\t\t\t# Best way to save text line\n\t\t\t\tmessageEntry = params[:message].to_s.strip\n\t\t\t\t# Ajout d'un commentaire\n\t\t\t\tresulted_task.notes = messageEntry\t\n\t\t\t\t# Save an issue\n\t\t\t\tif ! resulted_task.save\n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\t@bot.say m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasnotbeenupdated}\"\n\t\t\t\telse \n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\t@bot.say m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasbeenupdated} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{resulted_task.id}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_thetask} ##{params[:task]} #{@redmine_l_doesnotexistsinredmine}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end",
"def send_inline_comment(issues)\n target_files = (git.modified_files - git.deleted_files) + git.added_files\n dir = \"#{Dir.pwd}/\"\n issues.each do |issue|\n location = issue.parent\n filename = location.get(\"name\").gsub(dir, \"\")\n next unless !filtering || (target_files.include? filename)\n line = (issue.get(\"line\") || \"0\").to_i\n message = issue.get(\"message\")\n severity = issue.get(\"severity\")\n if severity_index(severity) >= severity_index(fail_level)\n fail(message, file: filename, line: line)\n elsif severity_index(severity) >= severity_index(comment_level)\n warn(message, file: filename, line: line)\n end\n end\n end",
"def trigger_comment(comment) end",
"def test03_post_closed_board_MediaOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 2\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend",
"def find_comment\n assert_not_nil @rdigg.stories.find_comment(\"7987660\", \"65434\")\n end",
"def num_issue_comments(pr_id)\n q = <<-QUERY\n select count(*) as issue_comment_count\n from pull_requests pr, issue_comments ic, issues i\n where ic.issue_id=i.id\n and i.issue_id=pr.pullreq_id\n and pr.base_repo_id = i.repo_id\n and pr.id = ?\n and ic.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n if_empty(db.fetch(q, pr_id, pr_id).all, :issue_comment_count)\n end",
"def create\n @comment = @issue.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @issue_path, notice: 'Comment is succesfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hash_tag_comments_issue(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).\\\n select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n acc\n end\n end\n end",
"def add_comment\n return client.add_comment(repository, pr_id, report_urls.comment_body) unless comment\n\n client.update_comment(repository, comment[:id], report_urls.comment_body(comment[:body]))\n end",
"def test02_post_closed_news_ArticleOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_article)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend",
"def rude_comment\n @res.write GO_AWAY_COMMENT\n @res.status = 404\n end",
"def comment args #id, comment\n id = args.shift\n unless id\n id = ask(\"Issue Id? \", Integer)\n end\n db, row = validate_id id, true\n die \"No issue found for #{id}\" unless row\n if !args.empty?\n comment = args.join(\" \")\n else\n message \"Enter a comment (. to exit): \"\n comment = Cmdapp.get_lines\n end\n die \"Operation cancelled\" if comment.nil? or comment.empty?\n message \"Comment is: #{comment}.\"\n message \"Adding comment to #{id}: #{row['title']}\"\n _comment db, id, comment\n 0\n end",
"def test05_post_open_board_FlagMediaComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_open_note)\n\t\t\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\t\n\t\tassert $comment_flag_success.exists?\n\tend",
"def comment comment\n end",
"def issue\n @issue ||= Gitmine::Issue.get_for_commit(message)\n end",
"def bug?\n @issue_type.casecmp('bug') == 0\n end",
"def reopen!(comment, is_private = false)\n @client.update_bug(id, status: 'REOPENED', comment: { body: comment.to_s, is_private: is_private.to_b })\n end",
"def comment?; end",
"def comment?; end",
"def on_message(params)\n @jira.comment_on(:issue => @issue, :comment => params[:msg])\n end",
"def show\n @issue = Issue.find(params[:id])\n @comment = Comment.new\n \n if current_tester != nil\n @tester = Tester.find(current_tester)\n #@comment.tester_id = @tester.id\n elsif current_user\n @user = User.find(current_user)\n #@comment.user_id = @user.id\n end\n \n #@comment.issue_id = @issue.id\n \n @commentofissue = @issue.comments.order(\"created_at DESC\")\n ##@commentofissue = @commentofissue.order(\"created_at DESC\")\n\n end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def describe_issue;\n puts @issue\n end",
"def issue_comments(owner, repo, pr_id)\n Thread.current[:issue_id] ||= pr_id\n\n if pr_id != Thread.current[:issue_id]\n Thread.current[:issue_id] = pr_id\n Thread.current[:issue_cmnt] = nil\n end\n\n Thread.current[:issue_cmnt] ||= Proc.new {\n issue_comments = mongo.get_underlying_connection['issue_comments']\n ic = issue_comments.find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => pr_id.to_i},\n {:fields => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => :asc}}\n ).map {|x| x}\n\n }.call\n Thread.current[:issue_cmnt]\n end",
"def issue\n @issue ||= Issue.get_for_commit(message)\n end",
"def news_comment_added(user, comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def test02_post_closed_blog_CancelFlagArticleComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_closed_article)\n\t\t\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend",
"def show\n @issue = Issue.find(params[:id])\n @feedback = Feedback.find(params[:feedback_id])\n @comment = Comment.new\n\n if current_tester != nil\n @tester = Tester.find(current_tester)\n #@comment.tester_id = @tester.id\n elsif current_user\n @user = User.find(current_user)\n #@comment.user_id = @user.id\n end\n\n #@comment.issue_id = @issue.id\n\n @numissue = @issue.comments.all\n @commentofissue = @issue.comments.order(\"created_at DESC\")\n ##@commentofissue = @commentofissue.order(\"created_at DESC\")\n\n end",
"def issue_comments(owner, repo, pr_id)\n Thread.current[:issue_id] ||= pr_id\n\n if pr_id != Thread.current[:issue_id]\n Thread.current[:issue_id] = pr_id\n Thread.current[:issue_cmnt] = nil\n end\n\n Thread.current[:issue_cmnt] ||= Proc.new {\n issue_comments = mongo['issue_comments']\n ic = issue_comments.find(\n {'owner' => owner, 'repo' => repo, 'issue_id' => pr_id.to_i},\n {:fields => {'body' => 1, 'created_at' => 1, '_id' => 0},\n :sort => {'created_at' => :asc}}\n ).map {|x| x}\n\n }.call\n Thread.current[:issue_cmnt]\n end",
"def _get_comments_from_gh()\n comments = []\n page = 1\n done = false\n until done\n puts \"Comment Page #{page}\"\n newcomments = self.client.issues_comments( REPO, { :page => page} )\n comments += newcomments\n done = newcomments == []\n page = page + 1\n end\n return comments\n end",
"def add_comment(issue_key, comment)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}/comment\"\n post = {\"body\" => comment}\n options = [@login_options, {\"data\" => post}].inject(:merge)\n result = rest_call(url, \"post\", options)\n log result.inspect\n result\n end",
"def send_comment_email\n\t\tNotificationMailer.comment_added(self).deliver_now\n\tend",
"def create_issue_comment(repo, issue_number, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"#{Repository.path repo}/issues/#{issue_number}/comments\", opts\n end",
"def issue_reported_at(issue)\n date = issue.created_at.to_date\n content = if date == Date.today\n t(\"labels.today\")\n else\n date\n end\n issue_label(t(\"labels.opened\"), content)\n end",
"def test04_FlagNoteComment\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def edit_comment\n verify_ajax_request\n verify_post_request\n require_parameters :key, :text\n\n text = Api::Utils.read_post_request_param(params[:text])\n comment = Internal.issues.editComment(params[:key], text)\n\n @issue_results = Api.issues.find(comment.issueKey)\n render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}\n end",
"def comment\n @comment\n end",
"def test03_post_open_news_MediaOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend",
"def comment\n EventMailer.comment\n end",
"def test02_flag_repost_article_TC_24323\n\t\trepostArticlePop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T2: FAILED! User unable to flag post.\"\n\t\tend\n\tend",
"def new_issue(issue)\n @issue = issue\n\n mail subject: \"New Issue Ticket\"\n end",
"def hash_tag_description_issue(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n 0\n end\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def comments\n if has_comments?\n @repository.load(:comments, number).map do |item|\n Github::Issue::Comment.new(item)\n end\n else \n []\n end\n end",
"def issue_comment(user_name, repo_name, comment_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of comment_id\n\n _normalize_params_keys(params)\n _merge_mime_type(:issue_comment, params)\n\n get(\"/repos/#{user}/#{repo}/issues/comments/#{comment_id}\", params)\n end",
"def new_comment(comment)\n @greeting = \"Hi!\"\n @id = comment.workout.id\n @title = comment.workout.title\n @user = comment.user\n mail to: comment.workout.user.email\n end",
"def edited_comment_notification(user_id, comment_id)\n user = User.find(user_id)\n @comment = Comment.find(comment_id)\n mail(\n :to => user.email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Edited comment on \" + @comment.ultimate_parent.commentable_name.gsub(\">\", \">\").gsub(\"<\", \"<\")\n )\n end",
"def new_comment(comment, commenter, author, question)\n if author.privacy_setting.notify_on_post_comment \n @comment, @commenter, @author, @post = comment, commenter, author, question\n mail(\n :subject => \"#{@commenter.name.titleize} just commented on your post.\",\n :from => \"noreply@studyhall.com\",\n :to => author.email,\n :date => Time.now\n )\n end\n end",
"def comment_finished?\n\t\t\n\tend",
"def changes(comment)\n @comment = comment\n\n mail to: [@comment.video.project.users.pluck(:email)],\n subject: 'New Comment on ' + @comment.video.project.title\n end",
"def add_comment(issue_id_or_key, content, params = {})\n params[:content] = content\n post(\"issues/#{issue_id_or_key}/comments\", params)\n end",
"def came_comment\n @user = @receiver\n link = \"/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}\"\n @notification = @user.notifications.find_by(link: link) || @user.notifications.find_by(link: \"#{link}#latest-comment\")\n mail to: @user.email, subject: \"[FBC] #{@message}\"\n end",
"def pr_description\n danger_file.warn('Please provide a summary in the Pull Request description') if danger_file.github.pr_body.length < 3 && danger_file.git.lines_of_code > 10\n end",
"def test05_FlagArticleComment\n\t\tcommentArticlePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T05: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend"
] |
[
"0.70737815",
"0.69501215",
"0.68452954",
"0.6840894",
"0.68098",
"0.6767442",
"0.67499447",
"0.66790026",
"0.66107583",
"0.6589401",
"0.6564454",
"0.6521666",
"0.6515517",
"0.64913505",
"0.64690477",
"0.6453413",
"0.64386034",
"0.64009255",
"0.6387006",
"0.6346783",
"0.63445544",
"0.6319888",
"0.6269711",
"0.6267146",
"0.6251506",
"0.6243454",
"0.6243198",
"0.62416047",
"0.62412614",
"0.6227686",
"0.62169135",
"0.62090695",
"0.62016314",
"0.61970603",
"0.6162722",
"0.6160392",
"0.6144256",
"0.613341",
"0.6124569",
"0.6118179",
"0.6114979",
"0.6111493",
"0.61086303",
"0.61003906",
"0.61001915",
"0.6091281",
"0.6088167",
"0.60770553",
"0.60770553",
"0.60761064",
"0.6049282",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6048469",
"0.6047028",
"0.6036263",
"0.60268134",
"0.60201335",
"0.60156304",
"0.60103035",
"0.6006901",
"0.6003126",
"0.5990505",
"0.59744126",
"0.5969537",
"0.5967866",
"0.5954274",
"0.5950945",
"0.59457403",
"0.5945093",
"0.59431964",
"0.5938708",
"0.593639",
"0.5924954",
"0.5915445",
"0.5904415",
"0.59007573",
"0.58976316",
"0.5896965",
"0.5896388",
"0.5889827",
"0.58821964",
"0.58807945",
"0.587783",
"0.58764726",
"0.5871649"
] |
0.6461348
|
15
|
A PR review has been reported
|
def process_created_review(review_payload)
pr_name = review_payload['repository']['full_name'].to_s
pr_number = review_payload['pull_request']['number'].to_s
comment_user = review_payload['review']['user']['id'].to_s
approvals = evaluate_review_state(review_payload['review']['state'])
current_commit_hash = review_payload['pull_request']['head']['sha'].to_s
submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def apply(pr, pull_request_hash)\n if !previously_applied?(pr) && matches?(pull_request_hash)\n add_reviewer(pr)\n end\n end",
"def review\n end",
"def review; end",
"def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`\n result.message << \"Head Branch check |\"\n is_from_feature = github.branch_for_head.start_with?(\"feature/\")\n is_from_refactor = github.branch_for_head.start_with?(\"refactor/\")\n is_from_fix = github.branch_for_head.start_with?(\"fix/\")\n is_from_issue = github.branch_for_head.start_with?(\"issue/\")\n is_from_version = github.branch_for_head.start_with?(\"version/\")\n if is_from_feature || is_from_refactor || is_from_fix || is_from_issue || is_from_version\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR from a from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `develop` branch\n result.message << \"Base Branch check |\"\n is_to_develop = github.branch_for_base == \"develop\"\n if is_to_develop\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR to `develop` branch.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## If PR is sent from a branch that begins with `version/`, do a release modification check\n if is_from_version\n release_modification_check_into_result(result)\n end\n\n ## PR shouldn't contain any merge commits\n result.message << \"Merge Commits check |\"\n contains_merge_commits = git.commits.any? { |c| c.parents.length > 1 }\n unless contains_merge_commits\n result.message << \":o:\\n\"\n else\n fail \"Please don't contain any merge commits in the branch. Consider Rebase if required.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should have less than 1000 lines of modifications if possible.\n result.message << \"Modification Volumn check |\"\n is_fix_too_big = git.lines_of_code > 1_000\n unless is_fix_too_big\n result.message << \":o:\\n\"\n else\n warn \"Too many modifications. Please consider splitting the PR if possible.\"\n result.message << \":heavy_exclamation_mark:\\n\"\n result.warnings += 1\n end\n\n return result\n\nend",
"def reviewed?\n @status == :reviewed\n end",
"def pending_repost?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Pending Repost'\").id\n end",
"def closed_submission_status\n 'Closed for Review'\n end",
"def release_pr_check\n\n result = CheckResult.new(\"Release PR Check Result\")\n\n ## PR should be sent from `develop` branch\n result.message << \"Head Branch check |\"\n is_from_develop = github.branch_for_head == \"develop\"\n if is_from_develop\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR from `develop` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `master` branch\n result.message << \"Base Branch check |\"\n is_to_master = github.branch_for_base == \"master\"\n if is_to_master\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR to `master` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## Release modification check\n release_modification_check_into_result(result)\n\n return result\n\nend",
"def test_ID_25863_comment_on_review()\n login $user_1_email, $master_password\n read_all_updates\n \n $browser.goto(\"http://flatiron.#{$environment}.patch.com/listings/yelp\")\n $share_review_text_field.when_present().click\n $post_compose_review.when_present().set (\"Automated review text #{random}\")\n $group_post_button.when_present().click\n\n logout_common\n login $user_1_email, $master_password\n $browser.goto(\"http://flatiron.#{$environment}.i.patch.com/listings/yelp\")\n $comment_icon.click\n sleep 3\n $leave_comment_textfield.set \"Automated comment text #{random}\"\n $group_post_comment.click\n logout_common\n login $user_1_email, $master_password\n verify_updates\n end",
"def create\n @review = Review.new(review_params)\n @review.memberid = current_account.id\n @state = false\n if @review.save\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.committee.tracks.each do |track| \n if( track.userid == current_account.id && track.role == \"PC Member\" )\n @state = true\n end\n end\n if(@state)\n respond_to do |format|\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n end\n else\n @review.destroy\n redirect_to @paper.committee.conference, notice: \"You are not an PC member of that committee. Review not created.\"\n end\n else\n respond_to do |format|\n format.html { render :new}\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_ID_25863_comment_on_review()\n login_as_user1\n read_all_updates\n share_review(\"outside-in\")\n logout_common\n login_as_user2\n leave_comment_on_share_review_group(\"outside-in\")\n logout_common\n login_as_user1\n verify_updates\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def review\n return access_denied unless @course.has_teacher(current_user) || @submission.group.has_reviewer?(current_user) || (@exercise.collaborative_mode == 'review' && (@course_instance.has_student(current_user) || @course_instance.has_assistant(current_user)))\n\n review = @submission.assign_to(current_user)\n\n redirect_to edit_review_path(review)\n log \"create_review #{@submission.id},#{@exercise.id}\"\n end",
"def submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n pr_key = pr_name + \":\" + pr_number\n\n # Grab the stored payload\n stored_payload_value = @redis.hget(pr_key, current_commit_hash)\n\n # Ensure that a key actually exists\n if !stored_payload_value.nil?\n stored_payload = JSON.parse(stored_payload_value)\n plus_ones = stored_payload['plus_one_count'].to_i\n authors = stored_payload['authors']\n creator = stored_payload['creator'].to_s\n\n # Check if the commenting user is the creator or has already commented\n is_comment_user_creator_or_author = authors.include?(comment_user) || creator === comment_user\n\n plus_ones_to_add = is_comment_user_creator_or_author ? 0 : approvals\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n # Update authors list\n if !authors.include?(comment_user)\n authors.push(comment_user)\n end\n\n payload_to_store = {\n :plus_one_count => plus_ones,\n :authors => authors,\n :creator => creator,\n }\n\n # Store the new payload data\n @redis.hset(pr_key, current_commit_hash, payload_to_store.to_json)\n\n if plus_ones >= NEEDED_PLUS_ONES\n status = 'success'\n else\n status = 'pending'\n end\n\n @client.create_status(\n pr_name,\n current_commit_hash,\n status,\n {\n 'description' => '(' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') required approvals.',\n 'context' => 'robinpowered/commodus'\n }\n ) \n else\n return 404\n end\n\n return 200\n end",
"def title_of_active_review\n conflicting_request_issue.try(:review_title)\n end",
"def notify\n reviewers = proposal.reviewers.reject{|r| r.id == user_id }\n Notification.create_for(reviewers, proposal: proposal, message: \"Internal comment on #{proposal.title}\")\n end",
"def add_review\n login_as(User.where(role_id: 1).first.name)\n expect(page).to have_content 'User: ' + User.where(role_id: 1).first.name\n\n expect(page).to have_content 'TestAssignment'\n\n click_link 'TestAssignment'\n expect(page).to have_content 'Submit or Review work for TestAssignment'\n expect(page).to have_content \"Others' work\"\n\n click_link \"Others' work\"\n expect(page).to have_content 'Reviews for \"TestAssignment\"'\n\n choose 'topic_id'\n click_button 'Request a new submission to review'\n\n click_link 'Begin'\n\n fill_in 'responses[0][comment]', with: 'HelloWorld'\n select 3, from: 'responses[0][score]'\n click_button 'Submit Review'\n expect(page).to have_content 'Your response was successfully saved.'\n click_link 'Logout'\n end",
"def pr_description\n danger_file.warn('Please provide a summary in the Pull Request description') if danger_file.github.pr_body.length < 3 && danger_file.git.lines_of_code > 10\n end",
"def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end",
"def under_review_status\n 'Under Review'\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr)\n merged = !pr[:merged_at].nil?\n git_merged, merge_reason, merge_person = @close_reason[pr[:github_id]]\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad src lines: 0, pr: #{pr[:github_id]}, id: #{pr[:id]}\") end\n\n months_back = 3\n commits_incl_prs = commits_last_x_months(pr, false, months_back)\n prev_pull_reqs = prev_pull_requests(pr,'opened')\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr),\n :forward_links => forward_links?(pr),\n :team_size => team_size_at_open(pr, months_back),\n :num_commits => num_commits(pr),\n :num_commits_open => num_commits_at_open(pr),\n :num_pr_comments => num_pr_comments(pr),\n :num_issue_comments => num_issue_comments(pr),\n :num_commit_comments => num_commit_comments(pr),\n :num_comments => num_pr_comments(pr) + num_issue_comments(pr) + num_commit_comments(pr),\n :num_participants => num_participants(pr),\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => commits_last_x_months(pr, true, months_back) / commits_incl_prs,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr, months_back),\n :commits_to_hottest_file => commits_to_hottest_file(pr, months_back),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr),\n :requester => requester(pr),\n :closer => closer(pr),\n :merger => merge_person,\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr, 'merged').to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr),\n :intra_branch => if intra_branch?(pr) == 1 then true else false end,\n :main_team_member => main_team_member?(pr, months_back),\n :social_connection_tsay => social_connection_tsay?(pr),\n :hotness_vasilescu => hotness_vasilescu(pr, months_back),\n :team_size_vasilescu => team_size_vasilescu(pr, months_back),\n :description_complexity => description_complexity(pr),\n :workload => workload(pr),\n :prior_interaction_issue_events => prior_interaction_issue_events(pr, months_back),\n :prior_interaction_issue_comments => prior_interaction_issue_comments(pr, months_back),\n :prior_interaction_pr_events => prior_interaction_pr_events(pr, months_back),\n :prior_interaction_pr_comments => prior_interaction_pr_comments(pr, months_back),\n :prior_interaction_commits => prior_interaction_commits(pr, months_back),\n :prior_interaction_commit_comments => prior_interaction_commit_comments(pr, months_back),\n :first_response => first_response(pr),\n :ci_latency => ci_latency(pr),\n :ci_errors => ci_errors?(pr),\n :ci_test_failures => ci_test_failures?(pr),\n }\n end",
"def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend",
"def create_pull_request_review(repo, pull_request_number, event, body = nil, options = {})\n review = {\n event: event,\n accept: CUSTOM_ACCEPT_HEADER\n }\n review[:body] = body unless body.nil?\n post \"#{Repository.path repo}/pulls/#{pull_request_number}/reviews\", options.merge(review)\n end",
"def process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n comment_user = issue_comment_payload['comment']['user']['id'].to_s\n approvals = parse_comment_body(issue_comment_payload['comment']['body'])\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n end",
"def review\n @review\n end",
"def update\n @review = Review.find(params[:id])\n @submission = ReviewSubmission.new(:review_id => @review.id, :submission_date => Time.now)\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n if @submission.save\n SubmissionNotifier.deliver_resubmission_notification(@submission)\n format.html { redirect_to(@review, :notice => 'Review and Submission were successfully created.') }\n else\n format.html { redirect_to(@review, :notice => 'Review was successfully created but the submission was not.') }\n end\n format.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def review(review)\n @review = review\n @exercise = @review.submission.exercise\n @course_instance = @exercise.course_instance\n @course = @course_instance.course\n @grader = @review.user\n group = review.submission.group\n\n if !@course.email.blank?\n headers[\"Reply-to\"] = @course.email\n elsif !@exercise.anonymous_graders && @grader && !@grader.email.blank?\n headers[\"Reply-to\"] = @grader.email\n end\n\n # Collect receiver addresses\n recipients = []\n group.group_members.each do |member|\n if !member.email.blank?\n recipients << member.email\n elsif member.user && !member.user.email.blank?\n recipients << member.user.email\n end\n end\n\n if recipients.empty?\n # TODO: raise an exception with an informative message\n review.status = 'finished'\n review.save\n return\n end\n \n # Attachment\n unless @review.filename.blank?\n attachments[@review.filename] = File.read(@review.full_filename)\n end\n \n subject = \"#{@course.full_name} - #{@exercise.name}\"\n \n if review.type == 'AnnotationAssessment'\n template_name = 'annotation'\n @review_url = review_url(review.id, :group_token => group.access_token, :protocol => 'https://')\n else\n template_name = 'review'\n end\n \n I18n.with_locale(@course_instance.locale || I18n.locale) do\n mail(\n :to => recipients.join(\",\"),\n :subject => subject,\n :template_path => 'feedback_mailer',\n :template_name => template_name\n )\n #:reply_to => from,\n end\n\n # Set status\n review.status = 'mailed'\n review.save\n end",
"def create_pull_review(repo, pull_number, options = {})\n post \"#{Repository.path repo}/pulls/#{pull_number}/reviews\", options\n end",
"def review_bottlenecks\n pull_requests = non_reviewed_pull_requests\n notify_review(pull_requests) if pull_requests.length >= config['flow']['pending_pr_to_notify']\n end",
"def process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n plus_ones = @redis.hget(pr_name + \":\" + pr_number, current_commit_hash)\n\n # Ensure that a key actually exists\n if !plus_ones.nil?\n plus_ones_to_add = parse_comment_body(issue_comment_payload['comment']['body'])\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones.to_i + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n @redis.hset(pr_name + \":\" + pr_number, current_commit_hash, plus_ones)\n\n if plus_ones >= NEEDED_PLUS_ONES\n # Set commit status to sucessful\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'success',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has been reached!',\n 'context' => 'robinpowered/commodus'\n }\n )\n else\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'pending',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has yet to be reached.',\n 'context' => 'robinpowered/commodus'\n }\n )\n end\n end\n\n return 200\n end",
"def review_posted(email,permalink) \n @service_permalink = permalink \n subject = \"A review was posted for your service\"\n setup_email(email, subject)\n end",
"def review(campaign_id)\n\t\tif @campaign = Campaign.find(campaign_id)\n\t\t\t@user = @campaign.user\n\t\t\tif @campaign.user.locale\n\t\t\t\tI18n.locale = @campaign.user.locale\n\t\t\tend\n\t\t\tif @campaign.status == \"Approved\"\n\t\t\t\t@subject = t('mailer.studio.campaigns.review.you_are_now_a_ratafire') + t('mailer.studio.campaigns.review.creator')\n\t\t\t\t@line1 = t('mailer.studio.campaigns.review.welcome') + @campaign.user.preferred_name + \"!\"\n\t\t\t\t@line2 = t('mailer.studio.campaigns.review.your_project') + @campaign.title + t('mailer.studio.campaigns.review.is_now_live')\n\t\t\t\t@link = t('mailer.layout.view_on_ratafire')\n\t\t\telse\n\t\t\t\t@subject = t('mailer.studio.campaigns.review.your_application_is_declined')\n\t\t\t\t@line1 = t('mailer.studio.campaigns.review.sorry') + @campaign.user.preferred_name\n\t\t\t\t@line2 = t('mailer.studio.campaigns.review.your_project') + @campaign.title + t('mailer.studio.campaigns.review.is_not_approved')\n\t\t\t\t@link = t('mailer.layout.back_to_ratafire')\n\t\t\tend\n\t\t\tmail to: @campaign.user.email, subject: @subject\n\t\tend\n\tend",
"def submit_pull_request_review(repo, pull_request_number, review_id, event, body = nil, options = {})\n review = {\n event: event,\n accept: CUSTOM_ACCEPT_HEADER\n }\n review[:body] = body unless body.nil?\n post \"#{Repository.path repo}/pulls/#{pull_request_number}/reviews/#{review_id}/events\", options.merge(review)\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr[:id])\n\n merged = ! pr[:merged_at].nil?\n git_merged = false\n merge_reason = :github\n\n if not merged\n git_merged, merge_reason = merged_with_git?(pr)\n end\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad number of lines: #{0}\") end\n\n commits_last_3_month = commits_last_x_months(pr[:id], false, 3)[0][:num_commits]\n prev_pull_reqs = prev_pull_requests(pr[:id],'opened')[0][:num_pull_reqs]\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr[:login], pr[:project_name], pr[:github_id]),\n :forward_links => forward_links?(pr[:login], pr[:project_name], pr[:github_id]),\n :team_size => team_size_at_open(pr[:id], 3)[0][:teamsize],\n :num_commits => num_commits(pr[:id])[0][:commit_count],\n :num_commit_comments => num_comments(pr[:id])[0][:comment_count],\n :num_issue_comments => num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_comments => num_comments(pr[:id])[0][:comment_count] + num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_participants => num_participants(pr[:id])[0][:participants],\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => ((commits_last_3_month - commits_last_x_months(pr[:id], true, 3)[0][:num_commits]) * 100) / commits_last_3_month,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr[:id], Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 90)),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr[:id])[0][:num_watchers],\n :requester => requester(pr[:id])[0][:login],\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr[:id], 'merged')[0][:num_pull_reqs].to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr[:id])[0][:num_followers],\n :intra_branch => if intra_branch?(pr[:id])[0][:intra_branch] == 1 then true else false end,\n :main_team_member => if main_team_member?(pr[:id])[0][:main_team_member] == 1 then true else false end\n }\n end",
"def can_review(cp)\n cps_as_reviewer.include?(cp)\n end",
"def pending_review\n reviews = Review.where(\"stage != ?\", \"approved\")\n all_cps_under_review = []\n user_cps_under_review = []\n\n reviews.each do |review|\n all_cps_under_review << review.critical_process\n end\n\n all_cps_under_review.each do |cp|\n if self.cps_as_reviewer.include?(cp)\n user_cps_under_review << cp\n end\n end\n\n return user_cps_under_review\n end",
"def post_review?(next_review, user)\n\n (next_review && \n !self.review_locked? && \n next_review.designer_id == user.id &&\n next_review.review_type_id == next_review.design.phase_id)\n\n end",
"def review_committee_decision\n application_review_decision_type.title if application_review_decision_type\n end",
"def submit_pull_review(repo, pull_number, review_id, event, options = {})\n opts = options.dup\n opts[:event] = event.to_s.downcase\n post \"#{Repository.path repo}/pulls/#{pull_number}/reviews/#{review_id}/events\", opts\n end",
"def create_pull_request(oauth_token, source_branch, base_branch, pr_title, pr_body, reviewers)\n client = Octokit::Client.new(access_token: oauth_token)\n pull_number = client.create_pull_request(full_repo_name, base_branch, source_branch, pr_title, pr_body)[:number]\n client.request_pull_request_review(full_repo_name, pull_number, reviewers: reviewers)\n end",
"def just_reviewed?\n reviewed? and reviewed_changed?\n end",
"def conclusion_review_notification\n user = User.joins(reviews: :conclusion_final_review).take\n review = user.reviews.joins(:conclusion_final_review).take\n conclusion_review = review.conclusion_final_review\n organization = review.organization\n\n conclusion_review.to_pdf\n\n NotifierMailer.conclusion_review_notification user, conclusion_review, organization_id: organization.id\n end",
"def create\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n @review.project_id = @project.id\n\n respond_to do |format|\n if @review.save\n if current_user.admin?\n # Deliver the confirmation\n UserNotifier.send_confirmation_review_ready(@review.project.user, self).deliver\n else\n UserNotifier.send_confirmation_review(@review.project.user, self).deliver\n end\n\n format.html { redirect_to @project, notice: 'your message has been successfully sent' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hash_tag_comments_pr(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).\\\n select do |x|\n pull_request?(pr, x[0].to_i)\n end.size\n else\n acc\n end\n end\n end",
"def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end",
"def create\n @review = Review.new(params[:review])\n @review.submitter = current_user\n\n respond_to do |format|\n if @review.save\n @submission = ReviewSubmission.new(:review_id => @review.id, :submission_date => Time.now)\n if @submission.save\n SubmissionNotifier.deliver_new_submission_notification(@submission)\n format.html { redirect_to(@review, :notice => 'Review and Submission were successfully created.') }\n else\n format.html { redirect_to(@review, :notice => 'Review was successfully created but the submission was not.') }\n end\n format.xml { render :xml => @review, :status => :created, :location => @review }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def send_document_review_notification\n if value == 'verified'\n EventAPI.notify('system.document.verified', record: as_json_for_event_api)\n elsif value == 'rejected'\n EventAPI.notify('system.document.rejected', record: as_json_for_event_api)\n end\n end",
"def create\n @review = Review.new(review_params)\n @review.exceptional ||= 0\n if @review.save\n @apn.update_attribute(:reviewed, true)\n link = reviews_path\n name = @apn.profile.first_name.capitalize + \" \".to_s + @apn.profile.last_name.capitalize\n redirect_to new_review_path, notice: (\"#{name} successfully reviewed.\" +\n \" New application loaded. If you're feeling lazy, <a href='#{link}'>\" +\n \"go to the Dashboard</a>\").html_safe\n else\n render action: \"new\", alert: \"something went wrong with submitting the review\"\n end\n end",
"def num_pr_comments(pr)\n q = <<-QUERY\n select count(*) as comment_count\n from pull_request_comments prc\n where prc.pull_request_id = ?\n and prc.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n QUERY\n db.fetch(q, pr[:id], pr[:id]).first[:comment_count]\n end",
"def skip_pr?(pr)\n return false unless pr[:title].include?(SKIP_MERGE)\n\n failure_status(pr, \"Skipping #{pr[:head][:ref]}.\")\n\n true\n end",
"def update_release_review_poster(release_reviewer, user)\n\n if self.review_type.name == \"Release\" &&\n self.review_status.name != \"Review Completed\" &&\n release_reviewer && self.designer_id != release_reviewer.id\n\n self.record_update('Release Poster', \n self.designer.name, \n release_reviewer.name,\n user)\n\n self.designer_id = release_reviewer.id\n self.save\n \n true\n else\n false\n end\n\n end",
"def review_complete?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review Completed'\").id\n end",
"def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def eol_need_review # :norobots:\n eol_data(['unreviewed'])\n @title = :eol_need_review_title.t\n render(:action => 'eol_preview')\n end",
"def create\n @m = current_member\n @review = Review.new(review_params(params).merge(:member => @m, :status => (@m.is_public? ? \"list\" : \"hide\")))\n @review.local_site = @local_site\n @review.referrer_code = params[:ref]\n story = @review.story\n\n # SSS: Weird bug? What is going on? Excerpts are lost if they aren't inspected and hence materialized?\n # Am I doing something wrong with setting these up?\n @review.excerpts.inspect\n\n # Update story information since the story could be reviewed from the todays feeds page where the\n # story status is not yet list, and the submitter is still bot!\n params[:story][:status] = Story::LIST if (story.status == Story::QUEUE) || (story.status == Story::PENDING)\n params[:story][:submitted_by_id] = @m.id if (story.submitted_by_id == Member.nt_bot.id)\n\n update_story_attributes(@review, params[:story]); story.reload # reload story after save\n update_member_settings(@review, params[:review_form_expanded])\n update_source_review(story, params[:source_ratings])\n\n begin\n saved = @review.save_and_process_with_propagation\n rescue ActiveRecord::StatementInvalid => e\n # Likely double submits that got through any front-end protections we have!\n logger.error \"Exception #{e} trying to save review for #{story.id} by member #{@m.id}. Recovering!\"\n\n # Fetch saved review -- turn off tweet (to prevent a duplicate tweet!)\n @review = Review.find_by_story_id_and_member_id(story.id, @m.id)\n if @review\n saved = true\n if params[:post_on_twitter] == \"1\"\n params[:post_on_twitter] = nil\n notice = \"Your review might have been tweeted. Because of an unexpected error, we cannot confirm this. Please check your twitter stream.\"\n end\n params[:post_on_facebook] = nil\n else\n saved = false\n end\n end\n\n if saved\n notice = tweet_if_requested(@review, params[:short_url])\n with_message = @m.status == \"guest\" ? :guest : !@m.is_public? ? :suspended : nil\n render :json => { :go => :story_actions,\n :form_transition => {:from => :review, :to => :story_actions},\n :delayed_form_reload => [:review], # No need to forcibly reload the entire toolbar right away!\n :notice => notice,\n :fb_stream_story => toolbar_facebook_stream_story(@review),\n :with_message => with_message }.to_json\n else\n # If we get an error in saving the review, it is likely because of double submits that got through any front-end checks we have!\n render :json => {:error_message => \"Failed to save review. Please try again.\"}.to_json\n end\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 assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n github_client.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend",
"def db_insert_pr_reviews(db, comments, org, repo)\n comments.each do |comment|\n db[\"DELETE FROM item_comments WHERE id=?\", comment.id].delete\n # eg: https://github.com/amzn/oss-dashboard/pull/1#discussion_r207199796\n itemNumber=comment.html_url.sub(/^.*\\/([0-9]*)#discussion_r[0-9]*$/, '\\1')\n user=comment.user ? comment.user.login : nil\n db[\n \"INSERT INTO item_comments (\n id, org, repo, item_number, user_login, body, created_at, updated_at\n )\n VALUES ( ?, ?, ?, ?, ?, ?, ?, ? )\",\n comment.id, org, repo, itemNumber, user, comment.body, gh_to_db_timestamp(comment.created_at),\n gh_to_db_timestamp(comment.updated_at)].insert\n end\n end",
"def create_pr\n ErrorEmittingExecutor.execute(\"hub pull-request -f -m '#{COMMIT_DESCRIPTION}'\")\nend",
"def description_complexity(pr)\n pull_req = pull_req_entry(pr[:id])\n (pull_req['title'] + ' ' + pull_req['body']).gsub(/[\\n\\r]\\s+/, ' ').split(/\\s+/).size\n end",
"def pre_submission_date_status\n 'New Announcement'\n end",
"def test_add_review(email, comment, star_rating)\n if (email)\n fill_in 'Email', with: email\n end\n\n if (comment)\n fill_in 'Comment', with: comment\n end\n \n if (star_rating)\n select_star(star_rating)\n end\n\n click_on 'Add Review'\n end",
"def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_title = danger_file.github.pr_title.include? '[WIP]'\n\n danger_file.warn('PR is classed as Work in Progress') if has_wip_label || has_wip_title\n end",
"def reviewed?\n !application_review_decision_type.nil?\n end",
"def update_pr_title(title)\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n api.update_pull_request(@repo, @number, title: title)\n end",
"def update_review_status_if_changes_substantial\n return unless @description.save_version?\n\n @description.update_review_status(@description.review_status)\n end",
"def pending_reviews\n pending_reviews = []\n self.projects.each do |p|\n p.reviews.each do |r|\n if !r.closed?\n if r.approved? && r.submitter == self \n pending_reviews.push(r)\n elsif r.review_votes.select{ |v| v.vote == ReviewVote.allowable_votes[:no_opinion] && v.user == self }\n pending_reviews.push(r)\n end\n end\n end\n end\n return pending_reviews\n end",
"def review_mode\n if chronos_capacity_volume == 0\n \"paused\"\n elsif review_mail_recurrency\n \"mail\"\n else\n \"no_mail\"\n end\n end",
"def create\n pr = params[:review]\n review = Review.new\n \n if review.cadastrar(current_user, pr[:project_id], pr[:tipo], pr[:texto])\n redirect_to project_path(review.project_id), :notice => 'Revisao Cadastrada Com Sucesso.'\n else\n flash[:error] = \"Revisao Nao Cadastrada #{review.errors.messages}.\"\n redirect_to project_path(review.project_id)\n end\n end",
"def new_review_email (review)\n\t@book = review.book\n\t@review = review\n\tmail :to => @book.readers.collect{|r| r.email},\n\t :subject=>\"New review for #{@book.title}\"\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def detect_review\r\n return render :nothing => true unless logged_in?\r\n if @review = session_user.reviews.for_product(params[:id]).editable.first\r\n # RIC moderation\r\n if @review.content_documents.any?\r\n @review = @review.content_documents.last.copy_content_fields_forward\r\n end\r\n end\r\n end",
"def review_alert(email, review, rating, source, location, location_link, review_count, plan_type)\n @email = email\n @review = review\n @rating = rating\n @source = source\n @location = location\n @plan_type = plan_type\n @review_count = review_count\n\n # needs to change to normal production path once setup\n host = 'www.pickgrapevine.com'\n q_full_review = URI.encode_www_form('link' => location_link, 'kme' => 'Clicked Read Full Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @location_link = \"http://#{host}/send_to_site?#{q_full_review}\"\n\n if plan_type == 'free'\n case @review_count\n when 1\n @review_message = 'Your first review this month'\n @review_progress_bar = '4-remaining.png'\n when 2\n @review_message = 'Thats 2 two reviews so far.'\n @review_progress_bar = '3-remaining.jpg'\n when 3\n @review_message = 'You have 2 reviews left.'\n @review_progress_bar = '2-remaining.jpg'\n when 4\n @review_message = 'Oh, snap. You have 1 review remaining.'\n @review_progress_bar = '1-remaining.jpg'\n when 5\n @review_message = 'You have reached your limit.'\n @review_progress_bar = '0-remaining.jpg'\n end\n end\n \n if source == 'yelp'\n @source = \"Yelp\"\n @logo = \"http://www.pickgrapevine.com/assets/email/yelp-clear.png\"\n respond_link = \"http://biz.yelp.com\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'opentable'\n @source = \"Opentable\"\n @logo = \"http://www.pickgrapevine.com/assets/email/opentable-clear.png\"\n respond_link = \"http://www.otrestaurant.com\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'google'\n @source = \"Google Places\"\n @logo = \"http://www.pickgrapevine.com/assets/pics/google-clear.png\"\n respond_link = \"http://www.google.com/placesforbusiness\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'tripadvisor'\n @source = \"Tripadvisor\"\n @logo = \"http://www.pickgrapevine.com/assets/email/tripadvisor-clear.png\"\n respond_link = \"http://www.tripadvisor.com/Owners\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'urbanspoon'\n @source = \"Urbanspoon\"\n @logo = \"http://www.pickgrapevine.com/assets/email/urbanspoon-clear.png\"\n respond_link = \"http://www.urbanspoon.com/u/signin\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n\n else\n return false\n end\n ### Track all review alerts sent\n DelayedKiss.record(email, 'Sent Review Alert', {'Location' => \"#{location}\", \n 'Source' => \"#{source.to_s.titleize}\" })\n puts \"GV Review Alert: Sent a #{source.capitalize} review alert to #{location} to #{email}\"\n mail to: @email, subject: \"You have a new #{source.to_s.titleize} review\"\n end",
"def p_request_issues(ris)\n quietly do\n dis = ris.first.decision_review.decision_issues\n puts \"---- #{ris.count} RequestIssues with #{dis.count} DecisionIssues\"\n ris.order(:id).each_with_index do |ri, i|\n p_request_issue(ri, i)\n end.map(&:to_s)\n dis\n puts \"^^^^^^^^^^^^^^^^^^^^\"\n end\nend",
"def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n settings.github.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n settings.github.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend",
"def create\n @review = Review.new(review_params)\n if @review.save\n UserMailer.new_rating_email(@review).deliver \n UserMailer.new_review_email(@review).deliver if @review.review_text.length > 0\n UserMailer.new_rating_and_review_email(@review).deliver\n end\n respond_to_creative :created, 'Review was successfully created.', :new\n end",
"def review\n @assignment = Assignment.find params[:assignment_id]\n redirect_to view_questionnaires_path id: @assignment.questionnaires.find_by(type: 'AuthorFeedbackQuestionnaire').id\n end",
"def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end",
"def create\n #@feedback = Feedback.find(params[:feedback_id])\n #@issue.feedback_id = @feedback.id\n @issue = Issue.new(params[:issue])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.approvalstatus = \"Waiting for Approval\"\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to projects_tester_path(@issue), notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@feedback = Feedback.find(params[:feedback_id])\n #@issue.feedback_id = @feedback.id\n @issue = Issue.new(params[:issue])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.approvalstatus = \"Waiting for Approval\"\n\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to projects_path, notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # 今日振り返りしたかの確認\n review = Review.where(user_id: current_user.id, created_at: Time.current.at_beginning_of_day..Time.current.at_end_of_day)\n\n if review.exists?\n review.update(review_params)\n redirect_to user_path(current_user.id)\n flash[:notice] = \"振り返りの更新に成功しました。\"\n #TODO エラーメッセージ\n # respond_to do |format|\n # format.html { redirect_to review, notice: \"振り返りの更新に成功しました。\" }\n # format.json { render :show, status: :ok, location: review }\n # end\n else\n\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n respond_to do |format|\n if @review.save\n # 目標達成で5pt, タスク達成で2pt, 振り返り投稿で1pt、自分のレベルの10倍のポイントがたまるとレベルアップ\n if Goal.goal_point(current_user) + Task.task_point(current_user) + Review.review_point(current_user) > LEVEL_UP_POINT*current_user.level\n # レベル+1\n current_user.upgrade_level\n flash[:notice] = \"レベル「+1」アップ 、現在のレベルは#{current_user.level}です。\"\n end\n format.html { redirect_to @review, notice: \"振り返りの作成に成功しました。\" }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def special_status_by_reviewers\n asrs = self.article_submission_reviewers.group_by(&:current_status_key)\n total = self.article_submission_reviewers.length\n asrs['reviewer_recieved_comments'] ||= []\n asrs['reviewer_not_yet_invited'] ||= []\n asrs['reviewer_invited_awaiting_response'] ||= []\n asrs['reviewer_declined_with_alternate'] ||= []\n asrs['reviewer_need_comments'] ||= []\n asrs['reviewer_given_up'] ||= []\n\n asrs['comments_overdue'] = asrs['reviewer_need_comments'].select {|asr| asr.comments_overdue?}\n\n if total == 0 \n return 'Need reviewers'\n elsif asrs['reviewer_recieved_comments'].length == total\n return 'All comments received'\n elsif asrs['comments_overdue'].length >= 1\n return 'Late comments'\n elsif asrs['reviewer_invited_awaiting_response'].length > 0\n return 'Requests sent to reviewers'\n elsif asrs['reviewer_not_yet_invited'].length > 0\n return 'Reviewers not yet invited'\n else\n return 'With reviewers'\n end\n end",
"def review(review)\n @review = review\n @abstract = review.abstract_doc\n User.with_role(:admin).each do |user|\n mail(to: user.email, subject: 'All reviews submitted for abstract titled '+@abstract.title)\n end\n end",
"def verify_request_issue_contending_decision_issue_not_readded(\n page_url,\n decision_review,\n contested_decision_issues\n )\n # verify that not modifying a request issue contesting a decision issue\n # does not result in readding\n\n visit page_url\n expect(page).to have_content(contested_decision_issues.first.description)\n expect(page).to have_content(contested_decision_issues.second.description)\n expect(page).to have_content(\"PTSD denied\")\n\n click_remove_intake_issue_dropdown(\"PTSD denied\")\n\n click_intake_add_issue\n add_intake_rating_issue(\"Issue with legacy issue not withdrawn\")\n\n click_edit_submit\n expect(page).to have_content(\"has been submitted\")\n\n first_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.first.id\n )\n\n second_not_modified_request_issue = RequestIssue.find_by(\n decision_review: decision_review,\n contested_decision_issue_id: contested_decision_issues.second.id\n )\n\n expect(first_not_modified_request_issue).to_not be_nil\n expect(second_not_modified_request_issue).to_not be_nil\n\n non_modified_ids = [first_not_modified_request_issue.id, second_not_modified_request_issue.id]\n request_issue_update = RequestIssuesUpdate.find_by(review: decision_review)\n\n # existing issues should not be added or removed\n expect(request_issue_update.added_issues.map(&:id)).to_not include(non_modified_ids)\n expect(request_issue_update.removed_issues.map(&:id)).to_not include(non_modified_ids)\n end",
"def mark_violation\r\n @review = Review.find_by_param params[:id]\r\n violation = @review.violations.create params[:violation]\r\n end",
"def in_review?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='In Review'\").id\n end",
"def hash_tag_description_issue(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n 0\n end\n end",
"def test02_open_reject_post\n\t\t@msg = \"Note for rejection #{random}\"\n\t\tlogin $user_3_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 2\n\t\t#create post for approval\n\t\tpostApproveNoteSetup(@msg)\n\t\t\n\t\t#log out\n\t\tlogout_common\n\t\t\n\t\t#login in as admin (moderator of blog)\n\t\tlogin $admin_1_email, $master_password\n\t\t\n\t\t#reject post\n\t\t$browser.goto($patch_blogs_pre_open)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_for_approval_icon.click #go to preview \n\t\tsleep 4\n\t\tassert $browser.text.include? \"#{@msg}\" #verify on correct page\n\t\tsleep 4\n\t\t$post_reject_icon.when_present.click\n\t\tsleep 2\n\t\t$post_reject_reason.when_present.set \"I don't link this post\"\n\t\t$post_reject_button.click\n\t\tassert !($browser.text.include? \"#{@msg}\")\n\tend",
"def add_reviewer(pull_request)\n reviewer_to_add = choose_reviewer(pull_request)\n\n pull_request.reviewers.create!(\n login: reviewer_to_add,\n review_rule_id: self.id,\n context: self.match_context\n )\n\n pull_request.save!\n\n reviewer_to_add\n end",
"def review_commit\n if @review_commit.nil?\n @review_commit = GitCommit.new(project.review_repository,\n @sha1)\n end\n @review_commit\n end",
"def create\n @venue_review = @venue.venue_reviews.new(params[:venue_review])\n @venue_review.added_by = current_user.id\n respond_to do |format|\n if @venue.venue_reviews << @venue_review\n flash[:notice] = 'Thank you for your valuable review.'\n format.html { redirect_to(venue_path(@venue)) }\n format.xml { render :xml => @venue_review, :status => :created, :location => @venue_review }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue_review.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def utils_parse_payload!(paper, comment, pre_review)\n sender = comment.user.login\n comment_body = comment.body\n commented_at = comment.created_at\n comment_url = comment.html_url\n\n issues = paper.activities['issues']\n\n if pre_review\n kind = 'pre-review'\n else\n kind = 'review'\n end\n\n issues['comments'].unshift(\n 'author' => sender,\n 'comment' => comment_body,\n 'commented_at' => commented_at,\n 'comment_url' => comment_url,\n 'kind' => kind\n )\n\n # Something has gone wrong if this isn't the case...\n if issues['commenters'][kind].has_key?(sender)\n issues['commenters'][kind][sender] += 1\n else\n issues['commenters'][kind].merge!(sender => 1)\n end\n\n # Only keep the last 5 comments\n issues['comments'] = issues['comments'].take(5)\n\n # Finally save the paper\n paper.save\n end",
"def reset_reviewed\n if copy_changed? && !approved_changed?\n if copy_change[0] != copy_change[1]\n self.reviewer_id = nil\n self.approved = nil\n end\n end\n return true\n end",
"def hash_tag_description_pr(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).select do |x|\n pull_request?(pr, x[0].to_i)\n end.size\n else\n 0\n end\n end",
"def approve(number)\n request = get_request_by_number(number)\n repo = github.source_repo\n # TODO: Make this configurable.\n comment = 'Reviewed and approved.'\n response = github.add_comment(repo, request.number, comment)\n if response[:body] == comment\n puts 'Successfully approved request.'\n else\n puts response[:message]\n end\n end",
"def allow_review?(proposal)\n (program_mode? || !proposal.has_speaker?(current_user)) && !proposal.finalized?\n end",
"def create\n\t\t\t\t@review = DriverReview.new(create_driver_review_params)\n\t\t\t\t@review.driver_id = @request.driver_id\n\t\t\t\t# render_invalid_action(@review) unless @review.save\n\t\t\t\t@review.save!\n\t\t\t\tlogger.debug @review.errors.messages\t\t\t\t\n\t\t\tend",
"def testable_pull_request?(\n pr,\n admin_users,\n expected_body = 'test_it',\n options = {}\n )\n if ! pr['merged']\n if pr['mergeable']\n if pr['comments'] > 0\n comments = ::Github.new(options).issues.comments.all(\n pr['base']['user']['login'],\n pr['base']['repo']['name'],\n pr['number']\n )\n puts 'going through comments'\n comments.each do |comment|\n if admin_users.include?(comment['user']['login'])\n if comment['body'] == expected_body\n return true\n end\n end\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} has no issue commments.\\\n I will not test it. We only test things approved.\n \"\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} cannot be merged, will not test\"\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} was already merged, will not test\"\n end\n puts \"Did not find comment matching #{expected_body}\"\n return false\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end"
] |
[
"0.66692436",
"0.66381574",
"0.6536634",
"0.65272343",
"0.63813394",
"0.6380718",
"0.6373571",
"0.6368497",
"0.6365946",
"0.6359939",
"0.6359239",
"0.63352484",
"0.62968254",
"0.62817",
"0.62776655",
"0.626592",
"0.6251442",
"0.6240455",
"0.6236603",
"0.6208171",
"0.61667466",
"0.6165972",
"0.61588234",
"0.61559165",
"0.61462986",
"0.6136761",
"0.6121767",
"0.6070769",
"0.6047396",
"0.6013958",
"0.6008193",
"0.6006001",
"0.60044926",
"0.59966373",
"0.596891",
"0.5965707",
"0.5965616",
"0.59644204",
"0.59430104",
"0.5942301",
"0.593775",
"0.5917464",
"0.5908051",
"0.59017783",
"0.5898447",
"0.58984125",
"0.5890199",
"0.5877497",
"0.5853603",
"0.5851755",
"0.58441997",
"0.5836247",
"0.5830281",
"0.58220387",
"0.5811397",
"0.5807283",
"0.58052194",
"0.58027345",
"0.5785044",
"0.57798934",
"0.5773396",
"0.5763776",
"0.57596564",
"0.57347167",
"0.5731399",
"0.57163185",
"0.57145476",
"0.5706082",
"0.5701609",
"0.56999254",
"0.5692471",
"0.569003",
"0.56802535",
"0.56738466",
"0.56657755",
"0.5664259",
"0.5663199",
"0.5662468",
"0.56525165",
"0.5651795",
"0.5648418",
"0.56478405",
"0.56333125",
"0.56313896",
"0.5629332",
"0.5627301",
"0.562299",
"0.5614684",
"0.56072676",
"0.5606914",
"0.5605494",
"0.56017095",
"0.5599044",
"0.5591721",
"0.5591679",
"0.5591565",
"0.55876005",
"0.55829775",
"0.5581918",
"0.55809045"
] |
0.69937253
|
0
|
Evaluates and submits a status for the commodus review
|
def submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)
pr_key = pr_name + ":" + pr_number
# Grab the stored payload
stored_payload_value = @redis.hget(pr_key, current_commit_hash)
# Ensure that a key actually exists
if !stored_payload_value.nil?
stored_payload = JSON.parse(stored_payload_value)
plus_ones = stored_payload['plus_one_count'].to_i
authors = stored_payload['authors']
creator = stored_payload['creator'].to_s
# Check if the commenting user is the creator or has already commented
is_comment_user_creator_or_author = authors.include?(comment_user) || creator === comment_user
plus_ones_to_add = is_comment_user_creator_or_author ? 0 : approvals
# If there is no net change
if plus_ones_to_add === 0
return 200
end
plus_ones = plus_ones + plus_ones_to_add
# Ensure the count isn't negative
if plus_ones < 0
plus_ones = 0
end
# Update authors list
if !authors.include?(comment_user)
authors.push(comment_user)
end
payload_to_store = {
:plus_one_count => plus_ones,
:authors => authors,
:creator => creator,
}
# Store the new payload data
@redis.hset(pr_key, current_commit_hash, payload_to_store.to_json)
if plus_ones >= NEEDED_PLUS_ONES
status = 'success'
else
status = 'pending'
end
@client.create_status(
pr_name,
current_commit_hash,
status,
{
'description' => '(' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') required approvals.',
'context' => 'robinpowered/commodus'
}
)
else
return 404
end
return 200
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def process_created_review(review_payload)\n pr_name = review_payload['repository']['full_name'].to_s\n pr_number = review_payload['pull_request']['number'].to_s\n comment_user = review_payload['review']['user']['id'].to_s\n approvals = evaluate_review_state(review_payload['review']['state'])\n current_commit_hash = review_payload['pull_request']['head']['sha'].to_s\n\n submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n end",
"def update_review_status(status, user)\n \n if status && status.id != self.review_status_id &&\n (self.review_status.name == 'Review On-Hold' ||\n self.review_status.name == 'In Review')\n\n self.record_update('Review Status', \n self.review_status.name, \n status.name,\n user)\n\n if self.review_status.name == 'Review On-Hold'\n self.remove_from_hold(status.id)\n elsif self.review_status.name == 'In Review'\n self.place_on_hold\n end\n self.save\n \n true\n else\n false\n end \n \n end",
"def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end",
"def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end",
"def update_review_status_if_changes_substantial\n return unless @description.save_version?\n\n @description.update_review_status(@description.review_status)\n end",
"def closed_submission_status\n 'Closed for Review'\n end",
"def edit_requirement_tracker\n find_user\n if !@user.nil?\n\n status=@req.status\n\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\") or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@project_req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@project_req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n redirect_to show_tracker_req_url(@tracker.id)\n else\n redirect_to trackers_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def add_review\n login_as(User.where(role_id: 1).first.name)\n expect(page).to have_content 'User: ' + User.where(role_id: 1).first.name\n\n expect(page).to have_content 'TestAssignment'\n\n click_link 'TestAssignment'\n expect(page).to have_content 'Submit or Review work for TestAssignment'\n expect(page).to have_content \"Others' work\"\n\n click_link \"Others' work\"\n expect(page).to have_content 'Reviews for \"TestAssignment\"'\n\n choose 'topic_id'\n click_button 'Request a new submission to review'\n\n click_link 'Begin'\n\n fill_in 'responses[0][comment]', with: 'HelloWorld'\n select 3, from: 'responses[0][score]'\n click_button 'Submit Review'\n expect(page).to have_content 'Your response was successfully saved.'\n click_link 'Logout'\n end",
"def evaluate_review_state(state)\n net_pluses = 0\n\n if state == \"approved\"\n net_pluses = 1\n elsif state == \"changes_requested\"\n net_pluses = -1\n end\n\n return net_pluses\n end",
"def status(assignment, student)\n s = assignment.get_submission(student)\n if s\n if s.complete?\n return 'complete'\n # content_tag(:span, 'COMPLETE', class: \"radius success label\")\n # link_to \"Submitted URL\", s.url\n # link_to \"Review\", edit_assignment_submission_path(assignment.id, s)\n else\n return 'up_for_review'\n # content_tag(:span, 'UP FOR REVIEW', class: \"radius regular label\")\n # link_to \"Submitted URL\", s.url\n # link_to \"Review\", edit_assignment_submission_path(assignment.id, s)\n end\n else\n return 'no_submission'\n # content_tag(:span, 'NO SUBMISSION', class: \"radius alert label\")\n end\n end",
"def edit_requirement_use\n find_user\n if !@user.nil?\n status=@req.status\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_user_first_name(current_member.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"Reviewed\" and params[:requirement][:status]==\"Reviewed\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n assign_project\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:use_case_id].nil?\n redirect_to show_requirements_url(@use_case.id)\n else\n redirect_to use_cases_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def updateStatus\n\n storyURI = @details['Assets']['Asset']['href']\n\n statusXml = '<Asset>\n <Attribute name=\"Custom_JIRAIntStatus\" act=\"set\">' + @mapping.SendToJiraMap['Resolved in JIRA'] + '</Attribute>\n </Asset>'\n\n r_status = self.class.post(\"#{storyURI}\", :body => statusXml,\n :headers => {\"content_type\" => \"application/xml\"}, :verify => false)\n\n if r_status['Error']\n p r_status['Error']\n else\n @persist.updateDefectStatus(@story)\n return 1\n end\n return 0\n end",
"def under_review_status\n 'Under Review'\n end",
"def edit\n\n status=@req.status\n find_user\n if !@user.nil?\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n redirect_to requirements_path\n else\n redirect_to :back\n end\n else\n\n flash[:notice]= t(:requirement_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def update_review(movie, status)\n\tcheck = user_already_reviewed(movie)\n\t#if none returns 0\n\tif check == -1\n\t @update_review = 0\n\t#else returns the review id \n\telse\n\t reviewFound = movie.reviews.where('user_id' => current_user.id).first\n\t @update_review = reviewFound.id\n\tend\nend",
"def update\n #raise params.inspect\n @evaluation_result = EvaluationResult.find(params[:id])\n\n if params[:commit].to_s == \"Gravar Rascunho\"\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Em Avaliacao\")\n app.appointment_status = s\n app.save\n else\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Realizada\")\n app.appointment_status = s\n app.save\n end\n\n respond_to do |format|\n if @evaluation_result.update_attributes(params[:evaluation_result])\n if params[:commit].to_s == \"Gravar Rascunho\"\n format.html { redirect_to appointments_path, notice: 'Resultados da avaliacao guardados com sucesso.' }\n else\n format.html { redirect_to \"http://localhost:8000/reporting?report=Avaliacao&Appointment_Id=#{params[:appoint_id].to_s}\", notice: 'Resultados da avaliacao guardados com sucesso.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute()\n # If we are using the simple review request configuration\n if @configurations['configuration_type'] == 'Simple'\n # Encode the csrv, this will ensure that any '#' characters in the\n # InstanceId are escaped.\n csrv = encode_url_parameter(@parameters['csrv'])\n # Concatenate the application path, review request Servlet path, and the\n # encoded InstanceId of the desired submission\n url = \"#{@configurations['application_path']}ReviewRequest?csrv=#{csrv}\"\n # If we are using the advanced review request configuration\n else\n # Build up the HTTP parameter name/value pair Strings\n parameter_strings = @parameters.collect {|name, value|\n # Each parameter pair String maps the parameter to the encoded parameter\n # value. It is important to encode the value so that special characters\n # (such as '#' or '&') don't modify the intended meaning of the URL.\n \"#{name}=#{encode_url_parameter(value)}\" unless value.nil?\n }.compact\n\n # Build up the URL\n url = \"#{@configurations['application_path']}ReviewRequest?#{parameter_strings.join('&')}\"\n end\n\n # Return the results String\n <<-RESULTS\n <results>\n <result name=\"URL\">#{escape(url)}</result>\n </results>\n RESULTS\n end",
"def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end",
"def update\n @review = Review.find(params[:id])\n @submission = ReviewSubmission.new(:review_id => @review.id, :submission_date => Time.now)\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n if @submission.save\n SubmissionNotifier.deliver_resubmission_notification(@submission)\n format.html { redirect_to(@review, :notice => 'Review and Submission were successfully created.') }\n else\n format.html { redirect_to(@review, :notice => 'Review was successfully created but the submission was not.') }\n end\n format.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reviewed?\n @status == :reviewed\n end",
"def test_ID_25863_comment_on_review()\n login $user_1_email, $master_password\n read_all_updates\n \n $browser.goto(\"http://flatiron.#{$environment}.patch.com/listings/yelp\")\n $share_review_text_field.when_present().click\n $post_compose_review.when_present().set (\"Automated review text #{random}\")\n $group_post_button.when_present().click\n\n logout_common\n login $user_1_email, $master_password\n $browser.goto(\"http://flatiron.#{$environment}.i.patch.com/listings/yelp\")\n $comment_icon.click\n sleep 3\n $leave_comment_textfield.set \"Automated comment text #{random}\"\n $group_post_comment.click\n logout_common\n login $user_1_email, $master_password\n verify_updates\n end",
"def update\n @submission = Submission.find(params[:id])\n part=Participation.find(@submission.Participation_id)\n comp=Competition.find(part.Competition_id)\n if current_user.id == part.User_id\n if comp.endtime>Time.now and comp.starttime<Time.now\n respond_to do |format|\n if @submission.response!=nil\n @submission.submited=Time.now\n end\n if @submission.update_attributes(params[:submission])\n if comp.publicscore\n Submission.evaluate(@submission)\n end\n format.html { redirect_to @submission, notice: 'Submission was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to @submission, status: 'Competition expired.'\n end\n else\n redirect_to @submission, status: 'Submissions can only be modified by the participant.'\n end\n end",
"def unofficial_submit\n \n feedback_str = request.body.read\n\n @course = Course.where(:id => params[:course_id]).first\n @assessment = Assessment.where(:id => params[:id]).first\n @user = User.where(:email => params[:user]).first\n\n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if !@user then\n puts \"ERROR: invalid username (#{user}) for class #{course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{course.id}\"\n exit\n end\n\n if !@assessment.allow_unofficial then\n puts \"ERROR: This assessment does not allow Unofficial Submissions\"\n exit\n end\n\n @result = params[:result]\n\n if !@result then\n puts \"ERROR: No result!\"\n exit\n end\n\n # Everything looks OK, so append the autoresult to the log.txt file for this lab\n @logger = Logger.new(\"#{Rails.root}/courses/#{@course.name}/#{@assessment.name}/log.txt\")\n @logger.add(Logger::INFO) { \"#{@user.email},0,#{@result}\" }\n\n # Load up the lab.rb file\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(\"#{Rails.root}/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n begin\n # Call the parseAutoresult function defined in the lab.rb file. If\n # the list of scores it returns is empty, then we the lab developer is\n # asking us not to create an unofficial submission in the\n # database. Simply return a successful status string to the client and\n # exit.\n scores = parseAutoresult(@result,false)\n\n if scores.keys.length == 0 then \n render :nothing => true and return\n end\n\n # Try to find an existing unofficial submission (always version 0). \n submission = @assessment.submissions.where(:version=>0,:user_id=>@user.id).first\n if !submission then\n submission = @assessment.submissions.new(:version=>0,\n :autoresult=>@result,\n :user_id=>@user.id,\n :submitted_by_id=>0)\n submission.save!()\n else\n #update this one\n submission.autoresult= @result\n submission.created_at = Time.now()\n submission.save!()\n end\n\n\n # Update the scores in the db's unofficial submission using the list\n # returned by the parseAutoresult function\n for key in scores.keys do\n problem = @assessment.problems.where(:name => key).first\n score = submission.scores.where(:problem_id => problem.id).first\n if !score then \n score = submission.scores.new(:problem_id=>problem.id)\n end\n score.score = scores[key]\n score.released = true\n score.grader_id= 0\n score.save!()\n end\n rescue Exception => e\n print e\n end\n\n\n render :nothing => true and return\n\n end",
"def update\n @evaluationstatus = Evaluationstatus.find(params[:id])\n\n respond_to do |format|\n if @evaluationstatus.update_attributes(params[:evaluationstatus])\n format.html { redirect_to @evaluationstatus, notice: 'Evaluation status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluationstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_review_status # :norobots:\n pass_query_params\n id = params[:id].to_s\n desc = NameDescription.find(id)\n if is_reviewer?\n desc.update_review_status(params[:value])\n end\n redirect_to(:action => 'show_name', :id => desc.name_id,\n :params => query_params)\n end",
"def create\n @review = Review.new(review_params)\n @review.memberid = current_account.id\n @state = false\n if @review.save\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.committee.tracks.each do |track| \n if( track.userid == current_account.id && track.role == \"PC Member\" )\n @state = true\n end\n end\n if(@state)\n respond_to do |format|\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n end\n else\n @review.destroy\n redirect_to @paper.committee.conference, notice: \"You are not an PC member of that committee. Review not created.\"\n end\n else\n respond_to do |format|\n format.html { render :new}\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request - \" + @interview.status\n \n mail to: @employer.email, subject: subject\n end",
"def rank_review_status(review_status)\n\tif(review_status == \"criteria provided, single submitter\")\n\t\treturn \"#{review_status} (one star)\"\n\telsif(review_status == \"criteria provided, multiple submitters, no conflicts\")\n\t\treturn \"#{review_status} (two stars)\"\n\telsif(review_status == \"reviewed by expert panel\")\n\t\treturn \"#{review_status} (three stars)\"\n\telsif(review_status == \"practice guideline\")\n\t\treturn \"#{review_status} (four stars)\"\n\telse \n\t\treturn \"#{review_status} (zero stars)\"\n\tend\nend",
"def verdict\n if self.is_complete?\n return self.status_str.titleize\n elsif self.ready_to_submit?\n return 'Ready to submit'\n elsif self.status_str == 'missing information'\n return \"Waiting on response from #{self.user.name || self.user.email} \"\n elsif ['unopened', 'in review' ].include? self.status_str\n return \"Waiting on response from #{self.current_reviewer.name || self.current_reviewer.email}\"\n elsif next_reviewer.nil?\n return \"Error\"\n else\n return \"Waiting on response from #{next_reviewer.name || next_reviewer.email}\"\n end\n end",
"def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end",
"def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def update\n\t\t\t\trender_invalid_action(current_review) unless current_review.update(update_driver_review_params)\n\t\t\tend",
"def current_status\n @recruiter = current_employer.recruiters.find(params[:id])\n @recruiter.update_attribute(:status, params[:s])\n render :nothing => true\n end",
"def create\n @bizowners_review = BizownersReview.new(bizowners_review_params)\n @bizowners_review.update(jobseeker_id: current_user.id)\n @bizowners_review.update(status: true)\n\n respond_to do |format|\n if @bizowners_review.save\n format.html { redirect_to @bizowners_review, notice: 'Bizowners review was successfully created.' }\n format.json { render :show, status: :created, location: @bizowners_review }\n else\n format.html { render :new }\n format.json { render json: @bizowners_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end",
"def update\n @assignment.status = params[:status]\n @assignment.save!\n head :no_content\n end",
"def notify_status_approved(user, redemption)\n @redemption = redemption\n @reward = redemption.reward\n @approver = redemption.approver\n @user = user\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_approved\", reward_title: redemption.reward.title))\n end",
"def edit_tracker_usecase\n @user=find_user\n if @user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n format.html { redirect_to show_tracker_use_url(@tracker.id) }\n else\n format.html { redirect_to trackers_path }\n end\n end\n\n else\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def review_alert(email, review, rating, source, location, location_link, review_count, plan_type)\n @email = email\n @review = review\n @rating = rating\n @source = source\n @location = location\n @plan_type = plan_type\n @review_count = review_count\n\n # needs to change to normal production path once setup\n host = 'www.pickgrapevine.com'\n q_full_review = URI.encode_www_form('link' => location_link, 'kme' => 'Clicked Read Full Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @location_link = \"http://#{host}/send_to_site?#{q_full_review}\"\n\n if plan_type == 'free'\n case @review_count\n when 1\n @review_message = 'Your first review this month'\n @review_progress_bar = '4-remaining.png'\n when 2\n @review_message = 'Thats 2 two reviews so far.'\n @review_progress_bar = '3-remaining.jpg'\n when 3\n @review_message = 'You have 2 reviews left.'\n @review_progress_bar = '2-remaining.jpg'\n when 4\n @review_message = 'Oh, snap. You have 1 review remaining.'\n @review_progress_bar = '1-remaining.jpg'\n when 5\n @review_message = 'You have reached your limit.'\n @review_progress_bar = '0-remaining.jpg'\n end\n end\n \n if source == 'yelp'\n @source = \"Yelp\"\n @logo = \"http://www.pickgrapevine.com/assets/email/yelp-clear.png\"\n respond_link = \"http://biz.yelp.com\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'opentable'\n @source = \"Opentable\"\n @logo = \"http://www.pickgrapevine.com/assets/email/opentable-clear.png\"\n respond_link = \"http://www.otrestaurant.com\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'google'\n @source = \"Google Places\"\n @logo = \"http://www.pickgrapevine.com/assets/pics/google-clear.png\"\n respond_link = \"http://www.google.com/placesforbusiness\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'tripadvisor'\n @source = \"Tripadvisor\"\n @logo = \"http://www.pickgrapevine.com/assets/email/tripadvisor-clear.png\"\n respond_link = \"http://www.tripadvisor.com/Owners\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n \n elsif source == 'urbanspoon'\n @source = \"Urbanspoon\"\n @logo = \"http://www.pickgrapevine.com/assets/email/urbanspoon-clear.png\"\n respond_link = \"http://www.urbanspoon.com/u/signin\"\n q_respond = URI.encode_www_form('link' => respond_link, 'kme' => 'Clicked Respond to Review', 'kmi' => email, 'km_plan_type' => plan_type, 'source' => \"#{source.to_s.titleize}\")\n @response_link = \"http://#{host}/send_to_site?#{q_respond}\"\n\n else\n return false\n end\n ### Track all review alerts sent\n DelayedKiss.record(email, 'Sent Review Alert', {'Location' => \"#{location}\", \n 'Source' => \"#{source.to_s.titleize}\" })\n puts \"GV Review Alert: Sent a #{source.capitalize} review alert to #{location} to #{email}\"\n mail to: @email, subject: \"You have a new #{source.to_s.titleize} review\"\n end",
"def update\n unless @submission.evaluated.blank?\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission), info: \"Evaluated!\" }\n end\n return\n end\n\n unless Time.now > @timeout + 5.seconds\n @submission.answers_of_questions.each do |user_answer|\n user_answer.update(choice: submission_params.fetch(user_answer.answer_id.to_s, \"false\"))\n end\n end\n if Time.now > @timeout || params[:evaluate]\n @test.questions.each do |question|\n crrct = get_result(question)\n @submission.increment!(:point, question.point) if crrct\n @submission.question_evaluations.create({question_id: question.id, value: crrct})\n end\n @submission.update(evaluated: true)\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission) }\n end\n else\n respond_to do |format|\n format.html { redirect_to submissions_path, success: 'Submission was successfully saved.' }\n end\n end\n\n end",
"def review\n end",
"def review\n return access_denied unless @course.has_teacher(current_user) || @submission.group.has_reviewer?(current_user) || (@exercise.collaborative_mode == 'review' && (@course_instance.has_student(current_user) || @course_instance.has_assistant(current_user)))\n\n review = @submission.assign_to(current_user)\n\n redirect_to edit_review_path(review)\n log \"create_review #{@submission.id},#{@exercise.id}\"\n end",
"def update_intest\n @context = 1\n update_submission\n end",
"def evaluate!\n eval_start = Time.now\n\n reset\n\n @@checks.each do |name,check|\n @status_code = [check.evaluate!, @status_code].max\n end\n\n @finished = Time.now.utc\n @ms = (Time.now - eval_start) * 1000\n\n if @@checks.size == 0\n @status = :unknown\n @status_code = self.class.valid_status_map[@status]\n else\n @status = self.class.valid_status_map.invert[@status_code]\n end\n end",
"def review(review)\n @review = review\n @exercise = @review.submission.exercise\n @course_instance = @exercise.course_instance\n @course = @course_instance.course\n @grader = @review.user\n group = review.submission.group\n\n if !@course.email.blank?\n headers[\"Reply-to\"] = @course.email\n elsif !@exercise.anonymous_graders && @grader && !@grader.email.blank?\n headers[\"Reply-to\"] = @grader.email\n end\n\n # Collect receiver addresses\n recipients = []\n group.group_members.each do |member|\n if !member.email.blank?\n recipients << member.email\n elsif member.user && !member.user.email.blank?\n recipients << member.user.email\n end\n end\n\n if recipients.empty?\n # TODO: raise an exception with an informative message\n review.status = 'finished'\n review.save\n return\n end\n \n # Attachment\n unless @review.filename.blank?\n attachments[@review.filename] = File.read(@review.full_filename)\n end\n \n subject = \"#{@course.full_name} - #{@exercise.name}\"\n \n if review.type == 'AnnotationAssessment'\n template_name = 'annotation'\n @review_url = review_url(review.id, :group_token => group.access_token, :protocol => 'https://')\n else\n template_name = 'review'\n end\n \n I18n.with_locale(@course_instance.locale || I18n.locale) do\n mail(\n :to => recipients.join(\",\"),\n :subject => subject,\n :template_path => 'feedback_mailer',\n :template_name => template_name\n )\n #:reply_to => from,\n end\n\n # Set status\n review.status = 'mailed'\n review.save\n end",
"def update\n respond_to do |format|\n if @critic_review.update(critic_review_params)\n format.html { redirect_to @critic_review, notice: 'Critic review was successfully updated.' }\n format.json { render :show, status: :ok, location: @critic_review }\n else\n format.html { render :edit }\n format.json { render json: @critic_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform(params)\n # manual auto approve should never call this job\n init_params(params)\n\n r = fetch_and_validate_models\n return if !r\n\n compute_auto_approval\n\n failed_reason_count = (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.auto_approve_fail_reasons).count\n\n if failed_reason_count == 0 && @client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type\n # qualify service call\n qualify_params = {\n id: @user_kyc_detail.id,\n admin_id: Admin::AUTO_APPROVE_ADMIN_ID,\n client_id: @user_kyc_detail.client_id,\n client: @client,\n is_auto_approve: true\n }\n\n service_response = AdminManagement::Kyc::AdminAction::ApproveDetails.new(qualify_params).perform\n\n ApplicationMailer.notify(\n body: 'Unable to Auto Approve a valid case',\n data: {\n user_extended_detail_id: @user_extended_detail_id,\n user_kyc_comparison_detail_id: @user_kyc_comparison_detail.id\n },\n subject: 'Unable to Auto Approve a valid case'\n ).deliver if !service_response.success?\n\n else\n send_manual_review_needed_email\n end\n\n @user_kyc_comparison_detail.client_kyc_pass_settings_id = @client_kyc_pass_setting.id\n @user_kyc_comparison_detail.save!\n end",
"def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end",
"def review_complete?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review Completed'\").id\n end",
"def vacate_at_attorney_review(mtv_judge, drafting_attorney, lit_support_user)\n # These are ready to be reviewed by the decision drafting attorney on the vacate stream\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"denied\")\n judge_addresses_mtv(jam_task, \"denied\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"dismissed\")\n judge_addresses_mtv(jam_task, \"dismissed\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"straight_vacate\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_readjudication\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_de_novo\", drafting_attorney)\n end\n end",
"def submit_result\n process_submit_response(submit_request) if @score > 1363\n end",
"def edit_requirement_file\n find_user\n if !@user.nil?\n status=@req.status\n assign_project\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n find_user\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n redirect_to show_file_reqs_url(@file.id)\n else\n redirect_to project_files_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end",
"def update_service_status\n if(@service_request and @status)\n @service_request.update_attributes(status_id: @status.id)\n UserMailer.accepted_rejected(@service_request.user, @service_request).deliver_now\n flash[:success] = \"Service request accepted \"\n redirect_to admin_partners_path\n else\n flash[:error] = \"Service request not found!\"\n redirect_to admin_partners_path\n end \n end",
"def change_status_to_in_progress\n user = User.find_by(id: params[:user_id])\n user.send_issue_assigned_email\n issue = Issue.find_by(id: params[:id])\n expert = User.find_by(id: params[:expert_id])\n issue.update_attributes(status: \"inprogress\", expert_id: expert.id)\n flash[:success] = \"Issue status changed to in progress! Assigned to #{expert.username}\"\n redirect_to issues_path\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @user, notice: '评价更新成功' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_review.update(company_review_params)\n format.html { redirect_to @company_review, notice: 'Company review was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_review }\n else\n format.html { render :edit }\n format.json { render json: @company_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_review_action(movie, status)\n\tcheck = user_already_reviewed(movie)\n\tif check == -1\n\t @show_review_action = true \n\telsif (check == 0 && status == true) || (check == 1 && status == false) || check == 2\n\t @show_review_action = false \n\telse\n\t @show_review_action = true\n\tend\n\nend",
"def evaluation_status\n array = placements.filled.collect(&:evaluation_submitted?)\n if array.include?(false)\n status = array.include?(true) ? false : nil\n else\n status = array.empty? ? nil : true\n end\n status \n end",
"def send_document_review_notification\n if value == 'verified'\n EventAPI.notify('system.document.verified', record: as_json_for_event_api)\n elsif value == 'rejected'\n EventAPI.notify('system.document.rejected', record: as_json_for_event_api)\n end\n end",
"def admin_candidate_interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Candidate has \" + @interview.candidate_status + \" interview request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend",
"def update\n if @evaluation.update(evaluation_params)\n render :show, status: :ok\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @review.update(review_params)\n render :show, status: :ok, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"def create\n @evaluationstatus = Evaluationstatus.new(params[:evaluationstatus])\n\n respond_to do |format|\n if @evaluationstatus.save\n format.html { redirect_to @evaluationstatus, notice: 'Evaluation status was successfully created.' }\n format.json { render json: @evaluationstatus, status: :created, location: @evaluationstatus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluationstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def review; end",
"def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_ID_25863_comment_on_review()\n login_as_user1\n read_all_updates\n share_review(\"outside-in\")\n logout_common\n login_as_user2\n leave_comment_on_share_review_group(\"outside-in\")\n logout_common\n login_as_user1\n verify_updates\n end",
"def status\n if params['fraud_status'] == 'pass' || params['credit_card_processed'] == 'Y'\n 'Completed'\n elsif params['fraud_status'] == 'wait'\n 'Pending'\n else\n 'Failed'\n end\n end",
"def update_and_approve\n refill_response_xml = \"\"\n previous_refill_quantity = @refill_request.medications.first.refill_quantity.to_i\n medication_details_changed, medication_errors = @refill_request.update_medications(params)\n\n\t note = !@refill_request.note.blank? ? \"<Note>#{@refill_request.note.strip}</Note>\" : \"\"\n\n if previous_refill_quantity != 0 && medication_details_changed\n refill_response_xml = \"<ApprovedWithChanges>#{note}</ApprovedWithChanges>\"\n else\n refill_response_xml = \"<Approved>#{note}</Approved>\"\n end\n\n if medication_errors.compact.blank?\n status_code = generate_refreq_xml(@refill_request, refill_response_xml)\n if Prescription::SUCCESS_STATUSES.include?(status_code)\n medication = @refill_request.medications.first\n medication.update_attributes(:status => status_code)\n @refill_request.update_status MedicationRefill::REFILL_STATUSES[:approved_with_changes]\n render :update do |page|\n page << \"RedBox.close()\"\n page.replace_html \"medication_status_#{medication.id}\", \"<div class='status_#{medication.display_status.downcase}'>#{medication.display_status}</div>\"\n page.replace_html \"refill_status_#{@refill_request.id}\", \"Approved with changes\"\n page.replace_html \"actions_#{@refill_request.id}\", \"<td align='center' colspan='10' id='status_#{@refill_request.id}'>Refill Response sent Successfully.</td>\"\n page.visual_effect :highlight, \"status_#{@refill_request.id}\", :duration => 2.0\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", \"Request failed, please try again or contact support\"\n end\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", medication_errors.uniq.join(\"<br />\")\n end\n end\n end",
"def update_status\n\n old_status = self.status\n\n unless self.decided?\n expected_users = self.get_current_expected\n\n if expected_users.nil?\n self.update_attribute(:status, Workflow::STATUS_DENIED)\n last_nak = self.get_last_nak\n unless last_nak.nil?\n self.update_attribute(:decided_at, last_nak.updated_at)\n end\n elsif expected_users.empty?\n self.update_attribute(:status, Workflow::STATUS_ACCEPTED)\n last_ack = self.get_last_ack\n unless last_ack.nil?\n self.update_attribute(:decided_at, last_ack.updated_at)\n end\n end\n end\n\n return (old_status != self.status)\n end",
"def update\n @review = Review.find(params[:id])\n @review.attributes = review_params(params)\n\n update_story_attributes(@review, params[:story])\n update_member_settings(@review, params[:review_form_expanded])\n update_source_review(@review.story, params[:source_ratings])\n \n if @review.save_and_process_with_propagation\n if current_member.status == 'guest'\n flash[:notice] = render_to_string(:inline => \"<h2>Your review was successfully updated,<br>but will not be published until you activate your account.</h2>Check your email inbox and click on your activation link. For help, check our <%= help_link('FAQ', 'activate') %>.\")\n render :json => { :go => :story_actions, \n :form_transition => {:from => :review, :to => :story_actions} }.to_json\n else\n notice = tweet_if_requested(@review, params[:short_url])\n render :json => { :go => :story_actions, \n :form_transition => {:from => :review, :to => :story_actions}, \n :notice => notice,\n :fb_stream_story => toolbar_facebook_stream_story(@review) }.to_json\n end\n\n if @review.hidden? && !current_member.has_role_or_above?(:admin)\n NotificationMailer.deliver_edit_alert(:subject => \"Hidden Review Updated\", :body => \"Check #{review_url(@review)}.\")\n end\n else\n render :json => {:error_message => \"Failed to save review\"}.to_json\n end\n end",
"def status\n \"approved\"\n end",
"def review_complete(params)\n # validate these parameters. If this passes, we can safely import.\n params = validate_review_completed_parameters(params)\n self.analyst_id = params[\"analyst_id\"]\n self.analyst_fullname = params[\"analyst_fullname\"]\n self.analyst_approval_datetime = params[\"analyst_approval_datetime\"]\n self.analyst_transaction_id = params[\"analyst_transaction_id\"]\n self.analyst_internal_status_id = params[\"analyst_internal_status_id\"]\n self.decision_code = params[\"decision_code\"]\n self\n end",
"def update\n if @review.update(review_params)\n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :ok\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id).first\n @responses = ((e = @evaluations[0]) ? e.responses.sort_by {|obj| obj.created_at } : [])\n @user = params[:instructor_review_of] ? User.find(params[:instructor_review_of]) : current_user\n @submitter = @submission.user_id == @user.submitting_id(@submission)\n\n if params[:instructor_approved_toggle]\n @submission.instructor_approved = !@submission.instructor_approved\n @submission.save!\n if @submission.instructor_approved\n redirect_to (course_assignment_path({id: params[:assignment_id]} )) + '/submissions'\n return\n else\n respond_to do |format|\n format.html { render :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\n elsif params[:finish]\n if evaluation.finished # The reviewer is withdrawing the review\n evaluation.finished = false\n evaluation.save!\n redirect_to :back\n return\n else\n if evaluation.mark_incomplete_questions\n evaluation.finished = true\n evaluation.save!\n redirect_to course_assignment_path ({id: params[:assignment_id]} )\n return\n else\n flash[:error] = \"You can't publish unless all ratings and required comments are finished.\"\n redirect_to course_assignment_submission_path ({id: params[:id]} )\n # render 'show', :layout => 'no_sidebar'\n return\n end\n end\n else # it's a student who submitted it or is completing or seeing a review of someone else\n @kibitzing = params[:instructor]\n respond_to do |format|\n format.html { render (params[:instructor_review_of] ? 'show_review' : 'show'), :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\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 review_complete\n Task.transaction do\n Dispatch.new(task: task, vacols_note: vacols_note_params).update_vacols!\n task.complete!(status: 0)\n task.update_claim_establishment!\n end\n render json: {}\n end",
"def render_proquest_status(thesis)\n status = evaluate_proquest_status(thesis)\n return 'Opt-in status not reconciled' if status == 'conflict'\n return 'No opt-in status selected' if status.nil?\n return 'Yes' if status == true\n return 'No' if status == false\n end",
"def eval_transaction_status_change params\n return if params.blank? or params[:status_notification].blank? or params[:status_notification][:transaction].blank?\n init_data_by_payment(Spree::Payment.find_by_sofort_transaction(params[:status_notification][:transaction]))\n raw_response = HTTParty.post(@sofort_payment.payment_method.preferred_server_url,\n :headers => header,\n :body => transaction_request_body)\n new_entry = I18n.t(\"sofort.transaction_status_default\")\n if raw_response.parsed_response[\"transactions\"].present? and\n raw_response.parsed_response[\"transactions\"][\"transaction_details\"].present?\n\n td = raw_response.parsed_response[\"transactions\"][\"transaction_details\"]\n alter_payment_status(td)\n new_entry = \"#{td[\"time\"]}: #{td[\"status\"]} / #{td[\"status_reason\"]} (#{td[\"amount\"]})\"\n end\n old_entries = @sofort_payment.sofort_log || \"\"\n @sofort_payment.update_attribute(:sofort_log, old_entries += \"#{new_entry}\\n\")\n end",
"def evaluation_params\n params.require(:evaluation).permit(:user_id, :project_id, :comment, :rating)\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def special_status_by_reviewers\n asrs = self.article_submission_reviewers.group_by(&:current_status_key)\n total = self.article_submission_reviewers.length\n asrs['reviewer_recieved_comments'] ||= []\n asrs['reviewer_not_yet_invited'] ||= []\n asrs['reviewer_invited_awaiting_response'] ||= []\n asrs['reviewer_declined_with_alternate'] ||= []\n asrs['reviewer_need_comments'] ||= []\n asrs['reviewer_given_up'] ||= []\n\n asrs['comments_overdue'] = asrs['reviewer_need_comments'].select {|asr| asr.comments_overdue?}\n\n if total == 0 \n return 'Need reviewers'\n elsif asrs['reviewer_recieved_comments'].length == total\n return 'All comments received'\n elsif asrs['comments_overdue'].length >= 1\n return 'Late comments'\n elsif asrs['reviewer_invited_awaiting_response'].length > 0\n return 'Requests sent to reviewers'\n elsif asrs['reviewer_not_yet_invited'].length > 0\n return 'Reviewers not yet invited'\n else\n return 'With reviewers'\n end\n end",
"def edit_review\n # client should be able to edit a review.\n puts \"Which review would you like to edit?\"\n pp Client.find_by(name: @@client_name).reviews\n puts \"Please enter the ID\"\n input = gets.strip\n selected_review = Review.find_by(id: input)\n puts \"What would you like for the new review to say?\"\n input = gets.strip\n selected_review.update(text_body: input)\n puts \"Your review has been updated, here's the new review:\"\n pp selected_review\n client_continue\n end",
"def change_resource_status\n @resource_transportation_booking = ResourceTransportationBooking.find(params[:id])\n\n if params[:approve_status] == \"Approved\"\n \n approve_scenario(params[:id],params[:vehicle][:id])\n @resource_transportation_booking.update_attribute(:remarks, params[:remarks_approver])\n elsif params[:approve_status] == \"Processed\"\n\n if params[:driver][:name] && params[:driver][:name] != ''\n process_scenario_alternate_driver(params[:id],params[:driver][:name])\n else\n @resource_transportation_booking.update_attribute(:status,\"Processed\")\n end\n @resource_transportation_booking.update_attribute(:remarks, params[:remarks_approver])\n agency = Agency.find(@resource_transportation_booking.agency_store.agency_id)\n if !agency.user_id.nil?\n UserMailer.send_mail_to_resource_manager_for_transport_booking(agency.user,@resource_transportation_booking).deliver #if agency && agency.user #if resource_manager && resource_manager.user && !resource_manager.user.blank?\n end\n\n elsif params[:approve_status] == \"Returned\"\n return_scenario(params[:id])\n elsif params[:approve_status] == \"Declined\"\n if @resource_transportation_booking.status == \"Approved\"\n decline_scenario(params[:id])\n end\n @resource_transportation_booking.update_attribute(:status,'Declined')\n end\n\n redirect_to(approve_request_resource_transportation_bookings_path, :notice => 'Transport Booking Status has been successfully updated.')\n end",
"def approval_status\n if object.approval\n \"Zaakceptowane\"\n elsif object.approval == nil\n \"Oczekujące\"\n else\n \"Odrzucone\"\n end\n end",
"def check_submit_valid\n begin\n if params[:status][:source].length > \n JS_CONFIG[\"limits\"][\"max_source_code_len\"]\n raise t(\"status.prompts.source_code_too_long\") \n end\n begin\n @problem = Problem.find(params[:status][:pid])\n rescue\n raise t(\"problem.prompts.nonexist\")\n end\n if params[:status][:contest_belong].to_i == 0 &&\n @problem.hide && !current_user.is_admin?\n raise t(\"problem.prompts.nonexist\")\n else\n begin\n @contest = Contest.find(params[:status][:contest_belong].to_i)\n rescue\n raise t(\"contest.prompts.nonexist\")\n end\n unless @contest.has_user(current_user.username)\n raise t(\"global.prompts.access_denied\");\n end\n if ContestProblem.where(\n cid: params[:status][:contest_belong].to_i,\n pid: params[:status][:pid].to_i).empty?\n raise t(\"problem.prompts.nonexist\")\n end\n end\n raise t(\"status.prompts.language_unspecified\") if \n params[:status][:language].to_i == 0\n last_status = Status.where(username: current_user.username)\n .order(time_submit: :desc).first\n raise t(\"global.prompts.too_frequent\") if\n Time.now - last_status.time_submit < 5\n rescue Exception => e\n render status: :not_acceptable, json: { msg: e.message }\n return\n end\n end",
"def create\n # 今日振り返りしたかの確認\n review = Review.where(user_id: current_user.id, created_at: Time.current.at_beginning_of_day..Time.current.at_end_of_day)\n\n if review.exists?\n review.update(review_params)\n redirect_to user_path(current_user.id)\n flash[:notice] = \"振り返りの更新に成功しました。\"\n #TODO エラーメッセージ\n # respond_to do |format|\n # format.html { redirect_to review, notice: \"振り返りの更新に成功しました。\" }\n # format.json { render :show, status: :ok, location: review }\n # end\n else\n\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n respond_to do |format|\n if @review.save\n # 目標達成で5pt, タスク達成で2pt, 振り返り投稿で1pt、自分のレベルの10倍のポイントがたまるとレベルアップ\n if Goal.goal_point(current_user) + Task.task_point(current_user) + Review.review_point(current_user) > LEVEL_UP_POINT*current_user.level\n # レベル+1\n current_user.upgrade_level\n flash[:notice] = \"レベル「+1」アップ 、現在のレベルは#{current_user.level}です。\"\n end\n format.html { redirect_to @review, notice: \"振り返りの作成に成功しました。\" }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @ticket.approved_at = Time.now\n \n if @ticket.update(ticket_params)\n \n # Add customer feedback to Notes\n if @ticket.approval_feedback.present?\n @ticket.notes.create(\n note_type: :from_customer,\n note: @ticket.approval_feedback\n )\n end\n \n # Email approval\n Ticket::CustomerMailer.ticket_approval_email(@ticket).deliver_later\n \n message = if @ticket.approved?\n 'Thanks for approving our work.'\n else\n 'Thank you for your feedback.'\n end\n message += \" A confirmation will be emailed to #{@ticket.approval_email}.\"\n \n redirect_to ticket_approval_path, notice: message\n else\n approval_confirm\n end\n end",
"def inactive_success\r\n @review = Review.find_by_param params[:id]\r\n @web_analytics.review = @review\r\n track_review_success(@review) unless sharing?\r\n render 'inactive_success'\r\n end",
"def in_review?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='In Review'\").id\n end",
"def evaluation\n\t@offering = Offering.find params[:id]\n\t\tif (@offering.evaluation == \"--\")\n\t\t\t@offering.update_attribute(:evaluation, \"Fail\")\n\t\telsif (@offering.evaluation == \"Fail\")\n\t\t\t@offering.update_attribute(:evaluation, \"Pass\")\n\t\telsif (@offering.evaluation == \"Pass\")\n\t\t\t@offering.update_attribute(:evaluation, \"Other\")\n\t\telsif (@offering.evaluation == \"Other\")\n\t\t\t@offering.update_attribute(:evaluation, \"--\")\n\t\telse\n\t\t\t@offering.update_attribute(:evaluation, \"Fail\")\n\t\tend\n\n\t\tredirect_to :back\n\tend",
"def update\n if @submission.Scores == \"Not submitted\"\n\t\t\t# end time\n\t\t\tdate=DateTime.now\n\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t# if within time limit\n\t\t\tif date.to_time < @submission.SubmittedAt.to_time + @assessment.Duration.minutes + 5.seconds\n\t\t\t\tparms = {\"Duration\"=>((date.to_time-@submission.SubmittedAt.to_time)).to_i}\n\t\t\t\tscores = []\n\t\t\t\tanswers = []\n\t\t\t\t@questions = Question.where(assessment_id: @submission.assessment_id).order(:id)\n\t\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t\t# if assessment exists\n\t\t\t\tif @assessment\n\t\t\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\t\t\tend\n\t\t\t\t# for every question of the assessment\n\t\t\t\tfor question in @questions\n\t\t\t\t\tcase question.Type\n\t\t\t\t\t# if multiple choice\n\t\t\t\t\twhen \"MCQ\"\n\t\t\t\t\t\tanswer = params[(\"MCQRadios-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# get the percentage value of that answer\n\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(answer)+answer.length+1..question.Answer.index(answer)+question.Answer[question.Answer.index(answer)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t# set the quesiton score\n\t\t\t\t\t\t\tqScore=question.Points*value/100\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if multiple answer\n\t\t\t\t\twhen \"MA\"\n\t\t\t\t\t\tanswer = params[(\"MACheckboxes-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\twrong = false\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# for each selected answer\n\t\t\t\t\t\t\tfor check in answer\n\t\t\t\t\t\t\t\t# check if wrong answer was chosen\n\t\t\t\t\t\t\t\tif wrong == false\n\t\t\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(check)+check.length+1..question.Answer.index(check)+question.Answer[question.Answer.index(check)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t\t\t# if answer was wrong\n\t\t\t\t\t\t\t\t\tif value == 0\n\t\t\t\t\t\t\t\t\t\twrong = true\n\t\t\t\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t# update question score\n\t\t\t\t\t\t\t\t\tqScore+=question.Points*value/100\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# fix the score for questions with no partial marking\n\t\t\t\t\t\t\tif question.Answer.scan(/(?=100)/).count != 0\n\t\t\t\t\t\t\t\tqScore /= question.Answer.scan(/(?=100)/).count\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if partial marking was not active and the answer is not complete\n\t\t\t\t\t\tif question.Options.include?(\"PAR0\") && qScore != question.Points\n\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..question.Options.index(\"P\")-1].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t# if fill the blank\n\t\t\t\t\twhen \"FTB\"\n\t\t\t\t\t\tanswer = params[(\"FTBAnswer-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tanswerCopy = answer\n\t\t\t\t\t\ttargetAnswer = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t#if the answer is not case sensitive act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CAS0\")\n\t\t\t\t\t\t\t\ttargetAnswer = targetAnswer.upcase\n\t\t\t\t\t\t\t\tanswerCopy = answerCopy.upcase\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if multiple spaces are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"MUL1\")\n\t\t\t\t\t\t\t\tanswerCopy = answer.squeeze().strip\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if answers that contain the correct answer are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CON1\")\n\t\t\t\t\t\t\t\tif answerCopy.include?(targetAnswer)\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif answerCopy == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answerCopy != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if true false\n\t\t\t\t\twhen \"TF\"\n\t\t\t\t\t\tanswer = params[(\"TFRadio-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif question.Answer.include?(answer)\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if regular expression\n\t\t\t\t\twhen \"REG\"\n\t\t\t\t\t\tanswer = params[(\"REGAnswer-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tregex = Regexp.new question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif !(answer =~ regex).nil?\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if formula\n\t\t\t\t\twhen \"FRM\"\n\t\t\t\t\t\tvalues = eval(params[(\"FRMvalues-\"+@questions.index(question).to_s).to_sym])\n\t\t\t\t\t\tformula = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\t# calculate the correct answer with the student variable values\n\t\t\t\t\t\tfor val in values\n\t\t\t\t\t\t\tkey, value = val\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.upcase + \"]\",value.to_s)\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.downcase + \"]\",value.to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# round it\n\t\t\t\t\t\ttargetAnswer = eval(formula+\".to_f\").round(2)\n\t\t\t\t\t\tanswer = params[(\"FRMAnswer-\"+@questions.index(question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if answer error was allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"RAN1\")\n\t\t\t\t\t\t\t\trange = question.Options[question.Options.index(\"RAN1\")+5..].to_f\n\t\t\t\t\t\t\t\t# if within range\n\t\t\t\t\t\t\t\tif answer.to_f >= targetAnswer-range && answer.to_f <= targetAnswer+range\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# if answer mathces\n\t\t\t\t\t\t\t\tif answer.to_f == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\tend\n\t\t\t\t\t# set the scores and answers parameters\n\t\t\t\t\tparms[\"Scores\"] = scores\n\t\t\t\t\tparms[\"Answers\"] = answers\n\t\t\t\tend\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @submission.update(parms)\n\t\t\t\t\t\t@submission.send_submission_results(@assessment, @questions, @creator)\n\t\t\t\t\t\tformat.html { redirect_to \"/submissions/received\" }\n\t\t\t\t\t\tformat.json { redirect_to \"/submissions/received\" }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render :edit, status: :unprocessable_entity }\n\t\t\t\t\t\tformat.json { render json: @submission.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\telse\n\t\t\tredirect_to \"/submissions/duplicate\", :error => 'Failed to record the submission.'\n\t\tend\n end",
"def submitForApproval(period=nil, comment='', name=@username)\n if period.nil? then\n # First day of work week\n cur = currentApprovalStatus(nil, name)\n period = cur.access 'period.dateFrom'\n end\n verbose \"Submitting timesheet for #{period}\"\n post('timesheet-approval/', {\n :user=>{\n :name=>name,\n },\n :period=>{\n :dateFrom=>period,\n },\n :action=>{\n :name=>:submit,\n :comment=>comment,\n }\n }) unless $cfg['tool.dry']\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_for_awaiting_decisions\n if awaiting_decisions? && all_selections_have_college_offers?\n if all_selections_rejected?\n self.status = :all_rejected\n # We mark courses as skipped, meaning that a student choice was not asked for.\n CourseSelection.update_all_student_choices self, :skipped\n else\n # Waiting for student.\n self.status = :awaiting_replies\n self.replies_due = calculate_replies_due # Store the final replies due date.\n end\n\n self.save! validate: false\n\n StudentMailer.decisions_made(student, self).deliver_later\n StudentMessenger.new.decisions_made(student, self)\n end\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: \"振り返りの更新に成功しました。\" }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_status\n if wait? and challenged_performance and challenger_performance\n self.approval_waiting!\n notify_judges\n end\n end",
"def update\n respond_to do |format|\n if @pre_training_review.update(pre_training_review_params)\n # format.html { redirect_to @pre_training_review, notice: 'Pre training review was successfully updated.' }\n if (current_user.enrolments.count == 0)\n format.html {redirect_to new_enrolment_path, notice: 'Pre training review is updated.'}\n else\n format.html {redirect_to edit_enrolment_path(current_user.enrolments.first), notice: 'Pre training review is updated.'}\n end\n format.json { render :show, status: :ok, location: @pre_training_review }\n else\n format.html { render :edit }\n format.json { render json: @pre_training_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def approval_status\n self.approved? ? 'Approved ' : 'Pending '\n end"
] |
[
"0.6502814",
"0.64420223",
"0.6370287",
"0.6361855",
"0.63438636",
"0.62839556",
"0.6064108",
"0.59603673",
"0.5960339",
"0.5909844",
"0.5909808",
"0.5893468",
"0.58838636",
"0.5882186",
"0.5855061",
"0.5848491",
"0.58448297",
"0.5834676",
"0.5825427",
"0.58159834",
"0.57994366",
"0.5799003",
"0.5788557",
"0.57835716",
"0.5776625",
"0.5752912",
"0.5750122",
"0.57245564",
"0.57205",
"0.57200456",
"0.570738",
"0.57014257",
"0.5693883",
"0.567953",
"0.5674436",
"0.5665987",
"0.5665634",
"0.56618273",
"0.5647579",
"0.5647029",
"0.56387645",
"0.56377447",
"0.5616604",
"0.5614247",
"0.56092453",
"0.5600903",
"0.5592105",
"0.5578655",
"0.55780226",
"0.5574028",
"0.5572928",
"0.5565487",
"0.5562225",
"0.5549431",
"0.5547123",
"0.5545036",
"0.5514034",
"0.55085665",
"0.55036354",
"0.5497964",
"0.54904866",
"0.54887325",
"0.5487595",
"0.54855984",
"0.5477395",
"0.54690504",
"0.5464195",
"0.5459369",
"0.54575264",
"0.5454559",
"0.5447033",
"0.54454374",
"0.5445045",
"0.5443551",
"0.54405564",
"0.5438356",
"0.5438325",
"0.5438272",
"0.543559",
"0.54223263",
"0.54141617",
"0.5410907",
"0.53978926",
"0.5397598",
"0.5394376",
"0.5387758",
"0.53813726",
"0.5380966",
"0.53748745",
"0.5368279",
"0.53680396",
"0.5358043",
"0.53580385",
"0.5348542",
"0.533952",
"0.53375554",
"0.5333983",
"0.5331225",
"0.5325409",
"0.53216594"
] |
0.6651151
|
0
|
Evaluates the PR review state
|
def evaluate_review_state(state)
net_pluses = 0
if state == "approved"
net_pluses = 1
elsif state == "changes_requested"
net_pluses = -1
end
return net_pluses
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reviewed?\n @status == :reviewed\n end",
"def check_plagiarism_state(auto_metareview, count_copies, rev_array, scores)\n if count_copies > 0 #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n\n\n if count_copies == scores.length\n return ALL_RESPONSES_PLAGIARISED #plagiarism, with all other metrics 0\n else\n return SOME_RESPONSES_PLAGIARISED #plagiarism, while evaluating other metrics\n end\n end\nend",
"def reviewed?\n review_count = Review.where(user: user, essay: assignment.essays).count\n total_count = assignment.user_assignments.count\n total_count - review_count - 1 <= 0\n end",
"def create\n @review = Review.new(review_params)\n @review.memberid = current_account.id\n @state = false\n if @review.save\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.committee.tracks.each do |track| \n if( track.userid == current_account.id && track.role == \"PC Member\" )\n @state = true\n end\n end\n if(@state)\n respond_to do |format|\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n end\n else\n @review.destroy\n redirect_to @paper.committee.conference, notice: \"You are not an PC member of that committee. Review not created.\"\n end\n else\n respond_to do |format|\n format.html { render :new}\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def review\n @review\n end",
"def update_state\n @paperproposal = Paperproposal.find(params[:id])\n pre_state = @paperproposal.board_state\n @paperproposal.update_attributes(params[:paperproposal])\n @paperproposal.lock = true\n @paperproposal.save\n\n #submit again\n if pre_state == \"re_prep\" && @paperproposal.board_state == \"submit\"\n @paperproposal.paperproposal_votes.each{|element| element.update_attribute(:vote, \"none\")}\n end\n\n project_board_role = Role.find_by_name(\"project_board\")\n users = project_board_role.users\n users.each{|user| @paperproposal.paperproposal_votes << PaperproposalVote.new(:user => user, :project_board_vote => true)}\n\n redirect_to @paperproposal\n end",
"def process_created_review(review_payload)\n pr_name = review_payload['repository']['full_name'].to_s\n pr_number = review_payload['pull_request']['number'].to_s\n comment_user = review_payload['review']['user']['id'].to_s\n approvals = evaluate_review_state(review_payload['review']['state'])\n current_commit_hash = review_payload['pull_request']['head']['sha'].to_s\n\n submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n end",
"def review\n end",
"def under_review?(item)\n state_group(item) == :review\n end",
"def update\n unless @submission.evaluated.blank?\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission), info: \"Evaluated!\" }\n end\n return\n end\n\n unless Time.now > @timeout + 5.seconds\n @submission.answers_of_questions.each do |user_answer|\n user_answer.update(choice: submission_params.fetch(user_answer.answer_id.to_s, \"false\"))\n end\n end\n if Time.now > @timeout || params[:evaluate]\n @test.questions.each do |question|\n crrct = get_result(question)\n @submission.increment!(:point, question.point) if crrct\n @submission.question_evaluations.create({question_id: question.id, value: crrct})\n end\n @submission.update(evaluated: true)\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission) }\n end\n else\n respond_to do |format|\n format.html { redirect_to submissions_path, success: 'Submission was successfully saved.' }\n end\n end\n\n end",
"def post_review?(next_review, user)\n\n (next_review && \n !self.review_locked? && \n next_review.designer_id == user.id &&\n next_review.review_type_id == next_review.design.phase_id)\n\n end",
"def just_reviewed?\n reviewed? and reviewed_changed?\n end",
"def review; end",
"def show\n authorize! :show, @gf_travel_request\n if hf_transition_to_in_review?(@gf_travel_request, @user) # defined in StateEvents\n @gf_travel_request.approval_state.review!\n end\n end",
"def evaluation_status\n array = placements.filled.collect(&:evaluation_submitted?)\n if array.include?(false)\n status = array.include?(true) ? false : nil\n else\n status = array.empty? ? nil : true\n end\n status \n end",
"def under_review_status\n 'Under Review'\n end",
"def reviewed?\n !application_review_decision_type.nil?\n end",
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def compare_reviews_with_questions(auto_metareview)\n\n review_text_arr = auto_metareview.review_array\n\n scores = Score.find(:all, :conditions => [\"response_id = ?\", response.id])\n\n questions = Array.new\n\n #fetching the questions for the responses\n for i in 0..scores.length - 1\n questions << Question.find_by_sql([\"Select * from questions where id = ?\", scores[i].question_id])[0].txt\n end\n\n\n count_copies = 0 #count of the number of responses that are copies either of questions of other responses\n rev_array = Array.new #holds the non-plagiairised responses\n #comparing questions with text\n for i in 0..scores.length - 1\n if(!questions[i].nil? and !review_text_arr[i].nil? and questions[i].downcase == review_text_arr[i].downcase)\n count_copies+=1\n\n end\n\n #comparing response with other responses\n\n end\n\n\n #setting @review_array as rev_array\n check_plagiarism_state(auto_metareview, count_copies, rev_array, scores)\n\n end",
"def closed_submission_status\n 'Closed for Review'\n end",
"def approved?\n state == 'approved'\n end",
"def active?\n name = self.review_status.name\n name == 'In Review' || name == 'Pending Repost' || name == 'Review On-Hold'\n end",
"def pending_repost?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Pending Repost'\").id\n end",
"def in_review?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='In Review'\").id\n end",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def review_complete?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review Completed'\").id\n end",
"def proposal_status(proposal)\n if proposal.key?(:decision)\n proposal.fetch(:decision)\n else\n proposal[:submitted_at].nil? ? 'draft' : 'submitted'\n end\n end",
"def review\n fetch('restaurant.review')\n end",
"def update_review_status_if_changes_substantial\n return unless @description.save_version?\n\n @description.update_review_status(@description.review_status)\n end",
"def set_overview_state\n pass_test = true\n passed_validations = 0\n total_validations = 0\n document_ids.each do |document|\n doc = Document.find(document)\n total_validations += 1\n doc_pass = doc.update_state\n pass_test &&= doc_pass\n passed_validations += 1 if doc_pass\n end\n pass_test ? update_attribute(:state, :passed) : update_attribute(:state, :failed)\n update_attribute(:results, passed: passed_validations, total: total_validations)\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 allow_review?(proposal)\n (program_mode? || !proposal.has_speaker?(current_user)) && !proposal.finalized?\n end",
"def in_review?\n @in_review ||= begin\n raise NotFetchedError unless fetched?\n [!!@data.match(/<p class=\"Warning\">Sorry, you cannot view this cache listing until it has been published/),\n !!@data.match(/<p class=\"Warning\">This cache listing has not been reviewed yet/)].any?\n end\n end",
"def is_mfa_in_review?\n return false unless sipity_entity\n\n sipity_entity&.workflow_name == 'art_mfa_deposit' && state == 'pending_review'\n end",
"def show\n authorize! :show, @travel_request\n if hf_transition_to_in_review?(@travel_request, @user) # defined in StateEvents\n @travel_request.approval_state.review!\n end\n end",
"def review\n return access_denied unless @course.has_teacher(current_user) || @submission.group.has_reviewer?(current_user) || (@exercise.collaborative_mode == 'review' && (@course_instance.has_student(current_user) || @course_instance.has_assistant(current_user)))\n\n review = @submission.assign_to(current_user)\n\n redirect_to edit_review_path(review)\n log \"create_review #{@submission.id},#{@exercise.id}\"\n end",
"def current_state\n if self.steps.where(state: 'reproved').exists?\n 'reproved'\n elsif self.steps.pluck(:state).uniq == ['approved']\n 'approved'\n else\n 'waiting'\n end\n end",
"def show_review_action(movie, status)\n\tcheck = user_already_reviewed(movie)\n\tif check == -1\n\t @show_review_action = true \n\telsif (check == 0 && status == true) || (check == 1 && status == false) || check == 2\n\t @show_review_action = false \n\telse\n\t @show_review_action = true\n\tend\n\nend",
"def add_review\n login_as(User.where(role_id: 1).first.name)\n expect(page).to have_content 'User: ' + User.where(role_id: 1).first.name\n\n expect(page).to have_content 'TestAssignment'\n\n click_link 'TestAssignment'\n expect(page).to have_content 'Submit or Review work for TestAssignment'\n expect(page).to have_content \"Others' work\"\n\n click_link \"Others' work\"\n expect(page).to have_content 'Reviews for \"TestAssignment\"'\n\n choose 'topic_id'\n click_button 'Request a new submission to review'\n\n click_link 'Begin'\n\n fill_in 'responses[0][comment]', with: 'HelloWorld'\n select 3, from: 'responses[0][score]'\n click_button 'Submit Review'\n expect(page).to have_content 'Your response was successfully saved.'\n click_link 'Logout'\n end",
"def update\n @review = Review.find(params[:id])\n @review.attributes = review_params(params)\n\n update_story_attributes(@review, params[:story])\n update_member_settings(@review, params[:review_form_expanded])\n update_source_review(@review.story, params[:source_ratings])\n \n if @review.save_and_process_with_propagation\n if current_member.status == 'guest'\n flash[:notice] = render_to_string(:inline => \"<h2>Your review was successfully updated,<br>but will not be published until you activate your account.</h2>Check your email inbox and click on your activation link. For help, check our <%= help_link('FAQ', 'activate') %>.\")\n render :json => { :go => :story_actions, \n :form_transition => {:from => :review, :to => :story_actions} }.to_json\n else\n notice = tweet_if_requested(@review, params[:short_url])\n render :json => { :go => :story_actions, \n :form_transition => {:from => :review, :to => :story_actions}, \n :notice => notice,\n :fb_stream_story => toolbar_facebook_stream_story(@review) }.to_json\n end\n\n if @review.hidden? && !current_member.has_role_or_above?(:admin)\n NotificationMailer.deliver_edit_alert(:subject => \"Hidden Review Updated\", :body => \"Check #{review_url(@review)}.\")\n end\n else\n render :json => {:error_message => \"Failed to save review\"}.to_json\n end\n end",
"def approval_state\n if self.class.approvable_field\n send(self.class.approvable_field)\n elsif approval.present?\n approval.state\n end\n end",
"def update_pr_state(state)\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n api.update_pull_request(@repo, @number, state: state)\n end",
"def do_quick_approx_propagation\n story = @review.story\n if story.reviews_count < 2\n story.rating = @review.rating\n story.save(false)\n end\n end",
"def on_submitted_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n __debug_sim(\"[no_review: #{submission.no_review}]\")\n must_review = !submission.no_review\n else\n must_review = true\n end\n\n # Determine whether the item needs to be reviewed.\n unless simulating\n must_review = record.review_required? if record\n end\n\n # TODO: simulation - remove\n if must_review\n __debug_sim('This item requires review.')\n else\n __debug_sim('This item can be submitted without review.')\n end\n\n # Automatically transition to the next state based on submission status.\n if must_review\n schedule! # NOTE: => :scheduling\n else\n advance! # NOTE: => :staging\n end\n self\n end",
"def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def evaluate\n\n end",
"def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`\n result.message << \"Head Branch check |\"\n is_from_feature = github.branch_for_head.start_with?(\"feature/\")\n is_from_refactor = github.branch_for_head.start_with?(\"refactor/\")\n is_from_fix = github.branch_for_head.start_with?(\"fix/\")\n is_from_issue = github.branch_for_head.start_with?(\"issue/\")\n is_from_version = github.branch_for_head.start_with?(\"version/\")\n if is_from_feature || is_from_refactor || is_from_fix || is_from_issue || is_from_version\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR from a from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `develop` branch\n result.message << \"Base Branch check |\"\n is_to_develop = github.branch_for_base == \"develop\"\n if is_to_develop\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR to `develop` branch.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## If PR is sent from a branch that begins with `version/`, do a release modification check\n if is_from_version\n release_modification_check_into_result(result)\n end\n\n ## PR shouldn't contain any merge commits\n result.message << \"Merge Commits check |\"\n contains_merge_commits = git.commits.any? { |c| c.parents.length > 1 }\n unless contains_merge_commits\n result.message << \":o:\\n\"\n else\n fail \"Please don't contain any merge commits in the branch. Consider Rebase if required.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should have less than 1000 lines of modifications if possible.\n result.message << \"Modification Volumn check |\"\n is_fix_too_big = git.lines_of_code > 1_000\n unless is_fix_too_big\n result.message << \":o:\\n\"\n else\n warn \"Too many modifications. Please consider splitting the PR if possible.\"\n result.message << \":heavy_exclamation_mark:\\n\"\n result.warnings += 1\n end\n\n return result\n\nend",
"def create\n @review = Review.new(review_params)\n @review.exceptional ||= 0\n if @review.save\n @apn.update_attribute(:reviewed, true)\n link = reviews_path\n name = @apn.profile.first_name.capitalize + \" \".to_s + @apn.profile.last_name.capitalize\n redirect_to new_review_path, notice: (\"#{name} successfully reviewed.\" +\n \" New application loaded. If you're feeling lazy, <a href='#{link}'>\" +\n \"go to the Dashboard</a>\").html_safe\n else\n render action: \"new\", alert: \"something went wrong with submitting the review\"\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id).first\n @responses = ((e = @evaluations[0]) ? e.responses.sort_by {|obj| obj.created_at } : [])\n @user = params[:instructor_review_of] ? User.find(params[:instructor_review_of]) : current_user\n @submitter = @submission.user_id == @user.submitting_id(@submission)\n\n if params[:instructor_approved_toggle]\n @submission.instructor_approved = !@submission.instructor_approved\n @submission.save!\n if @submission.instructor_approved\n redirect_to (course_assignment_path({id: params[:assignment_id]} )) + '/submissions'\n return\n else\n respond_to do |format|\n format.html { render :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\n elsif params[:finish]\n if evaluation.finished # The reviewer is withdrawing the review\n evaluation.finished = false\n evaluation.save!\n redirect_to :back\n return\n else\n if evaluation.mark_incomplete_questions\n evaluation.finished = true\n evaluation.save!\n redirect_to course_assignment_path ({id: params[:assignment_id]} )\n return\n else\n flash[:error] = \"You can't publish unless all ratings and required comments are finished.\"\n redirect_to course_assignment_submission_path ({id: params[:id]} )\n # render 'show', :layout => 'no_sidebar'\n return\n end\n end\n else # it's a student who submitted it or is completing or seeing a review of someone else\n @kibitzing = params[:instructor]\n respond_to do |format|\n format.html { render (params[:instructor_review_of] ? 'show_review' : 'show'), :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\n end",
"def has_reviews?(proposal_id)\n\t\treturn (Review.find_all_by_proposal_id(proposal_id).count > 0)\n\tend",
"def evaluateDiffResult()\n\n end",
"def review_locked?\n (self.review_type.name == \"Final\" && \n (!(self.design.audit.skip? || self.design.audit.auditor_complete?) ||\n !self.design.work_assignments_complete?))\n end",
"def marked_ready_for_review\n @marked_ready_for_review ||= (ready_for_review? ? 1 : 0)\n end",
"def update\n\t\t\t\trender_invalid_action(current_review) unless current_review.update(update_driver_review_params)\n\t\t\tend",
"def review_committee_decision\n application_review_decision_type.title if application_review_decision_type\n end",
"def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end",
"def compare_reviews_with_responses(auto_metareview, map_id)\n review_text_arr = auto_metareview.review_array\n response = Response.find(:first, :conditions => [\"map_id = ?\", map_id])\n scores = Score.find(:all, :conditions => [\"response_id = ?\", response.id])\n\n #fetching the questions for the responses\n\n\n count_copies = 0 #count of the number of responses that are copies either of questions of other responses\n rev_array = Array.new #holds the non-plagiairised responses\n\n\n\n #comparing response with other responses\n flag = 0\n for j in 0..review_text_arr.length - 1\n if(i != j and !review_text_arr[i].nil? and !review_text_arr[j].nil? and review_text_arr[i].downcase == review_text_arr[j].downcase)\n count_copies+=1\n flag = 1\n break\n end\n end\n\n if(flag == 0) #ensuring no match with any of the review array's responses\n rev_array << review_text_arr[i]\n end\n\n\n #setting @review_array as rev_array\n check_plagiarism_state(auto_metareview, count_copies, rev_array, scores)\n\n end",
"def evaluate!\n eval_start = Time.now\n\n reset\n\n @@checks.each do |name,check|\n @status_code = [check.evaluate!, @status_code].max\n end\n\n @finished = Time.now.utc\n @ms = (Time.now - eval_start) * 1000\n\n if @@checks.size == 0\n @status = :unknown\n @status_code = self.class.valid_status_map[@status]\n else\n @status = self.class.valid_status_map.invert[@status_code]\n end\n end",
"def review\n room = Room.find(params[:room_id])\n publish_async(\"presence-rooms\", \"update_recent_activities\", {\n message: \"#{current_user.name} has left room #{room.title}.\"\n })\n histories = current_user.histories\n .where(room_id: room.id)\n .joins(:choice)\n .includes(:question)\n @questions = histories.collect do |h| {\n id: h.question_id,\n prompt: h.question.prompt,\n paragraph: h.question.paragraph,\n choices: h.question.choices.collect do |c| {\n data: c,\n result: if h.question.correct_choice_ids.include? c.id\n \"correct\"\n elsif c.id==h.choice_id\n \"selected\"\n end\n }\n end\n }\n end\n end",
"def update_vote\n @to_vote = PaperproposalVote.find(params[:id])\n @to_vote.update_attributes(params[:paperproposal_vote])\n @paperproposal = @to_vote.paperproposal\n\n unless @to_vote.save\n flash[:error] = @to_vote.errors\n redirect_to :profile\n end\n\n if @to_vote.vote == \"reject\"\n @paperproposal.board_state = \"re_prep\"\n @paperproposal.lock = false\n @paperproposal.save\n end\n\n all_none_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"none\"}\n all_reject_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"reject\"}\n\n if all_none_votes.empty? & all_reject_votes.empty?\n case @paperproposal.board_state\n when \"submit\"\n prepare_data_request_for_accept_state\n when \"accept\"\n @paperproposal.board_state = \"final\"\n @paperproposal.lock = false\n @paperproposal.save\n @paperproposal.datasets.each do |context|\n context.accepts_role! :proposer, @paperproposal.author\n end\n else\n #do nothing\n end\n end\n redirect_to :profile\n end",
"def show\n if user_signed_in?\n @trigger = TriggerAction.pending_action(\"review_required\", current_user, @assignment)\n @my_answers = Answer.where(user: current_user, assignment: @assignment, active: true)\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id)\n\n if current_user.get_and_store_experimental_condition!(@assignment.course) == \"batched_email\"\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id).where('created_at < ?', 1.day.ago)\n end\n @reviews_by_me = Review.where(active: true, assignment_id: @assignment.id).where(\"user_id = ? or copilot_email = ?\", current_user.id,current_user.email)\n @out_of_box_answers_with_count = Review.where(assignment_id: @assignment.id, out_of_box_answer: true).group(:answer_id).count\n\n unless @out_of_box_answers_with_count.blank?\n @out_of_box_answers = @out_of_box_answers_with_count.reject {|k,v| v < 2 }\n end\n if @out_of_box_answers.blank?\n @out_of_box_answers = {}\n end\n end\n @all_answers = @assignment.answers.reviewable.limit(10)\n @starred_answers = @assignment.answers.reviewable.where(starred: true)\n render layout: \"one_column\"\n end",
"def evaluate()\n @effective\n end",
"def is_scorable_review? \n if self.is_resident_review?\n return true # Review belongs to resident of the city, so it's scorable.\n elsif self.has_enough_votes? # Reviewer isn't resident of city being review, so does the review have enough votes to be scorable\n return true # Has enough votes to affect city score \n else # Review doesn't have enough votes and is a non-resident review.\n return false\n end \n end",
"def compute_reviews_hash\n @review_scores = {}\n @response_type = 'ReviewResponseMap'\n # @myreviewers = ResponseMap.select('DISTINCT reviewer_id').where(['reviewed_object_id = ? && type = ? ', self.id, @response_type])\n\n # if this assignment uses vary rubric by rounds feature, load @questions for each round\n if self.varying_rubrics_by_round? # [reviewer_id][round][reviewee_id] = score\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n @response_maps = ResponseMap.where(['reviewed_object_id = ? && type = ?', self.id, @response_type])\n review_questionnaire_id = review_questionnaire_id(round)\n\n @questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n\n @response_maps.each do |response_map|\n # Check if response is there\n @corresponding_response = Response.where(['map_id = ?', response_map.id])\n unless @corresponding_response.empty?\n @corresponding_response = @corresponding_response.reject {|response| response.round != round }\n end\n @respective_scores = {}\n @respective_scores = @review_scores[response_map.reviewer_id][round] if !@review_scores[response_map.reviewer_id].nil? && !@review_scores[response_map.reviewer_id][round].nil?\n\n if !@corresponding_response.empty?\n # @corresponding_response is an array, Answer.get_total_score calculate the score for the last one\n @this_review_score_raw = Answer.get_total_score(response: @corresponding_response, questions: @questions)\n if @this_review_score_raw\n @this_review_score = ((@this_review_score_raw * 100) / 100.0).round if @this_review_score_raw >= 0.0\n end\n else\n @this_review_score = -1.0\n end\n\n @respective_scores[response_map.reviewee_id] = @this_review_score\n @review_scores[response_map.reviewer_id] = {} if @review_scores[response_map.reviewer_id].nil?\n @review_scores[response_map.reviewer_id][round] = {} if @review_scores[response_map.reviewer_id][round].nil?\n @review_scores[response_map.reviewer_id][round] = @respective_scores\n end\n end\n else # [reviewer_id][reviewee_id] = score\n @response_maps = ResponseMap.where(['reviewed_object_id = ? && type = ?', self.id, @response_type])\n review_questionnaire_id = review_questionnaire_id()\n\n @questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n\n @response_maps.each do |response_map|\n # Check if response is there\n @corresponding_response = Response.where(['map_id = ?', response_map.id])\n @respective_scores = {}\n @respective_scores = @review_scores[response_map.reviewer_id] unless @review_scores[response_map.reviewer_id].nil?\n\n if !@corresponding_response.empty?\n # @corresponding_response is an array, Answer.get_total_score calculate the score for the last one\n @this_review_score_raw = Answer.get_total_score(response: @corresponding_response, questions: @questions)\n if @this_review_score_raw\n @this_review_score = ((@this_review_score_raw * 100) / 100.0).round if @this_review_score_raw >= 0.0\n end\n else\n @this_review_score = -1.0\n end\n @respective_scores[response_map.reviewee_id] = @this_review_score\n @review_scores[response_map.reviewer_id] = @respective_scores\n end\n\n end\n @review_scores\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_ID_25863_comment_on_review()\n login $user_1_email, $master_password\n read_all_updates\n \n $browser.goto(\"http://flatiron.#{$environment}.patch.com/listings/yelp\")\n $share_review_text_field.when_present().click\n $post_compose_review.when_present().set (\"Automated review text #{random}\")\n $group_post_button.when_present().click\n\n logout_common\n login $user_1_email, $master_password\n $browser.goto(\"http://flatiron.#{$environment}.i.patch.com/listings/yelp\")\n $comment_icon.click\n sleep 3\n $leave_comment_textfield.set \"Automated comment text #{random}\"\n $group_post_comment.click\n logout_common\n login $user_1_email, $master_password\n verify_updates\n end",
"def reset_reviewed\n if copy_changed? && !approved_changed?\n if copy_change[0] != copy_change[1]\n self.reviewer_id = nil\n self.approved = nil\n end\n end\n return true\n end",
"def show\n @score = Evaluation.eval_post(@post)\n end",
"def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end",
"def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end",
"def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?',\n self.id, reviewer.id, assignment.id]) > 0\n end",
"def pending_review\n reviews = Review.where(\"stage != ?\", \"approved\")\n all_cps_under_review = []\n user_cps_under_review = []\n\n reviews.each do |review|\n all_cps_under_review << review.critical_process\n end\n\n all_cps_under_review.each do |cp|\n if self.cps_as_reviewer.include?(cp)\n user_cps_under_review << cp\n end\n end\n\n return user_cps_under_review\n end",
"def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end",
"def special_status_by_reviewers\n asrs = self.article_submission_reviewers.group_by(&:current_status_key)\n total = self.article_submission_reviewers.length\n asrs['reviewer_recieved_comments'] ||= []\n asrs['reviewer_not_yet_invited'] ||= []\n asrs['reviewer_invited_awaiting_response'] ||= []\n asrs['reviewer_declined_with_alternate'] ||= []\n asrs['reviewer_need_comments'] ||= []\n asrs['reviewer_given_up'] ||= []\n\n asrs['comments_overdue'] = asrs['reviewer_need_comments'].select {|asr| asr.comments_overdue?}\n\n if total == 0 \n return 'Need reviewers'\n elsif asrs['reviewer_recieved_comments'].length == total\n return 'All comments received'\n elsif asrs['comments_overdue'].length >= 1\n return 'Late comments'\n elsif asrs['reviewer_invited_awaiting_response'].length > 0\n return 'Requests sent to reviewers'\n elsif asrs['reviewer_not_yet_invited'].length > 0\n return 'Reviewers not yet invited'\n else\n return 'With reviewers'\n end\n end",
"def is_final_review?\n final_review = ReviewType.get_final\n self.review_type_id == final_review.id\n end",
"def update\n if @review.update(review_params)\n render :show, status: :ok, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"def set_evaluation\n @evaluation = Evaluation.find_or_create_by(post_id:params[:post_id], user: current_user)\n end",
"def ratings(number_of_reviews)\n\t\treturn true if number_of_reviews > 0\n\tend",
"def invisible_testSuccess(c, ci, cv, state)\n @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == c and terms[1] == ci}\nend",
"def reviewed?(profile)\n self.reviews.find_by_profile_id(profile.id)\n end",
"def evaluate_answer(answer)\n question = answer.question.actable\n answer_text_array = answer.normalized_answer_text.downcase.gsub(/([^a-z ])/, ' ').split(' ')\n answer_text_lemma_array = []\n answer_text_array.each { |a| answer_text_lemma_array.push(WordNet::Synset.morphy_all(a).first || a) }\n\n hash_lifted_word_points = hash_compre_lifted_word(question)\n hash_keyword_solutions = hash_compre_keyword(question)\n\n lifted_word_status = find_compre_lifted_word_in_answer(answer_text_lemma_array, hash_lifted_word_points)\n keyword_status = find_compre_keyword_in_answer(answer_text_lemma_array, lifted_word_status, hash_keyword_solutions)\n\n answer_text_lemma_status = {\n 'compre_lifted_word': lifted_word_status,\n 'compre_keyword': keyword_status\n }\n\n answer_grade = grade_for(question, answer_text_lemma_status)\n\n [\n correctness_for(question, answer_grade),\n answer_grade,\n explanations_for(question, answer_grade, answer_text_array, answer_text_lemma_status)\n ]\n end",
"def awarded_by_review_committee?\n application_review_decision_type.nil? ? false : application_review_decision_type.yes_option\n end",
"def evaluation\n\t@offering = Offering.find params[:id]\n\t\tif (@offering.evaluation == \"--\")\n\t\t\t@offering.update_attribute(:evaluation, \"Fail\")\n\t\telsif (@offering.evaluation == \"Fail\")\n\t\t\t@offering.update_attribute(:evaluation, \"Pass\")\n\t\telsif (@offering.evaluation == \"Pass\")\n\t\t\t@offering.update_attribute(:evaluation, \"Other\")\n\t\telsif (@offering.evaluation == \"Other\")\n\t\t\t@offering.update_attribute(:evaluation, \"--\")\n\t\telse\n\t\t\t@offering.update_attribute(:evaluation, \"Fail\")\n\t\tend\n\n\t\tredirect_to :back\n\tend",
"def get_relevance(reviews, submissions, num_reviews, pos_tagger, core_NLP_tagger, speller)\n review_vertices = nil\n review_edges = nil\n subm_vertices = nil\n subm_edges = nil\n num_rev_vert = 0\n num_rev_edg = 0\n num_sub_vert = 0\n numSubEdg = 0\n vert_match = 0.0\n edge_without_syn = 0.0\n edge_with_syn = 0.0\n edge_diff_type = 0.0\n double_edge = 0.0\n double_edge_with_syn = 0.0\n \n #since Reviews and Submissions \"should\" contain the same number of records review - submission pairs\n g = GraphGenerator.new\n #generating review's graph\n g.generate_graph(reviews, pos_tagger, core_NLP_tagger, true, false)\n review_vertices = g.vertices\n review_edges = g.edges\n num_rev_vert = g.num_vertices\n num_rev_edg = g.num_edges\n \n #assigning graph as a review graph to use in content classification\n @review = g.clone\n \n #generating the submission's graph\n g.generate_graph(submissions, pos_tagger, core_NLP_tagger, true, false)\n subm_vertices = g.vertices\n subm_edges = g.edges\n num_sub_vert = g.num_vertices\n num_sub_edg = g.num_edges\n\n compareVerticesObj = CompareGraphVertices.new\n compareSVOEdgesObj = CompareGraphSVOEdges.new\n compareEdgesObj = CompareGraphEdges.new\n @vertex_match, vert_match = compareVerticesObj.compare_vertices(@vertex_match, pos_tagger, review_vertices,\n subm_vertices, num_rev_vert, num_sub_vert, speller)\n\n if(num_rev_edg > 0 and num_sub_edg > 0)\n @vertex_match, edge_without_syn =\n compareEdgesObj.compare_edges_non_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_with_syn =\n compareEdgesObj.compare_edges_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_diff_type =\n compareEdgesObj.compare_edges_diff_types(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n edge_match = (edge_without_syn.to_f + edge_with_syn.to_f )/2.to_f #+ edge_diff_type.to_f\n @vertex_match, double_edge =\n compareSVOEdgesObj.compare_SVO_edges(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, double_edge_with_syn =\n compareSVOEdgesObj.compare_SVO_diff_syntax(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n double_edge_match = (double_edge.to_f + double_edge_with_syn.to_f)/2.to_f\n else\n edge_match = 0\n double_edge_match = 0\n end\n \n #differently weighted cases\n #tweak this!!\n alpha = 0.55\n beta = 0.35\n gamma = 0.1 #alpha > beta > gamma\n\n #case1's value will be in the range [0-6] (our semantic values)\n relevance = (alpha.to_f * vert_match.to_f) + (beta * edge_match.to_f) + (gamma * double_edge_match.to_f)\n scaled_relevance = relevance.to_f/6.to_f #scaled from [0-6] in the range [0-1]\n\n return scaled_relevance\nend",
"def get_reviews(reviews)\n all_revs = reviews.map do |r|\n {\n status: r.state,\n reviewer: r.author.login,\n date: get_yyyymmdd_hhnnss(r.updated_at),\n age: age(r.updated_at)\n }\n end\n revs_by_person = all_revs.group_by { |r| r[:reviewer] }.values\n latest_revs = revs_by_person.map do |persons_reviews|\n persons_reviews.sort { |a, b| a[:date] <=> b[:date] }[-1]\n end\n \n # if (latest_revs.size() != all_revs.size) then\n # puts '------- CONDENSING to latest -------'\n # puts \"ALL:\\n#{all_revs}\"\n # puts \"LATEST:\\n#{latest_revs}\"\n # end\n \n latest_revs\n end",
"def new\r\n @reviewId = params[:review_id]\r\n @review = Review.find(@reviewId)\r\n \r\n @reviewer = TeamMember.find_by_name('Eric Peterson')\r\n\r\n @reviewee_name = @review.TeamMember.name\r\n @reviewer_name = @reviewer.name\r\n\r\n @evaluation = Evaluation.new\r\n @evaluation.Review = @review\r\n @evaluation.TeamMember = @reviewer\r\n\r\n @questions = Question.all\r\n @answers = @questions.compact.map { |q|\r\n @r = Response.new\r\n @r.Evaluation = @evaluation\r\n @r.Question = q\r\n @r.Answer = Answer.new\r\n\r\n @r\r\n }\r\n\r\n @evaluation.answer_set = @answers\r\n \r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end",
"def add_employee_review(input)\n self.review = input\n positive_matches = 0\n negative_matches = 0\n\n positive = [/positive/i, /initiative/i, /great/i, /good/i, /helpful/i,\n /puntual/i, /positive/i, /encourage/i, /beneficial/i, /meets/i,\n /good/i, /(team player)/i, /(hard working)/i, /helps/i, /impressed/i, /impressive/i, /fast/i, /asset/i, /leadership/i, /leader/i, /efficient/i, /(willing to help)/i, /successfully/i,\n /pleasure/i]\n\n negative = [/negative/i, /lazy/i, /bad/i, /stubborn/i, /(misses deadlines)/i,\n /late/i, /concerns/i, /difficulty/i, /struggles/i, /limitations/i,\n /inconsistent/i, /inefficient/i, /(not done well)/i, /poorly/i,\n /badly/i, /rude/i, /(off topic)/i, /lack/i, /inadequate/i, /limitation/i, /(room for improvement)/i, ]\n positive.each do |r|\n matches = review.scan(r).count\n positive_matches += matches\n end\n negative.each do |r|\n matches = review.scan(r).count\n negative_matches += matches\n end\n self.satisfactory = (positive_matches > negative_matches)\n end",
"def get_active_reviews\n\n design_reviews = []\n Design.find(:all,\n :conditions => \"phase_id!=#{Design::COMPLETE}\",\n :include => :design_reviews).each do |design|\n\n next if design.phase_id == 0 \n design_review = design.design_reviews.detect { |dr| dr.review_type_id == design.phase_id }\n\n\n begin\n priority_name = design_review.priority.name\n rescue\n priority_name = 'Unset'\n end\n \n reviewers = 0\n approvals = 0\n if design.phase.name != \"Planning\"\n results = design_review.design_review_results.collect { |r| r.result }\n reviewers = results.size\n approvals = results.find_all { |r| \n (r == DesignReviewResult::APPROVED ||\n r == DesignReviewResult::WAIVED) }.size\n end \n design_reviews << { :review => design_review, :priority_name => priority_name, \n :reviewers => reviewers, :approvals => approvals } \n \n end\n \n lists = { :active => [], :inactive => [] }\n design_reviews.each do |design_review|\n if design_review[:review].review_status.name != 'Not Started'\n lists[:active] << design_review\n else\n lists[:inactive] << design_review\n end\n end\n\n return lists\n \n end",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def start_review!\n @saving_review = true\n end",
"def start_review!\n @saving_review = true\n end",
"def voting?\n state_name == \"voting\"\n end",
"def evaluation_result\n return @evaluation_result\n end",
"def calculate_report_corrective_change\n @corrective_change = resource_statuses.any? do |name, status|\n status.corrective_change\n end\n end",
"def check_rating_run\n raise Error.new(\"rating run is not in waiting state\") unless @rating_run.status == \"waiting\"\n rivals = @rating_run.rivals\n raise Error.new(\"there are other unfinished runs (#{rivals.map(&:id).join(', ')})\") if rivals.count != 0\n end",
"def update_status\n if paragraphs.any?(&:error?)\n has_paragraphs_in_error!\n elsif paragraphs.any?(&:to_review?)\n has_paragraphs_to_review!\n elsif paragraphs.any?(&:opinionated?)\n has_paragraphs_opinionated!\n else\n is_empty!\n end\n end",
"def can_review(cp)\n cps_as_reviewer.include?(cp)\n end",
"def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end"
] |
[
"0.65369254",
"0.6394565",
"0.6209691",
"0.6142017",
"0.61167043",
"0.6020812",
"0.60189486",
"0.59366703",
"0.59245205",
"0.58845884",
"0.5877376",
"0.5865738",
"0.58540964",
"0.5825794",
"0.5823771",
"0.5814638",
"0.5794821",
"0.5783649",
"0.575532",
"0.571283",
"0.57127154",
"0.5707615",
"0.57000226",
"0.567408",
"0.56667286",
"0.5653086",
"0.5646552",
"0.56338453",
"0.56147677",
"0.5612927",
"0.5606066",
"0.55733573",
"0.55493885",
"0.5539662",
"0.55249876",
"0.5515739",
"0.5499518",
"0.54748803",
"0.54650193",
"0.54347163",
"0.5431899",
"0.54295963",
"0.54235804",
"0.54115325",
"0.5408201",
"0.5403389",
"0.54012716",
"0.53997946",
"0.53965515",
"0.5392523",
"0.53844726",
"0.53751194",
"0.5368124",
"0.536597",
"0.53638065",
"0.53628755",
"0.53623706",
"0.5350156",
"0.53486776",
"0.5347179",
"0.5340911",
"0.5339106",
"0.53365225",
"0.53305584",
"0.5326334",
"0.5312367",
"0.5303389",
"0.5299075",
"0.5296608",
"0.52956855",
"0.52956855",
"0.52946067",
"0.5275889",
"0.5275339",
"0.52632666",
"0.52593195",
"0.5248787",
"0.5234067",
"0.523254",
"0.5223465",
"0.52216077",
"0.5218066",
"0.5216789",
"0.52162254",
"0.5209743",
"0.5205804",
"0.52034295",
"0.52016723",
"0.5201414",
"0.5197456",
"0.518809",
"0.5186415",
"0.5186415",
"0.51854926",
"0.51849365",
"0.51821995",
"0.51799905",
"0.51786464",
"0.5177126",
"0.5167204"
] |
0.7546724
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.