query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
DELETE /people/1 DELETE /people/1.json | def destroy
@person.destroy
respond_to do |format|
format.html { redirect_to people_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = people_type.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n track_activity @person\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"#{@person.name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person was successfully destroyed\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Uppgifterna om personen raderades.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n authorize! :destroy, @person\n \n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_info = PersonInfo.find(params[:id])\n @person_info.destroy\n\n head :no_content\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n Person.find(params[:id]).destroy\n redirect_to action: 'list'\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy if @person.users.empty?\n \n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @key_person = KeyPerson.find(params[:id])\n @key_person.destroy\n\n respond_to do |format|\n format.html { redirect_to key_people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @personaje = Personaje.find(params[:id])\n @personaje.destroy\n\n respond_to do |format|\n format.html { redirect_to personajes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_with(@person)\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html do\n redirect_to people_url(page: index_page),\n notice: 'Person was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n redirect_to people_url\n end",
"def delete\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person.destroy\n @application_session.destroy\n session[:cos_session_id] = nil\n render_json :status => :ok\n end",
"def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @people_id = @contactinfo.people_id\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@people_id) }\n format.json { head :ok }\n end\n end",
"def destroy\n @request_person.destroy\n respond_to do |format|\n format.html { redirect_to request_people_url, notice: 'Request person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n the_org = @person.org_id\n the_name = @person.name\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to org_path(the_org), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personnage = Personnage.find(params[:id])\n @personnage.destroy\n\n respond_to do |format|\n format.html { redirect_to personnages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emu_person.destroy\n respond_to do |format|\n format.html { redirect_to emu_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # .destroy is like a \"delete from people ...\"\n if @person.destroy\n # :ok is the http status code 200\n render status: :ok\n else\n render status: :not_found\n end\n \n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to( :action => 'index' ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @people = People.find(params[:id])\n @people.destroy\n\n respond_to do |format|\n format.html { redirect_to(peoples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit_person.destroy\n respond_to do |format|\n format.html { redirect_to visit_people_url, notice: 'Visit person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = @person.user\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_person = TypePerson.find(params[:id])\n @type_person.destroy\n\n respond_to do |format|\n format.html { redirect_to type_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect(person_animals_url, :delete, 'animal') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_info.destroy\n respond_to do |format|\n format.html { redirect_to person_infos_url, notice: 'Person info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @missing_person = MissingPerson.find(params[:id])\n @missing_person.destroy\n\n respond_to do |format|\n format.html { redirect_to missing_people_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_with(@person)\n end",
"def destroy\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Datos personales eliminados exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @hr_person.destroy\n respond_to do |format|\n format.html { redirect_to hr_people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.756637",
"0.75528497",
"0.755258",
"0.755258",
"0.755258",
"0.7542481",
"0.75265175",
"0.75265175",
"0.75265175",
"0.75265175",
"0.7441367",
"0.7421742",
"0.7394193",
"0.7350797",
"0.72796255",
"0.72706586",
"0.7260598",
"0.7246104",
"0.72252226",
"0.7197943",
"0.7190502",
"0.71817994",
"0.71802",
"0.7170023",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.7168784",
"0.71682984",
"0.71682984",
"0.7167549",
"0.7163834",
"0.7163834",
"0.7163834",
"0.7163834",
"0.7163834",
"0.7163834",
"0.7163834",
"0.7163834",
"0.71539164",
"0.7147595",
"0.7146055",
"0.7127867",
"0.7101654",
"0.70904356",
"0.7089944",
"0.7089944",
"0.7089382",
"0.70886695",
"0.7076807",
"0.7074651",
"0.7074651",
"0.7074651",
"0.7070304",
"0.7063507",
"0.7055805",
"0.70451087",
"0.703561",
"0.7027976",
"0.7018861",
"0.70165795",
"0.7010724",
"0.7000156",
"0.69915384",
"0.6984465",
"0.6971561",
"0.69680536",
"0.6957204",
"0.69547415",
"0.69316834",
"0.69281024",
"0.6915689",
"0.69143337",
"0.69114643",
"0.68945926",
"0.68663406",
"0.6857808",
"0.68527496",
"0.6851665",
"0.683777",
"0.6830001",
"0.68195575",
"0.6814807",
"0.67907983",
"0.678965",
"0.67795503",
"0.67779905",
"0.6777111",
"0.6774407",
"0.677231"
] | 0.7409622 | 16 |
Use callbacks to share common setup or constraints between actions | def get_genders
@genders = [['Male', 'male'], ['Female', 'female']]
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 run_actions; end",
"def action_hook; end",
"def callbacks; end",
"def callbacks; end",
"def actions; end",
"def add_actions; end",
"def define_action_hook; 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 post_setup\n end",
"def before_setup; end",
"def workflow\n end",
"def setup_handler\n end",
"def action_run\n end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\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 before_dispatch(env); end",
"def determine_valid_action\n\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def define_action_helpers; end",
"def pre_task\n end",
"def setup\n # override and do something appropriate\n end",
"def advice\n end",
"def after_set_callback; end",
"def matt_custom_action_begin(label); end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def around_hooks; end",
"def setup_signals; end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def after_generate_callbacks; end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def after_validate\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 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 validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def prepare_for_execution(evt,config)\n # here for sub-classes to override.\n end",
"def config(action, *args); 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 set_actions\n actions :all\n end",
"def execute(setup)\n @action.call(setup)\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 setup\n #implement in subclass;\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 callback_phase\n super\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def define_action_helpers?; 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 before_workflow_launch(workflow, user)\n #raise \"Must implement in target model!\"\n end",
"def process_action(...)\n send_action(...)\n end",
"def setup(state) ; 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 before_action \n end",
"def setup\n # override this if needed\n end",
"def perform_action(data); end",
"def before_run; end",
"def action(unit)\n\tend",
"def lookup_action; 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 do_adapter_specific_setup; end",
"def action\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 after_view_setup\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def callback\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 release_actions; end",
"def activate; end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def action\n end",
"def call\n setup_context\n super\n end",
"def form_setup\n\tend",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def callback\n\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 before(action)\n invoke_callbacks *self.class.send(action).before\n 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 action=(_arg0); end",
"def action_target()\n \n end",
"def save_action; end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def pre_authorize_cb=(_arg0); end",
"def _handle_action_missing(*args); end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def after_actions(*logic)\n self.after_actions = logic\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.6285902",
"0.618966",
"0.61873674",
"0.6065412",
"0.6065412",
"0.60507876",
"0.5903431",
"0.588588",
"0.5793752",
"0.5748446",
"0.5626589",
"0.56050205",
"0.55814654",
"0.55591184",
"0.55174696",
"0.5486214",
"0.5463819",
"0.54410374",
"0.5435411",
"0.5435411",
"0.5435411",
"0.5435411",
"0.5435411",
"0.54043466",
"0.5371364",
"0.53539425",
"0.53483653",
"0.53443265",
"0.5337072",
"0.5333718",
"0.5331716",
"0.5313207",
"0.531208",
"0.52811015",
"0.52811015",
"0.52811015",
"0.5278582",
"0.52648956",
"0.5256576",
"0.5256576",
"0.52563244",
"0.52539635",
"0.5253594",
"0.52522206",
"0.5238915",
"0.5236071",
"0.5235296",
"0.5229793",
"0.5226802",
"0.5215119",
"0.5215119",
"0.52132136",
"0.5210568",
"0.52037865",
"0.52022636",
"0.51981795",
"0.5194068",
"0.5178443",
"0.5177078",
"0.51746315",
"0.5174624",
"0.5163594",
"0.5162179",
"0.5154091",
"0.51506627",
"0.514943",
"0.5148602",
"0.5145701",
"0.51438886",
"0.5139682",
"0.51369685",
"0.5133249",
"0.51309144",
"0.51307636",
"0.5128007",
"0.5114761",
"0.5110816",
"0.5109417",
"0.51076543",
"0.5107144",
"0.510507",
"0.51027316",
"0.5101983",
"0.5098534",
"0.5097884",
"0.50948006",
"0.50940406",
"0.5089499",
"0.5087582",
"0.50856185",
"0.50856185",
"0.5081581",
"0.50773317",
"0.5076626",
"0.507509",
"0.5070452",
"0.5067632",
"0.5057437",
"0.5057437",
"0.5054973",
"0.5040492"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def person_params
params.require(:person).permit(:name, :lastname, :firstname, :gender, :age, :cabin_id, :role_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Creates a representation of a subscription. options: :callback_url => The url that should be used to handle subscription handshakes. :topic_url => The url of the feed one wishes to subscribe to. :secret => A secret that will be passed to the callback to better verify that communication is not replayed. Default: A secure random hex. :hubs => A list of hubs to negotiate the subscription with. Default: attempts to discover the hubs when it subscribes for the first time. :hub => The hub we have a subscription with already. | def initialize(options = {})
@tokens = []
secret = options[:secret] || SecureRandom.hex(32)
@secret = secret.to_s
@callback_url = options[:callback_url]
@topic_url = options[:topic_url]
@tokens << options[:token] if options[:token]
@hubs = options[:hubs] || []
@hub = options[:hub]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription(options = {})\n Subscription.new(options.merge(:url => url)).to_hash\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def subscription(options = {})\n\t\t\t# provide the client with another (i.e. the external address) if given\n\t\t\tsub = {server: config[:server_external] || config[:server], timestamp: (Time.now.to_f * 1000).round}.merge(options)\n\t\t\tsub[:signature] = Digest::SHA1.hexdigest([config[:secret_token], sub[:channel], sub[:timestamp]].join)\n\t\t\tsub\n\t\tend",
"def subscribe(options, &block)\n subscriptions.create(options, &block)\n end",
"def create_subscription topic, subscription_name, options = {}\n updated_option = construct_create_subscription_options topic, subscription_name, options\n subscriber.create_subscription(**updated_option)\n end",
"def subscription\n Zapi::Models::Subscription.new\n end",
"def create_subscription(sender)\n PsegRecurring::Subscription.new(@credentials).send_subscription(sender)\n end",
"def create_webhook_subscription(submission___context_id__,subscription___context_type__,subscription___event_types__,subscription___format__,subscription___transport_metadata__,subscription___transport_type__,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n :submission___context_id__,\n :subscription___context_type__,\n :subscription___event_types__,\n :subscription___format__,\n :subscription___transport_metadata__,\n :subscription___transport_type__,\n \n\n ]\n\n # verify existence of params\n raise \"submission___context_id__ is required\" if submission___context_id__.nil?\n raise \"subscription___context_type__ is required\" if subscription___context_type__.nil?\n raise \"subscription___event_types__ is required\" if subscription___event_types__.nil?\n raise \"subscription___format__ is required\" if subscription___format__.nil?\n raise \"subscription___transport_metadata__ is required\" if subscription___transport_metadata__.nil?\n raise \"subscription___transport_type__ is required\" if subscription___transport_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :submission___context_id__ => submission___context_id__,\n :subscription___context_type__ => subscription___context_type__,\n :subscription___event_types__ => subscription___event_types__,\n :subscription___format__ => subscription___format__,\n :subscription___transport_metadata__ => subscription___transport_metadata__,\n :subscription___transport_type__ => subscription___transport_type__\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:post, path, query_params, form_params, headers)\n response\n \n\n end",
"def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def make_subscription(params = {})\n plan = params.delete(:plan) || 'gold'\n {\n :current_period_end => 1308681468,\n :status => \"trialing\",\n :plan => {\n :interval => \"month\",\n :amount => 7500,\n :trial_period_days => 30,\n :object => \"plan\",\n :identifier => plan\n },\n :current_period_start => 1308595038,\n :start => 1308595038,\n :object => \"subscription\",\n :trial_start => 1308595038,\n :trial_end => 1308681468,\n :customer => \"c_test_customer\",\n :id => 's_test_subscription'\n }.merge(params)\n end",
"def create_subscription_with_http_info(subscription_info, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionsApi.create_subscription ...\"\n end\n # verify the required parameter 'subscription_info' is set\n fail ArgumentError, \"Missing the required parameter 'subscription_info' when calling SubscriptionsApi.create_subscription\" if subscription_info.nil?\n # resource path\n local_var_path = \"/subscriptions\".sub('{format}','json')\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 = @api_client.object_to_http_body(subscription_info)\n auth_names = ['artikcloud_oauth']\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 => 'SubscriptionEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionsApi#create_subscription\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_subscription(subscription_info, opts = {})\n data, _status_code, _headers = create_subscription_with_http_info(subscription_info, opts)\n return data\n end",
"def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end",
"def create_subscription(options)\n stripe_service.create_subscription(options)\n end",
"def create_subscription(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions'\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 create_subscription(name, conninfo_hash, publications, options = {})\n options[:slot_name] = name if !options.key?(:slot_name) && !options.key?(\"slot_name\") && (options['create_slot'] == false || options[:create_slot] == false)\n\n connection_string = connection.escape_string(PG::Connection.parse_connect_args(conninfo_hash))\n base_command = <<-SQL\n CREATE SUBSCRIPTION #{connection.quote_ident(name)}\n CONNECTION '#{connection_string}'\n PUBLICATION #{safe_list(publications)}\n SQL\n typed_exec(command_builder.command_with_options(base_command, \"WITH\", options))\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end",
"def create_subscriptions\n Subscription.create_subscriptions(self.id, self.hashtag)\n end",
"def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end",
"def create_twitter_subscription(username,password,message = nil, events = {})\n Dropio::Resource.client.create_twitter_subscription(self,username,password,message,events)\n end",
"def subscribe(url, id = nil, opts = {}, &block)\n feed_id = \"#{id ? id : Base64.urlsafe_encode64(url)}\"\n if block\n @verifications[feed_id] ||= {}\n @verifications[feed_id]['subscribe'] = block\n end\n endpoint = opts[:hub] || SUPERFEEDR_ENDPOINT\n opts.delete(:hub)\n\n retrieve = opts[:retrieve] || false\n opts.delete(:retrieve)\n\n\n if endpoint == SUPERFEEDR_ENDPOINT\n opts[:userpwd] = \"#{@params[:login]}:#{@params[:password]}\"\n end\n\n\n opts = opts.merge({\n :params => {\n 'hub.mode' => 'subscribe',\n 'hub.topic' => url,\n 'hub.callback' => generate_callback(url, feed_id)\n },\n :headers => {\n :accept => @params[:format] == \"json\" ? \"application/json\" : \"application/atom+xml\"\n }\n })\n\n if retrieve\n opts[:params][:retrieve] = true\n end\n\n opts[:params][:'hub.verify'] = @params[:async] ? 'async' : 'sync'\n\n response = http_post(endpoint, opts)\n\n #@error = response.body\n\n # TODO Log error (response.body)\n if !retrieve\n @params[:async] && response.code == '202' || response.code == '204' # We return true to indicate the status.\n else\n\n if response.code == 200\n\n if @params[:format] != \"json\"\n content = Nokogiri.XML(response.body)\n else\n content = JSON.parse(response.body)\n end\n # Let's now send that data back to the user.\n if defined? Hashie::Mash\n info = Hashie::Mash.new(req: req, body: body)\n end\n if !@callback.call(content, feed_id, info)\n # We need to unsubscribe the user\n end\n true\n else\n puts \"Error #{response.code}. #{@error}\"\n false\n end\n end\n end",
"def new\n @subscription = Subscription.new\n end",
"def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end",
"def create_webhook_subscription(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/webhooks/subscriptions',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create\n megam_rest.post_subscriptions(to_hash)\n end",
"def subscription(name = nil, &block)\n Subscription.new(name, &block)\n end",
"def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end",
"def create\n if session[:user_id] \n user = User.find(session[:user_id])\n s = Subscription.new\n s.url = params[:subscription][:url]\n s.title = params[:subscription][:title]\n s.user = user\n @subscription = s\n \n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def subscription(topic_name, subscription_name)\n pubsub.subscription(subscription_name) ||\n create_subscription(topic_name, subscription_name)\n end",
"def retrieve_webhook_subscription(subscription_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/webhooks/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end",
"def create\n @subscription = @target.create_subscription(subscription_params)\n return_back_or_ajax\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def subscribe subscription_name, deadline: nil, endpoint: nil\n ensure_connection!\n options = { deadline: deadline, endpoint: endpoint }\n resp = connection.create_subscription name, subscription_name, options\n if resp.success?\n Subscription.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend",
"def create_pingback_subscription(url, events = {})\n Dropio::Resource.client.create_pingback_subscription(self,url,events)\n end",
"def retrieve_subscription(subscription_id:,\n include: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .query_param(new_parameter(include, key: 'include'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def subscription\n case attributes['subscription']\n when 'both' then :both\n when 'from' then :from\n when 'none' then :none\n when 'remove' then :remove\n when 'to' then :to\n else nil\n end\n end",
"def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end",
"def create_subscription(options)\n # Get the plan.\n plan = Stripe::Plan.retrieve(options[:plan])\n\n # Charge VAT in advance because subscription call will create and pay an invoice.\n # TK actually we need to apply VAT for invoiceitems that are pending and scheduled\n # for the next invoice.\n # Do not charge VAT if the plan or the subscription is still in trial (invoice will come later).\n vat, invoice_item = charge_vat_of_plan(plan) unless \\\n plan.trial_period_days || (options[:trial_end] && options[:trial_end] != 'now')\n\n # Start subscription.\n # This call automatically creates an invoice, always.\n subscription = customer.subscriptions.create(options)\n\n [subscription, last_invoice]\n rescue Stripe::StripeError, Stripe::CardError => e\n # Something failed in Stripe, if we already charged for VAT,\n # we need to rollback this. As we may charge twice later otherwise.\n invoice_item.delete if invoice_item\n raise e\n end",
"def subscribe(callback_url)\n @repository.callback_url = callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end",
"def subscription\n ret = nil\n if type == 'S'\n ret = @mc2p.subscription('id' => @json_body['id'])\n ret.retrieve\n end\n ret\n end",
"def create\n @subscription = Subscription.new(params[:subscription])\n @subscription.created_at = Time.new\n # always use current user\n @subscription.user_id = current_user.id\n @subscription.subscription_id = current_user.id.to_s\n respond_to do |format|\n if not current_user.fitbit.nil?\n if @subscription.save\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n api = JSON.parse(current_user.fitbit.client.post(path.join('/') + '.json').body)\n flash[:success] = 'Subscription was successfully created.' \n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n flash[:error] << @subscription.errors\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n\tend\n else\n flash[:error] = 'You are not connected to Fitbit.'\n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :unprocessable_entity }\n end\n end\n end",
"def subscription\n s = subscription_node[:subscription]\n s.to_sym if s\n end",
"def post(subscription_form)\n HttpClient::Preconditions.assert_class('subscription_form', subscription_form, Apidoc::Models::SubscriptionForm)\n @client.request(\"/subscriptions\").with_json(subscription_form.to_json).post { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def initialize( publish_key, subscribe_key, secret_key, cipher_key, ssl_on )\n @publish_key = publish_key\n @subscribe_key = subscribe_key\n @secret_key = secret_key\n @cipher_key = cipher_key\n @ssl = ssl_on\n @origin = 'pubsub.pubnub.com'\n\n if @ssl\n @origin = 'https://' + @origin\n else\n @origin = 'http://' + @origin\n end\n end",
"def subscribe(user_id, channel_id, unsubscribe = false)\n data = {\n user_id: user_id,\n channel_id: channel_id,\n unsubscribe: unsubscribe ? 1 : 0\n }\n\n response = rest_client.post(signature_url('/subscription/'), body: data)\n process_response(response)\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n\n if @subscription.save\n render json: @subscription, status: :created, location: @subscription\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_created) }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@subscription = Subscription.new(params[:subscription])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Subscription.find(params[:object_orig_id])\n\t\t\tst = @subscription.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @subscription.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\t#format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n\t\t\t\tflash[:notice] = 'Subscription was successfully created.'\n\t\t\t\tparams[:id]= @subscription.id\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def get_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionApi.get_subscriptions ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/subscription\"\n\n # query parameters\n 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[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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 = ['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 => 'SubscriptionSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionApi#get_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_subscription(options)\n # This call automatically creates an invoice, always.\n Stripe::Subscription.create({\n customer: customer.id,\n tax_percent: calculate_vat_rate\n }.merge(options))\n end",
"def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end",
"def create\n @me = Me.find_by_subscribe_token(params[:subscription][:subscription_token])\n if @me.validate_auth(User.find(session['user_id']).login, params[:auth])\n @subscription = Subscription.new(params[:subscription])\n @subscription.collapsed = false\n @subscription.me = @me\n @subscription.pos_x = 0;\n @subscription.pos_y = Subscription.find_last_y_pos(session['user_id']) + 1;\n \n respond_to do |format|\n if @subscription.save\n flash[:notice] = 'Subscription was successfully created.'\n format.html { redirect_to(subscriptions_path) }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:notice] = 'You are not authorized to subscribe to this Me'\n respond_to do |format|\n format.html { redirect_to(subscriptions_path) }\n format.xml { render :xml => \"invalid auth\", :status => :unprocessable_entity }\n end\n end\n end",
"def initialize(configuration, options = {})\n super(configuration, 'subscriptions', 'Microsoft.Resources', options)\n end",
"def subscribed_skus()\n return MicrosoftGraph::SubscribedSkus::SubscribedSkusRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def build_create_subscription_request(xml, options)\n # Subscription\n add_subscription(xml, options)\n\n xml.target!\n end",
"def subscription\n attributes[:subscription].to_sym if attributes[:subscription]\n end",
"def create_stripe_subscription!\n Stripe::Subscription.create(\n customer: create_stripe_customer!,\n tax_percent: Price::DEFAULT_TAX_RATE,\n trial_from_plan: store.eligible_for_trial_subscription?,\n items: [\n {plan: stripe_plan_id},\n ],\n metadata: {store: store.name}\n )\n end",
"def create_if_necessary!\n if topic.blank?\n @topic = pubsub.create_topic(topic_name).tap do |topic|\n raise error, \"Unable to create topic #{topic_name}\" if topic.nil?\n end\n end\n\n @subscription = @topic.find_subscription(subscription_name) || @topic.create_subscription(subscription_name)\n @subscription.tap do |subscription|\n raise Error, \"Unable to create subscription #{subscription_name}\" if subscription.nil?\n\n # Default subscription expiry is 31 days. We want none of that.\n subscription.expires_in = nil unless pubsub.project_id == EMULATOR.fetch(:project_id)\n end\n end",
"def generate_subscription_payload(amount, category, desc, merch_trans_id, \n merch_prod_id, merch_sub_id, \n sub_recurrances, redirect_uri, opts={})\n sub_period_amount = (opts[:sub_period_amount] || 1) \n sub_period = (opts[:sub_period] || 'MONTHLY')\n is_purchase_on_no_active_sub = (opts[:iponas] || false)\n channel = (opts[:channel] || \"MOBILE_WEB\")\n\n payload = {\n :Amount => amount,\n :Category => category,\n :Description => desc,\n :MerchantTransactionId => merch_trans_id,\n :MerchantProductId => merch_prod_id,\n :MerchantSubscriptionIdList => merch_sub_id,\n :SubscriptionRecurrences => sub_recurrances,\n :MerchantPaymentRedirectUrl => redirect_uri,\n :SubscriptionPeriodAmount => sub_period_amount,\n :SubscriptionPeriod => sub_period,\n :IsPurchaseOnNoActiveSubscription => is_purchase_on_no_active_sub,\n :Channel => channel,\n }.to_json\nend",
"def new\n @subscriber = Subscriber.new\n end",
"def pubsub_adapter; end",
"def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end",
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def create(params)\n params[:tag] ||= '*'\n post(\"#{domain}/unsubscribes\", params)\n end",
"def subscribe(magazine, price)\n Subscription.create(price: price, magazine_id: magazine.id, reader_id: self.id)\n end",
"def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end",
"def subscribe(subject, opts={}, &callback)\n sid = nil\n sub = nil\n synchronize do\n sid = (@ssid += 1)\n sub = @subs[sid] = Subscription.new\n end\n sub.subject = subject\n sub.callback = callback\n sub.received = 0\n sub.queue = opts[:queue] if opts[:queue]\n sub.max = opts[:max] if opts[:max]\n\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n @flush_queue << :sub\n\n # Setup server support for auto-unsubscribe when receiving enough messages\n unsubscribe(sid, opts[:max]) if opts[:max]\n\n sid\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\"\n return false\n end\n\n ## Begin Subscribe\n loop do\n begin\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Wait for Message\n response = _request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n ## If it was a timeout\n next if !messages.length\n\n ## Run user Callback and Reconnect if user permits.\n ## Capture the message and encrypt it\n if @cipher_key.length > 0\n pc = PubnubCrypto.new(@cipher_key)\n messages.each do |message|\n if message.is_a? Array\n message=pc.decryptArray(message)\n else\n message=pc.decryptObject(message)\n end\n if !callback.call(message)\n return\n end\n end\n else\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n end\n rescue Timeout::Error\n rescue\n sleep(1)\n end\n end\n end",
"def create\n # params[:id] is the knowmadics id\n\n @api_subscription = Api::Subscription.new(api_subscription_params)\n\n respond_to do |format|\n if @api_subscription.save\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @api_subscription }\n else\n format.html { render :new }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end",
"def subscription\n ensure_connection\n @consumers.find(&:subscription)\n end",
"def subscribe!\n # TODO: Implement\n end",
"def create_outbound_subscription(sender_address, options)\n Response.new self.class.post(\"/smsmessaging/outbound/#{sender_address}/subscriptions\", \n :basic_auth => @auth,\n :body => build_query_string(options),\n :headers => SMSIFIED_HTTP_HEADERS\n )\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscribe_to_topic(topic_arn, protocol, end_point)\n # TODO handle different SubscriptionArn results? Let's\n # just return the raw subscription arn for now\n req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => end_point)\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger))\n end",
"def to_json\n obj = {}\n obj[:events] = Array(self.events) unless self.events.nil?\n obj[:callbackData] = self.callback_data unless self.callback_data.nil?\n obj[:expiresIn] = self.expires_in.to_i unless self.expires_in.nil?\n obj[:subscriptionId] = self.subscription_id unless self.subscription_id.nil?\n { :subscription => obj }.to_json\n end",
"def subscribe_url\n nil\n end",
"def subscription_node\n unless subscription = pubsub.find_first('ns:subscription', :ns => self.class.registered_ns)\n self.pubsub << (subscription = XMPPNode.new('subscription', self.document))\n subscription.namespace = self.pubsub.namespace\n end\n subscription\n end",
"def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to root_url, notice: 'Subscription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subscription }\n else\n format.html { render action: 'new' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type (GOLD, Silver, etc.)\n # 3) Discount Coupom (if applicable)\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully created.'\n else\n @verrors = @subscription.errors.full_messages\n render 'new'\n end\n end",
"def create / update_subscriptions\n end",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end",
"def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end",
"def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end",
"def subscribe(args = {})\n :no_response\n end",
"def create\n # TODO:\n # * guard based on \"state\" param:\n # if `session['omniauth.state]`, `params[:state]` must match.\n\n authorization = Corkboard::Authorization.create!(auth_attrs)\n subscription = Corkboard::Subscription.create!(provider, authorization)\n\n Corkboard.publish!(subscription.backlog)\n redirect_to(authorizations_path)\n end",
"def create_subscription_file\n subscriptions_folder = Rails.root + 'app/subscriptions'\n empty_directory subscriptions_folder\n template 'subscription.rb', subscriptions_folder + \"#{file_name}_subscription.rb\"\n end",
"def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def create\n @subscribe = Subscribe.new(subscribe_params)\n\n respond_to do |format|\n if @subscribe.save\n format.html {redirect_to @subscribe, notice: 'Subscribe was successfully created.'}\n format.json {render json: @subscribe, status: :created}\n else\n format.html {render :new}\n format.json {render json: @subscribe.errors, status: :unprocessable_entity}\n end\n end\n end",
"def show_single_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end"
] | [
"0.71474326",
"0.7015759",
"0.6841458",
"0.6808718",
"0.68000674",
"0.66442037",
"0.6558682",
"0.6536384",
"0.6490218",
"0.6484767",
"0.6459495",
"0.64432055",
"0.6420155",
"0.6410965",
"0.6402001",
"0.6390077",
"0.63772875",
"0.6364183",
"0.63636607",
"0.63478684",
"0.6299608",
"0.6299452",
"0.6266426",
"0.62612957",
"0.6254035",
"0.623883",
"0.6219943",
"0.6207508",
"0.6200919",
"0.6141729",
"0.61344427",
"0.6130899",
"0.61177117",
"0.6102602",
"0.61021405",
"0.6088423",
"0.6069896",
"0.6049702",
"0.60165685",
"0.60087913",
"0.59909576",
"0.5983675",
"0.59745854",
"0.5955565",
"0.5947608",
"0.5919527",
"0.5915243",
"0.59088254",
"0.5888791",
"0.5887528",
"0.58785117",
"0.5868427",
"0.5864154",
"0.58442944",
"0.58285195",
"0.5823592",
"0.5810568",
"0.5800525",
"0.5789925",
"0.5789192",
"0.57889575",
"0.5780133",
"0.57657295",
"0.5762729",
"0.57594675",
"0.57560843",
"0.5753867",
"0.57521105",
"0.57477474",
"0.5747495",
"0.574484",
"0.5741464",
"0.5736835",
"0.5736013",
"0.5730116",
"0.572445",
"0.57189554",
"0.56999284",
"0.5695628",
"0.56941843",
"0.5687062",
"0.5687045",
"0.56867266",
"0.5685343",
"0.56839997",
"0.5681983",
"0.5680419",
"0.56749016",
"0.5666428",
"0.56631696",
"0.5650815",
"0.5650809",
"0.5650154",
"0.5637191",
"0.5634998",
"0.5629233",
"0.56277204",
"0.5616082",
"0.56125855",
"0.5606327"
] | 0.5949587 | 44 |
Actively searches for hubs by talking to publisher directly | def discover_hubs_for_topic
@hubs = Nelumba.feed_from_url(self.topic_url).hubs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end",
"def subscribe_to_channel; end",
"def hub\n @@message_hub\n end",
"def broadcast_presence\n services = CouchModels::Service.find_all\n users = services.map {|service| service.users }.flatten.uniq\n nodes = users.map {|jid| available(@stream.jid, jid) }\n nodes << services.map do |service|\n service.users.map {|jid| available(service.jid, jid) }\n end\n nodes.flatten!\n @throttle.async_send(nodes)\n end",
"def hubs\n link('hub').map { |link| link.href }\n end",
"def publish_for search, data\n each_channels_of search do |channel|\n channel.transmit format(data)\n rescue Errno::ECONNREFUSED, Net::OpenTimeout, SocketError => e\n Rails.logger.info \"Establishing TCP connection to #{channel} failed. Error: #{e.inspect}\"\n end\n end",
"def setup\n # return if client && client.setup?\n client.register_handler(:ready) do\n puts \"Connected!\"\n ROSTER << [client.roster.items.keys, Opt.groups].flatten.uniq\n ROSTER.flatten!\n ROSTER.select { |j| j =~ /\\@conference\\./ }.each do |c|\n presence = Blather::Stanza::Presence.new\n presence.to = \"#{c}/#{Opt.hostname}\"\n client.write presence\n end\n\n fetch_pubs\n end\n\n client.register_handler :subscription, :request? do |s|\n if ROSTER.include?(s.from.stripped.to_s)\n puts \"[REQUEST] Approve #{s}\"\n client.write s.approve!\n else\n puts \"[REQUEST] Refuse #{s}\"\n client.write s.refuse!\n end\n end\n\n # client.register_handler :message, :chat?, :body => 'exit' do |m|\n # client.write Blather::Stanza::Message.new(m.from, 'Exiting...')\n # client.close\n # end\n #client.register_handler :roster, [],\n #client.register_handler :message, :error?, :body do |m|\n #client.register_handler :message, :headline?, :body do |m|\n #client.register_handler :message, :normal?, :body do |m|\n client.register_handler :pubsub_affiliations, :affiliations do |m|\n puts \"[PUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[PUB ITEM] => #{af.inspect}\"\n PUBSUB[:pubs] = af[1].map { |p| p.gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_subscriptions, :subscriptions do |m|\n puts \"[SUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[SUB ITEM] => #{af.inspect}\"\n PUBSUB[:subs] = af[1].map { |p| p[:node].gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_event, :items do |m|\n puts \"[PUBSUB EV] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :pubsub_items, :items do |m|\n puts \"[PUBSUB ITEMS] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :disco_items do |r|\n puts \"[ITEM] => #{r}\"\n # Pub.delete_all\n # PubItem.delete_all\n for item in r.items\n puts \"[IT] => #{item.name} on #{item.node.class}\"\n # next if item.name =~ /^home$/\n if item.node =~ /\\//\n puts \"[PUBSUB] => #{item.name} on #{item.node}\"\n alert_peers item.name\n else\n if item.jid.to_s =~ /conference\\./\n puts \"[GROUP] => #{item.name} on #{item.node}\"\n else\n puts \"[USER] => #{item.jid} name #{item.name}\"\n end\n end\n end\n end\n\n client.register_handler :message, :groupchat? do |m|\n if m.body =~ Regexp.new(Opt.hostname)\n body = m.body.split(\":\")[-1].strip\n else\n body = m.body\n end\n if m.body =~ /^!|^>|^\\\\|#{Opt.hostname}/ && m.to_s !~ /x.*:delay/ #delay.nil?\n puts \"[GROUP] => #{m.inspect}\"\n for msg in process_message(m.from.stripped, body, :groupchat)\n client.write msg\n end\n end\n end\n\n client.register_handler :message, :chat?, :body do |m|\n if ROSTER.include?(m.from.stripped.to_s)\n puts \"[PVT] => #{m.inspect}\"\n for msg in process_message(m.from, m.body)\n client.write msg\n end\n end\n end\n\n end",
"def devices\n @socket.send(search_message, 0, MULTICAST_ADDR, MULTICAST_PORT)\n listen_for_responses(first)\n end",
"def subscribed\n stream_from channel_name\n end",
"def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end",
"def subscribed; end",
"def search(*targets)\n @socket ||= new_socket\n\n if targets.empty? then\n send_search 'ssdp:all'\n else\n targets.each do |target|\n if target == :root then\n send_search 'upnp:rootdevice'\n elsif Array === target and target.first == :device then\n target = [DEVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif Array === target and target.first == :service then\n target = [SERVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif String === target and target =~ /\\A(urn|uuid|ssdp):/ then\n send_search target\n end\n end\n end\n\n listen\n sleep @timeout\n\n responses = []\n responses << @queue.pop until @queue.empty?\n responses\n ensure\n stop_listening\n @socket.close if @socket and not @socket.closed?\n @socket = nil\n end",
"def pubsub; end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def search\n redishelper = RedisHandlerQueue.new\n #Push handler in redis\n @errors = []\n args = {:name => params[:name],\n :access_token => session[:access_token],\n :refresh_token=> session[:refresh_token],\n :project_id => params[:project_id],\n :task_list_id => params[:task_list_id],\n :handler => params[:hashtag],}\n\n if redishelper.enqueu_handler (args)\n Workers::FindTweets.perform_async\n else\n @errors << \"Something was wrong trying to enqueu handler in Redis\"\n end\n redirect_to action: :index\n end",
"def find(query)\n results = client.search(query)\n results.map{|result| RubyHub::Repository.new(client.mapping(result))}\n end",
"def subscribe!\n # TODO: Implement\n end",
"def search(params = {})\n @client.call(method: :get, path: 'message-events', query_values: params)\n end",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def subscribers\n AdminNotifier.subscribers(Subscriber.first)\n end",
"def subscribed?; owners.any? { |peer| peer.subscribed?(self) if peer != Distributed } end",
"def search\n user = User.qa_app_user\n text = URI.decode(params[:search])\n @chatouts = Qa.search_feed(user, Qa::GROUP_ID , text)\n end",
"def subscribers\n Hey::Subscriber.new api_token: api_token\n end",
"def discover\n @discovery.send_discovery_message\n end",
"def search_channel\n channel = Channel.where(name: params[:name])\n channel.empty? ? Channel.all : channel\n end",
"def wait_for_any_input\n Bot.on :message do |message|\n puts \"Received '#{message.inspect}' from #{message.sender}\"\n sender_id = message.sender['id']\n show_humour_replies(sender_id, HUMOUR)\n end\nend",
"def pubsub_adapter; end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def get_main_hub\n @main_hub\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\n end",
"def all_subservices_registered_to(params)\n match_node_keys(provider_node(params), params)\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def subscribe\n\t if !self_owned? && !subscribed?\n\t\towners.each do |peer|\n\t\t peer.subscribe(self) unless peer.subcribed?(self)\n\t\tend\n\t end\n\tend",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def search\n send_request\n parse_response\n end",
"def subscribed_people(logs)\n people = people_subscribed_to_logged_items logs\n people.select(&:receive_notifications?)\n end",
"def handle_monitor request, *channels\n channels.map(&:to_sym).each do |channel|\n @node.subscribe(channel) {|*data| respond(request, [channel, *data]) }\n name, *params = channel.to_s.split(\"_\")\n send(\"handle_monitor_#{name}\", request, *params)\n log.info { \"Client subscribed to channel #{channel}\" }\n end\n nil\n end",
"def subscribers(domain, node)\n @cluster.query(:smembers, \"pubsub:#{domain}:subscribers_#{node}\")\n end",
"def list_subscribed(&block)\n @driver.list_subscribed(&block)\n end",
"def poll_registrations\n log(\"Polling registrations\")\n em_redis.blpop('twitterpush:new', 0).callback do |list, new_id|\n if twitter_id = twitter_store.get_twitter_id(new_id)\n streamer.add_user(twitter_id)\n end\n EventMachine.next_tick {\n poll_registrations\n }\n end\n end",
"def subscribe(*channels, &block); end",
"def subscribe\n \nend",
"def search_terms\n return self.broadcast_list\n end",
"def set_hub\n @hub = Hub.find(params[:id])\n end",
"def discover_ironfan!\n self.servers\n end",
"def polling\n while true do\n publish\n end\n end",
"def search\n find_clients\n render_clients\n end",
"def listen\n # TODO\n self\n end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def hub\n @parent ? @parent.hub : self\n end",
"def subscribe(channel, *channels, &block); end",
"def discover\n @myself.send_broadcast Net::Packet.helo\n end",
"def publisher\n end",
"def haystack\n ENV['HUBBLE_ENDPOINT'] || config['haystack']\n end",
"def index\n @mobs = Mob.all\n\n Mob.first.send_push_notification\n end",
"def public_channel(ns)\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n get_client(ns).public_channel\n end",
"def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end",
"def search params = {}\n send_and_receive search_path(params), params.reverse_merge(qt: blacklight_config.qt)\n end",
"def incoming(opts={})\n # Constrain results to this pool\n fq = \"format:Node\"\n # fq += \" AND pool:#{pool.id}\"\n http_response = Bindery.solr.select(params: {q:persistent_id, qf:\"bindery__associations_sim\", qt:'search', fq:fq})\n results = http_response[\"response\"][\"docs\"].map{|d| Node.find_by_persistent_id(d['id'])}\n end",
"def perform\n @logger.info({context: :monitor, action: :perfomed})\n @client.psubscribe(\"#{service}:*\") do |callback|\n callback.psubscribe(self.on_subscribed)\n callback.pmessage(self.on_message)\n callback.punsubscribe(self.on_unsubscribed)\n end\n end",
"def buses\n @buses = Bus.search(params[:source_search], params[:destination_search])\n end",
"def on_query_handles(instance, reply)\n @logger.debug(\"[#{service_description}] Receive query handles request for instance: #{instance}\")\n if instance.empty?\n res = Yajl::Encoder.encode(@prov_svcs)\n else\n handles = find_all_bindings(msg)\n res = Yajl::Encoder.encode(handles)\n end\n @node_nats.publish(reply, res)\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def subscribed_channels\n @channels\n end",
"def publish_discover\n @logger.trace \"publishing discover request\"\n publish(:discover)\n end",
"def get_subscribers who_uuid\n who_uuid = who_uuid.uuid if who_uuid.is_a?(Group)\n @groups.find_all{|group|group.member_uuids.find{|uuid|uuid == who_uuid}}\n end",
"def IsSubscribed=(arg0)",
"def IsSubscribed=(arg0)",
"def find_all(name)\n if name and not name.empty?\n proxy_owner.send(:list_queues, \"QueueNamePrefix\" => name)\n else\n proxy_target\n end\n end",
"def publishers\n respond_to?(:publisher) ? topic : []\n end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def list_subs\n \t@subs = instagram_client.subscriptions\n end",
"def subscribe\n self.subscribed = true\n end",
"def connected(client)\n\t\tclient.listen('WHEREAMI?', self)\n\t\tclient.listen('NEARBY?', self)\n\t\tclient.listen('DISTANT?', self)\n\t\tclient.listen('IMOVED', self)\n\t\tclient.listen('NEARBYENT?', self)\n\tend",
"def get_subscriptions\n get_subscriptions_from(@nodename)\n end",
"def monitor_redis\n # redis.dup.subscribe(REDIS_CHANNEL) do |on|\n redis.subscribe(REDIS_CHANNEL) do |on|\n on.message do |_, message|\n l = REDIS_HEAD_FIELD_LENGTH\n channel = message[0, l].strip\n client_id = message[l, l].strip\n json = message[(l * 2)..-1]\n send_json_message(client_id: client_id, channel: channel, json: json)\n end\n end\n end",
"def wait_all_sent\n verify_not_closed\n @clients.each do |pub|\n pub.wait_all_sent\n end\n end",
"def find(channel_name = nil, stream_name = nil)\n @mutex.synchronize do\n return subscribers.values.map(&:values).flatten if channel_name.nil?\n return subscribers[channel_name].values.flatten if stream_name.nil?\n subscribers[channel_name][stream_name]\n end\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def subscribed\n id = params.fetch(:id)\n return unless execution = JobQueue.find_by_id(id)\n\n execution.viewers.push current_user\n\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n builder = EventBuilder.new(execution.job)\n execution.output.each do |event, data|\n transmit event: event, data: builder.payload(event, data)\n end\n # TODO: disconnect all listeners so they close their sockets ?\n # then replace the reloaded/finished/waitUntilEnabled stuff with that\n end\n end\n end",
"def post_init\n if send_datagram(@search, MULTICAST_IP, MULTICAST_PORT) > 0\n logger.info(\"Sent datagram search:\\n#{@search}\")\n end\n end",
"def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end",
"def broadcasters\n find_related_frbr_objects( :is_broadcast_by, :which_roles?) \n end",
"def stream(event)\nexp = [\"#bonjour_monde\"]\n client.event(track: exp.join(\",\")) do |object|\n stream(var_like, var_follow)\n end\nend",
"def perform\n self.subscriptions.each do |blog| \n begin\n blog.find_twitterers\n rescue Exception => whoops\n puts \"Error on blog #{blog.title}: \" + whoops\n end\n end\n # +++ sub name of host.\n # +++ page will have to deal with unauthenticated user.\n puts \"Sending direct message to #{tname}\"\n twitter_direct_message(\"Your blogs have been processed: http://twitlines.net/blogs\")\n end",
"def loop( &block )\n block ||= proc do \n channels = @channel_map.reject {|k,v| v.type == 'auth-agent@openssh.com' }\n not channels.empty?\n end\n process while block.call\n end",
"def subscriptions\n @channels\n end",
"def publishers\n @plugins.find_all { |p| p.is_a? BasePublish }\n end",
"def index\n @slack_channels = SlackChannel.search_and_paginate(params)\n end",
"def index\n @subscribers = [] # Subscriber.all\n end",
"def broadcast_search(options)\n request('/broadcastSearch', {body: {query: options[0], search: options[1], include_replay: options[2]}})\n end",
"def index\n @subscribers = Subscriber.all\n end",
"def subscriber_names\n @client.smembers @name\n end",
"def send_known_presence(to)\n stanzas = stream.available_resources(stream.user.jid).map do |stream|\n stream.last_broadcast_presence.clone.tap do |node|\n node['from'] = stream.user.jid.to_s\n node['id'] = Kit.uuid\n end\n end\n broadcast_to_available_resources(stanzas, to)\n end"
] | [
"0.6113972",
"0.59600884",
"0.5850336",
"0.5739712",
"0.573358",
"0.57098144",
"0.5695787",
"0.5596962",
"0.55593485",
"0.5538158",
"0.55335677",
"0.55157214",
"0.5513801",
"0.55004513",
"0.54968965",
"0.54825956",
"0.54433197",
"0.5424751",
"0.5365758",
"0.53638005",
"0.53482115",
"0.5332046",
"0.531847",
"0.5313082",
"0.5312872",
"0.53096974",
"0.53087753",
"0.5305777",
"0.5273061",
"0.52712405",
"0.52712405",
"0.52712405",
"0.52601606",
"0.5248955",
"0.52441275",
"0.5228722",
"0.52224827",
"0.52121973",
"0.52037144",
"0.5201421",
"0.5201314",
"0.51840836",
"0.51827836",
"0.5177934",
"0.5168054",
"0.5167158",
"0.51524514",
"0.5146333",
"0.5145057",
"0.5131621",
"0.51294976",
"0.51170063",
"0.51073384",
"0.51043755",
"0.50748086",
"0.507224",
"0.5068568",
"0.5067297",
"0.50577235",
"0.5055909",
"0.50511235",
"0.50506586",
"0.5033712",
"0.5031517",
"0.5023422",
"0.5022682",
"0.50220454",
"0.5018004",
"0.5013944",
"0.5012058",
"0.5007288",
"0.49953446",
"0.49953446",
"0.49828592",
"0.49695653",
"0.4958239",
"0.49577564",
"0.4954441",
"0.49515712",
"0.4941663",
"0.4939452",
"0.49392277",
"0.49313894",
"0.49284154",
"0.49221486",
"0.49208206",
"0.49183512",
"0.49124599",
"0.49093893",
"0.4908721",
"0.49042836",
"0.4901791",
"0.48981035",
"0.4897891",
"0.4888646",
"0.4886051",
"0.48845166",
"0.4883862",
"0.48802575",
"0.48795122"
] | 0.70203334 | 0 |
Subscribe to the topic through the given hub. | def subscribe
return unless self.hub.nil?
# Discover hubs if none exist
@hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?
@hub = self.hubs.first
change_subscription(:subscribe, token)
# TODO: Check response, if failed, try a different hub
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end",
"def subscribe_to_topic(topic, device)\n raise NotImplementedError.new\n end",
"def subscribe(public_ip, public_port = 80)\n fetch if @hub_url.nil?\n hub = PubSubHubbub.new(@hub_url, public_ip, public_port)\n hub.subscribe(self)\n hub.client_thread.join\n end",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def subscribe(*topics)\n # Defer subscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Subscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def subscribe(subscription)\n @pipe.send_strings [\"subscribe\", subscription]\n end",
"def subscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.subscribe(*topics)\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def subscribe(channel, &block)\n faye.subscribe \"/topic/#{channel}\", &block\n end",
"def subscribe_to_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchAdd\")\n end",
"def subscribe_to_channel; end",
"def subscribe(node, host, &block)\n pubsub.subscribe(node, nil, host, &callback_logging(__method__, node, &block))\n end",
"def subscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')\n connection.send_stanza pres, &blk\n end",
"def handle_subscribe(client, data)\n topic = @engine.subscribe_client_to_topic client, data[0]\n\n trigger(:subscribe, client, topic.uri)\n end",
"def subscribe(subscribable, subscription_level = Subscription::Levels[:reader])\n subscribable.subscribe(self, subscription_level)\n end",
"def subscribe_to_topic(topic_arn, protocol, end_point)\n # TODO handle different SubscriptionArn results? Let's\n # just return the raw subscription arn for now\n req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => end_point)\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger))\n end",
"def subscribe\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def subscribe!\n # TODO: Implement\n end",
"def subscribe\n @broker.subscribe(*self.class.subscriptions) do |channel, data|\n begin\n perform(channel, data)\n rescue => e\n puts \"Exception #{e}\"\n end\n end\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def auto_subscribe_topic\n fail NotImplementedError, 'To be implemented by the concrete topic posts controller.'\n end",
"def subscribe(prefix)\n setsockopt :subscribe, prefix\n end",
"def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end",
"def subscribe( channel, &callback )\n fail NotImplementedError\n end",
"def subscribe_to(channel, &block)\n subscriptions[channel].subscribe(&block)\n end",
"def subscribe(*channels, &block)\n _subscription(:subscribe, 0, channels, block)\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def subscribe(subreddit)\n full_name = extract_full_name subreddit\n parameters = { :action => 'sub', :sr => full_name }\n\n post('api/subscribe', parameters)\n end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def subscribe(channel, *channels, &block); end",
"def subscribe(event, *args, &block)\n event(event).subscribe(*args, &block)\n end",
"def subscribe(callback_url)\n @repository.callback_url = callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def subscribe(&b)\n @publisher.subscribe(&b)\n end",
"def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end",
"def subscribe_pubsub(domain, node, jid)\n @pubsub.subscribe(domain, node, jid)\n end",
"def subscribed(subscribable, subscription_level = nil)\n subscribable.subscription_to(self, subscription_level)\n end",
"def subscribe(&callback)\n redis.subscribe(channel) do |on|\n on.message do |channel, payload|\n data = JSON.parse(payload) rescue payload\n callback.call channel, data, self\n end\n end\n end",
"def subscribe(domain, node, jid)\n jid = JID.new(jid)\n redis.multi\n redis.sadd(\"pubsub:#{domain}:subscribers_#{node}\", jid.to_s)\n redis.sadd(\"pubsub:#{domain}:subscriptions_#{jid}\", node)\n redis.exec\n end",
"def subscribe(node, jid = nil, host = nil)\n jid ||= client.jid.stripped\n stanza = Stanza::PubSub::Subscribe.new(:set, send_to(host), node, jid)\n request(stanza) { |n| yield n if block_given? }\n end",
"def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end",
"def subscribe_and_monitor(topic_id, context_obj = nil, &block)\n topic = OmfCommon::Comm::Topic[topic_id]\n if topic.nil?\n OmfCommon.comm.subscribe(topic_id, routing_key: \"o.info\") do |topic|\n if topic.error?\n error \"Failed to subscribe #{topic_id}\"\n else\n debug \"Subscribed to #{topic_id}\"\n context_obj.associate_topic(topic) if context_obj\n block.call(context_obj || topic) if block\n register_default_callback(topic)\n end\n end\n else\n context_obj.associate_topic(topic) if context_obj\n block.call(context_obj || topic) if block\n end\n end",
"def subscribe(subscriber)\n handler.subscribe(self, subscriber)\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def publish(topic, payload, retain=false, qos=0)\n # Defer publishing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Publish.new(\n :qos => qos,\n :retain => retain,\n :topic => topic,\n :payload => payload,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscribe(*channels, &block); end",
"def publish(topic, payload, retain=false, qos=0)\n # FIXME: make sure @connection isn't nil\n @connection.publish(topic, payload, retain, qos=0)\n end",
"def subscribe(subject, opts={}, &callback)\n return unless subject and not draining?\n sid = (@ssid += 1)\n sub = @subs[sid] = { :subject => subject, :callback => callback, :received => 0 }\n sub[:queue] = opts[:queue] if opts[:queue]\n sub[:max] = opts[:max] if opts[:max]\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n # Setup server support for auto-unsubscribe\n unsubscribe(sid, opts[:max]) if opts[:max]\n sid\n end",
"def subscribe\n \nend",
"def publish(topic, *args, **kwargs)\n raise 'The topic can not be nil' unless url != nil\n\n params = {\n topic: topic,\n args: args,\n kwargs: kwargs\n }\n\n self._make_api_call(params)\n end",
"def discover_hubs_for_topic\n @hubs = Nelumba.feed_from_url(self.topic_url).hubs\n end",
"def subscribe(subscription)\n raise \"subscribe is only valid on ZMQ::SUB sockets\" unless @socktype == ZMQ::SUB\n @data_socket.setsockopt ZMQ::SUBSCRIBE, subscription\n end",
"def subscribe(subscription)\n raise \"subscribe is only valid on ZMQ::SUB sockets\" unless @socktype == ZMQ::SUB\n @data_socket.setsockopt ZMQ::SUBSCRIBE, subscription\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\"\n return false\n end\n\n ## Begin Subscribe\n loop do\n begin\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Wait for Message\n response = _request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n ## If it was a timeout\n next if !messages.length\n\n ## Run user Callback and Reconnect if user permits.\n ## Capture the message and encrypt it\n if @cipher_key.length > 0\n pc = PubnubCrypto.new(@cipher_key)\n messages.each do |message|\n if message.is_a? Array\n message=pc.decryptArray(message)\n else\n message=pc.decryptObject(message)\n end\n if !callback.call(message)\n return\n end\n end\n else\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n end\n rescue Timeout::Error\n rescue\n sleep(1)\n end\n end\n end",
"def subscribe(name, params, &blk)\n id = self.next_id()\n self.send({msg: 'sub', id: id, name: name, params: params})\n\n @subs[name] = id\n @callbacks[id] = blk\n end",
"def subscribe(subject, opts={}, &callback)\n sid = nil\n sub = nil\n synchronize do\n sid = (@ssid += 1)\n sub = @subs[sid] = Subscription.new\n end\n sub.subject = subject\n sub.callback = callback\n sub.received = 0\n sub.queue = opts[:queue] if opts[:queue]\n sub.max = opts[:max] if opts[:max]\n\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n @flush_queue << :sub\n\n # Setup server support for auto-unsubscribe when receiving enough messages\n unsubscribe(sid, opts[:max]) if opts[:max]\n\n sid\n end",
"def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end",
"def subscribed\n stream_from channel_name\n end",
"def subscribe(mailbox)\n tagged_response(\"SUBSCRIBE\", to_utf7(mailbox))\n end",
"def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end",
"def subscribe(channel, aggregator, token)\n if authorized(channel, token, 'sub')\n logger.debug \"client #{@id} subscribed to: #{channel}\"\n unless channel.empty? || @channels.has_key?(channel)\n @sub.subscribe(namespace + channel)\n @channels[channel] = Aggregator.new(aggregator) # will be pass-through if blank\n end\n end\n end",
"def subscribe_to_label(project, name)\n post(\"/projects/#{url_encode project}/labels/#{url_encode name}/subscribe\")\n end",
"def subscribe(channel, data = {})\n log_to_file(\"#{self.class} tries to subscribe to channel #{channel} with #{data.inspect}\")\n send_action('subscribe', channel, data)\n end",
"def subscribe(channel, connection)\n sid = Channel[app_id => channel].subscribe {|msg| connection.send(msg) }\n subscriptions[channel => connection.signature] = sid\n sid\n end",
"def subscribe(channel)\n @env.trace 'subscribing'\n @subscription_id = @application.subscribe(self, channel) do |msg|\n @queue.push msg\n end\n @subscription_id\n end",
"def subscribe(prefix = EVERYTHING)\n ffi_delegate.set_subscribe(prefix)\n end",
"def subscribe_to_issue(project, id)\n post(\"/projects/#{url_encode project}/issues/#{id}/subscribe\")\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def subscribe(args = {})\n :no_response\n end",
"def pubsub(subcommand, *args)\n send_command([:pubsub, subcommand] + args)\n end",
"def subscribe(client_id, channel, &callback)\n super\n publish_awaiting_messages(channel)\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n @connection.subscribe(source)\n @subscriptions << source\n end\n end",
"def subscribe( channel, callback )\n if @channels.include?(channel)\n @channels[channel] << callback\n else\n @channels[channel]=[callback]\n @client.subscribe channel\n end\n end",
"def subscribe(user_id, channel_id, unsubscribe = false)\n data = {\n user_id: user_id,\n channel_id: channel_id,\n unsubscribe: unsubscribe ? 1 : 0\n }\n\n response = rest_client.post(signature_url('/subscription/'), body: data)\n process_response(response)\n end",
"def subscription(topic_name, subscription_name)\n pubsub.subscription(subscription_name) ||\n create_subscription(topic_name, subscription_name)\n end",
"def topic(chan, topic)\n sep = $config['plugins/topic/separator', '|']\n chan.server.cmd('TOPIC', chan.name, topic.join(\" #{sep} \"))\n end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def subscribe(aSubscriber)\n subscribers << aSubscriber\n end",
"def authenticate_subscribe(message)\n subscription = PrivatePub.subscription(:channel => message[\"subscription\"], :timestamp => message[\"ext\"][\"private_pub_timestamp\"])\n end",
"def subscribe(subscription)\n queue = connection.queue \"#{subscription.consumer.id}@#{subscription.channel}\",\n :auto_delete => true,\n :arguments => {'x-expires' => Push.config.amqp.queue_ttl * 1000}\n fanout = connection.exchange(subscription.channel, :auto_delete => true, :type => :fanout)\n queue.bind(fanout)\n\n # Cleanup is handled automatically for us by the timeout that we set on the \n # client connection queue. There's also no channel clean-up since we're not \n # running this inside of a concurrent run-time environment.\n\n # Try popping a message off the queue, deal with Bunny idiosyncracies, and \n # pass the message into the subscription object for further processing.\n subscription.process_message(self.class.process_message(queue.pop))\n end",
"def subscribe\n # PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", \"http://li182-172.members.linode.com/feeds/#{self.id}\", \"async\")\n PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", self.url, \"async\")\n end",
"def subscribe(channel)\n @ws.send(get_subscribe_object(channel, increment_cnt).to_json)\n @channels << channel unless @channels.include?(channel)\n end",
"def subscribe(repo)\n subscriptions.create(repository: repo)\n end",
"def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def call_topic(locale, version, topic)\n #env.merge will not force a URL structure\n #status, headers, body = call! env.merge(\"PATH_INFO\" => \"/#{locale}/#{version}/#{topic}\")\n #[status, headers, body]\n \n #Redirect rather than call in order to force a URL structure\n redirect to(\"/#{locale}/#{version}/#{topic}\")\n end",
"def testSubscribe1()\n topic = \"_Subscribe1_\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # check if the subscribers were successfully saved:\n (0..($_TEST_DATA.length - 1)).each do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(1, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [\" + $_TEST_DATA[i] + \"], but is: \" + subscribers.to_s)\n end\n \n conn.close_connection()\n end",
"def subscribe\n self.subscribed = true\n end",
"def topic(channel, str)\n sendmsg \"TOPIC #{channel} :#{str}\"\n end",
"def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result.error}\"\n connection.terminate\n false\n end\n end",
"def to_topic id, options={}, headers={}\n @connection.get \"subscriptions/to_topic/#{id}.json\", options, headers\n end",
"def subscribe dest, ack=false\n send_frame \"SUBSCRIBE\", {:destination=>dest, :ack=>(ack ? \"client\" : \"auto\")}\n end",
"def topic!(topic)\n @session.chanserv.topic(self.name, topic)\n end",
"def subscribe(url)\n subscribed_feed = UrlSubscriber.subscribe url, self\n end"
] | [
"0.74728787",
"0.70307046",
"0.6957174",
"0.67062706",
"0.6704016",
"0.66576546",
"0.6651502",
"0.65908444",
"0.65897375",
"0.6423702",
"0.64004534",
"0.6368169",
"0.63166356",
"0.6305598",
"0.6291053",
"0.62853944",
"0.6244622",
"0.6231099",
"0.6225057",
"0.6201193",
"0.61547047",
"0.6150701",
"0.61331266",
"0.6128623",
"0.6087288",
"0.60107446",
"0.5996962",
"0.59516287",
"0.59438944",
"0.5929165",
"0.5924132",
"0.59133846",
"0.5907829",
"0.5904623",
"0.58959764",
"0.58890617",
"0.5888016",
"0.5880797",
"0.58803475",
"0.5871108",
"0.58691156",
"0.58524466",
"0.5786576",
"0.5763809",
"0.57447743",
"0.57321733",
"0.5710592",
"0.57104504",
"0.5709464",
"0.569638",
"0.5682312",
"0.56789345",
"0.56762856",
"0.56726176",
"0.56543946",
"0.5653265",
"0.56335384",
"0.56306803",
"0.56306803",
"0.5608237",
"0.56074834",
"0.5607482",
"0.5604679",
"0.5603918",
"0.5595564",
"0.5595524",
"0.5585137",
"0.5577305",
"0.55685604",
"0.5547183",
"0.55466515",
"0.553268",
"0.5520696",
"0.5514614",
"0.5505409",
"0.550367",
"0.5498128",
"0.5492999",
"0.548837",
"0.5480164",
"0.547755",
"0.5476266",
"0.5473532",
"0.54712564",
"0.54683834",
"0.546089",
"0.54527074",
"0.5441164",
"0.5437787",
"0.5434098",
"0.54335",
"0.5425565",
"0.5410786",
"0.5407607",
"0.5406325",
"0.54028577",
"0.5400155",
"0.53993636",
"0.5387206",
"0.53859866"
] | 0.82586724 | 0 |
Unsubscribe to the topic. | def unsubscribe
return if self.hub.nil?
change_subscription(:unsubscribe)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end",
"def unsubscribe_from_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchRemove\")\n end",
"def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsubscribe\",\n :\"hub.topic\" => topic,\n :\"hub.callback\" => callback,\n }\n post(\"/hub\", options, 3, true, true, true)\n true\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n if @subscriber\n @subscriber.stream.close\n @subscriber = nil\n end\n end",
"def unsubscribe(*topics)\n # Defer unsubscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Unsubscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def unsubscribe\n synchronize do\n stan.nats.unsubscribe(self.sid)\n end\n\n # Make client stop tracking the subscription inbox\n # and grab unsub request subject under the lock.\n unsub_subject = nil\n stan.synchronize do\n stan.sub_map.delete(self.ack_inbox)\n unsub_subject = stan.unsub_req_subject\n end\n\n unsub_req = STAN::Protocol::UnsubscribeRequest.new({\n clientID: stan.client_id,\n subject: self.subject,\n inbox: self.ack_inbox\n })\n\n if self.durable_name\n unsub_req.durableName = self.durable_name\n end\n\n raw = stan.nats.request(unsub_subject, unsub_req.to_proto, {\n timeout: stan.options[:connect_timeout]\n })\n response = STAN::Protocol::SubscriptionResponse.decode(raw.data)\n unless response.error.empty?\n # FIXME: Error handling on unsubscribe\n raise Error.new(response.error)\n end\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.unsubscribe(*topics)\n end",
"def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end",
"def unsubscribe\n redis.unsubscribe\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def close_topic\n puts \"#{self.class} #{@my_hostname} unsubscribing #{self.topic}\"\n self.conn.unsubscribe self.topic if self.conn!=nil\n end",
"def destroy\n topic = Topic.find params[:id]\n user_topic = current_user.user_topics.find_by!(topic_id: topic.id)\n user_topic.destroy\n\n respond_to do |format|\n flash[:notice] = 'You have successfully unsubscribed from the thread.'\n\n format.html { redirect_back(fallback_location: root_path) }\n end\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def unsubscribe\n unregister\n end",
"def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end",
"def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end",
"def unsubscribe(opts = {})\n\t\t\t# Default consumer_tag from subscription if not passed in\n\t\t\tconsumer_tag = subscription ? subscription.consumer_tag : opts[:consumer_tag]\n\t\t\t\n\t\t\t# Must have consumer tag to tell server what to unsubscribe\n\t\t\traise Bunny::UnsubscribeError,\n\t\t\t\t\"No consumer tag received\" if !consumer_tag\n\t\t\t\n # Cancel consumer\n client.send_frame( Qrack::Protocol09::Basic::Cancel.new(:consumer_tag => consumer_tag,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:nowait => false))\n\n\t\t\tmethod = client.next_method\n\n\t\t\tclient.check_response(method,\tQrack::Protocol09::Basic::CancelOk,\n\t\t\t\t\"Error unsubscribing from queue #{name}\")\n\n\t\t\t# Reset subscription\n\t\t\t@subscription = nil\n\t\t\t\t\n\t\t\t# Return confirmation\n\t\t\t:unsubscribe_ok\n\t\t\t\n end",
"def unsubscribe\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscribe\n debug [self.name, \"terminated\"]\n unsubscribe_request\n end",
"def unsubscribe(topic, channel)\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n subscriber = @subscribers[name]\n return unless subscriber\n subscriber.stop\n @subscribers.delete(name)\n end\n end",
"def unsubscribe(feed)\n SubscriptionsManager.remove_subscription feed, self\n end",
"def unsubscribe(mailbox)\n tagged_response(\"UNSUBSCRIBE\", to_utf7(mailbox))\n end",
"def do_unsubscribe(subid)\n unsubscribe(@nodename,subid)\n end",
"def unsubscribe()\n end",
"def unsubscribe(opts = {})\n # Default consumer_tag from subscription if not passed in\n consumer_tag = @default_consumer ? @default_consumer.consumer_tag : opts[:consumer_tag]\n\n # Must have consumer tag to tell server what to unsubscribe\n raise Bunny::UnsubscribeError,\n \"No consumer tag received\" if !consumer_tag\n\n # Cancel consumer\n client.send_frame(Qrack::Protocol::Basic::Cancel.new(:consumer_tag => consumer_tag, :nowait => false))\n\n # Reset subscription\n @default_consumer = nil\n\n method = client.next_method\n\n client.check_response(method, Qrack::Protocol::Basic::CancelOk, \"Error unsubscribing from queue #{name}, got #{method.class}\")\n\n # Return confirmation\n :unsubscribe_ok\n end",
"def unsubscribe\n return true if @subscription_id.nil?\n\n resp = ews.unsubscribe(@subscription_id)\n rmsg = resp.response_messages.first\n if rmsg.success?\n @subscription_id, @watermark = nil, nil\n true\n else\n raise EwsSubscriptionError, \"Could not unsubscribe: #{rmsg.code}: #{rmsg.message_text}\"\n end\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe\n unless unsubscribe = pubsub.find_first('ns:unsubscribe', :ns => self.class.registered_ns)\n self.pubsub << (unsubscribe = XMPPNode.new('unsubscribe', self.document))\n unsubscribe.namespace = self.pubsub.namespace\n end\n unsubscribe\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end",
"def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end",
"def unsubscribe_from_channel; end",
"def unsubscribe(source)\n #TODO\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def unsubscribe(subscriber)\n name_or_subscriber = subscriber.is_a?(String) ? name_with_suffix(subscriber) : subscriber\n adapter.unsubscribe(name_or_subscriber)\n end",
"def unsubscribe\n\t\t@subject = Subject.find(params[:id])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects.delete(@subject)\n\t\tflash[:success] = \"You have unsubscribed from #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def unsubscribe()\n \n end",
"def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end",
"def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe(msg)\n false\n end",
"def unsubscribe(subscriber, **args)\n reason = args.delete(:reason)\n subscription = subscriber(subscriber, **args)\n return false if subscription.nil?\n\n subscription.unsubscribe(reason)\n end",
"def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end",
"def unsubscribe; end",
"def unsubscribe(queue_name = nil)\n client.unsubscribe(\"/queue/#{queue_name || queue}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def destroy!(this_is_not_accidental:)\n @topic.delete\n @subscription.delete\n end",
"def unsubscribe\n @subscription.unsubscribe\n return_back_or_ajax\n end",
"def unsubscrive_from_the_topic(topic, device)\n raise NotImplementedError.new\n end",
"def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end",
"def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def unsubscribe(channel)\n send_action('unsubscribe', channel)\n end",
"def unsubscribe(subscribable)\n subscribable.unsubscribe(self)\n end",
"def unsubscribe(subscriber)\n handler.unsubscribe(self, subscriber)\n end",
"def unsubscribe_pubsub(domain, node, jid)\n @pubsub.unsubscribe(domain, node, jid)\n end",
"def unsubscribed\n stop_all_streams\n end",
"def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end",
"def unsubscribe(ident)\n @subscribers.delete(ident)\n end",
"def unsubscribe(endpoint, channel_name, subscription_id)\n channel = @channels[channel_name]\n if channel\n channel.unsubscribe(subscription_id)\n EM.next_tick { cleanup_after_unsubscribe channel }\n # Fire presence events if configured\n if @app_info['presence']\n EM.defer { fire_presence_close_events endpoint, channel }\n end\n\n else\n logger.debug \"Trying to unsubscribe for an inexistant channel #{channel_name}\"\n end\n end",
"def unsubscribe(subreddit)\n full_name = extract_full_name subreddit\n parameters = { :action => 'unsub', :sr => full_name }\n\n post('api/subscribe', parameters)\n end",
"def unsubscribe(destination, headers = {})\n headers[:id] = sha1(destination) unless headers[:id]\n @connection.unsubscribe(destination, headers)\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def unsubscribe!(reason = nil)\n update!(unsubscribed_at: ::Caffeinate.config.time_now, unsubscribe_reason: reason)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_unsubscribe, self)\n end",
"def unsubscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Unsubscribed from ML@B\"\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def unsubscribe(message_name)\n @transport.unbind(message_name, @queue)\n \n #has key check\n @subscriptions.delete(message_name)\n \n end",
"def unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, options = { })\n wait_for_destination(options[:startup_timeout]) do\n with_session do |session|\n session.unsubscribe( subscriber_name )\n end\n end\n end",
"def handle_unsubscribe(client, data)\n topic = @engine.unsubscribe_client_from_topic(client, data[0])\n\n trigger(:unsubscribe, client, topic.uri)\n end",
"def delete_topic topic_name\n publisher.delete_topic topic: topic_path(topic_name)\n end",
"def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end",
"def unsubscribe_from_topic_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/subscribed\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end",
"def destroy\n @newsletter_topic.destroy\n end",
"def unsubscribe\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n if @subscriber.valid?\n GoGoGibbon::Commands.unsubscribe @subscriber, GoGoGibbon::Config.subscribed\n end\n\n respond_to do |format|\n format.html { redirect_to(mailchimp_subscribers_url, :notice => 'User was successfully unsubscribed.') }\n end\n end",
"def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def unsubscribe\n # Ask the list manager to unsubscribe this devise models email.\n self.class.list_manager.unsubscribe(self.email)\n end",
"def unsubscribe(node, jid = nil, subid = nil, host = nil)\n jid ||= client.jid.stripped\n stanza = Stanza::PubSub::Unsubscribe.new(:set, send_to(host), node, jid, subid)\n request(stanza) { |n| yield n if block_given? }\n end",
"def unsubscribe(recipient_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Unsubscribe/#{recipient_id}\")\n end",
"def unsubscribe(opt_max=nil)\n @nc.send(:unsubscribe, self, opt_max)\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscribe(message_hsh)\n # sender = message_hsh[:sender]\n # runr_data_set_get(sender)\n end",
"def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end",
"def unsubscribe(name)\n if subscriptions.has_key? name\n subscriptions[name].queue.unsubscribe(:nowait => false)\n subscriptions.delete(name)\n end\n end",
"def detach_subscription subscription\n publisher.detach_subscription subscription: subscription_path(subscription)\n end",
"def unsubscribe(recipient_id)\n @api.delete(\"#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}\")\n end",
"def unsubscribe(name)\n EM.schedule { @subs.delete name }\n end"
] | [
"0.8266986",
"0.78577626",
"0.77358454",
"0.77099276",
"0.7670159",
"0.7667653",
"0.7498516",
"0.7479801",
"0.7474664",
"0.7441543",
"0.741957",
"0.73319083",
"0.732448",
"0.73236096",
"0.7317096",
"0.7303973",
"0.72524816",
"0.72481936",
"0.72364885",
"0.713424",
"0.7094634",
"0.70283526",
"0.702021",
"0.70197594",
"0.7008315",
"0.6997134",
"0.6993174",
"0.6974653",
"0.6969683",
"0.694994",
"0.6933189",
"0.6928458",
"0.6927273",
"0.68959504",
"0.68691",
"0.68691",
"0.6851098",
"0.68495977",
"0.6835842",
"0.68324894",
"0.6822171",
"0.6812195",
"0.67558056",
"0.6752101",
"0.67402846",
"0.67362803",
"0.6730468",
"0.6727114",
"0.672635",
"0.67245674",
"0.67245674",
"0.67150396",
"0.67100006",
"0.66999894",
"0.6688545",
"0.66826254",
"0.66777587",
"0.66777587",
"0.66595095",
"0.6633922",
"0.66338354",
"0.6630802",
"0.6600117",
"0.658892",
"0.65804017",
"0.6574689",
"0.65686065",
"0.6564469",
"0.65630347",
"0.6542991",
"0.6537698",
"0.6533684",
"0.6497194",
"0.64956564",
"0.64944196",
"0.64944196",
"0.6484869",
"0.6473135",
"0.6454438",
"0.6454028",
"0.64352995",
"0.6435103",
"0.6432738",
"0.64194155",
"0.6414975",
"0.63964653",
"0.63732",
"0.63613045",
"0.63612086",
"0.6340901",
"0.6338731",
"0.6321485",
"0.6309263",
"0.6295605",
"0.6294136",
"0.62940097",
"0.6275536",
"0.6270319",
"0.6265004",
"0.626067"
] | 0.70453525 | 21 |
Change our subscription to this topic at a hub. mode: Either :subscribe or :unsubscribe hub_url: The url of the hub to negotiate with token: A token to verify the response from the hub. | def change_subscription(mode)
token ||= SecureRandom.hex(32)
@tokens << token.to_s
# TODO: Set up HTTPS foo
res = Net::HTTP.post_form(URI.parse(self.hub),
{
'hub.mode' => mode.to_s,
'hub.callback' => @callback_url,
'hub.verify' => 'async',
'hub.verify_token' => token,
'hub.lease_seconds' => '',
'hub.secret' => @secret,
'hub.topic' => @topic_url
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def toggle_subscription\n authorize model\n authorize Subscription\n subscription_toggle\n @model = model\n render 'toggle_subscription'\n end",
"def subscribe_to_channel; end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def set_subscription\n @subscription = ::Pushar::Core::Subscription.unscoped.find(params[:id])\n end",
"def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end",
"def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsubscribe\",\n :\"hub.topic\" => topic,\n :\"hub.callback\" => callback,\n }\n post(\"/hub\", options, 3, true, true, true)\n true\n end",
"def toggle_subscription!\n self.unsubscribed = !unsubscribed\n save\n end",
"def request!\n self.type = :subscribe\n reply_if_needed!\n end",
"def topic!(topic)\n @session.chanserv.topic(self.name, topic)\n end",
"def configure_subscription(form)\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('options',{'node' => node_id, 'jid'=>subscribee},\n connection.build_submit_form(form)\n )\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end",
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def subscribe(callback_url)\n @repository.callback_url = callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end",
"def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end",
"def subscribe!\n # TODO: Implement\n end",
"def topic=(topic)\n raise 'Tried to set topic on voice channel' if voice?\n\n update_channel_data(topic: topic)\n end",
"def confirm_subscription(topic_arn, token, authenticate_on_unsubscribe = false)\n req_hash = generate_request('ConfirmSubscription',\n 'Token' => token,\n 'TopicArn' => topic_arn )\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger)) \n \n end",
"def set_user_to_channel_subscription\n @user_to_channel_subscription = UserToChannelSubscription.find(params[:id])\n end",
"def to_topic id, options={}, headers={}\n @connection.get \"subscriptions/to_topic/#{id}.json\", options, headers\n end",
"def toggle_comment_subscription user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = !subscription.subscribed \n subscription.save!\n end",
"def subscribe_and_configure(form)\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee),\n x('options',\n connection.build_submit_form(form)\n )\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def set_subtopic\n @subtopic = Subtopic.friendly.find(params[:id])\n end",
"def set_thread_subscription(thread_id, options = {})\n put \"notifications/threads/#{thread_id}/subscription\", options\n end",
"def set_hub\n @hub = Hub.find(params[:id])\n end",
"def call_topic(locale, version, topic)\n #env.merge will not force a URL structure\n #status, headers, body = call! env.merge(\"PATH_INFO\" => \"/#{locale}/#{version}/#{topic}\")\n #[status, headers, body]\n \n #Redirect rather than call in order to force a URL structure\n redirect to(\"/#{locale}/#{version}/#{topic}\")\n end",
"def subscribe(subscription)\n @pipe.send_strings [\"subscribe\", subscription]\n end",
"def subscribe\n find_and_authorize_with_security_code\n @email.subscribe!\n flash[:success] = t('.success_html', unsubscribe_href:\n unsubscribe_path(id: @email.id, security_code: @email.security_code))\n redirect_to root_path\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def set_subscription\n @subscription = Subscription.find(params[:id])\n end",
"def send_subscription_verification_email(address:, frequency:, topic_id:)\n post_json(\n \"#{endpoint}/subscriptions/auth-token\",\n address: address,\n frequency: frequency,\n topic_id: topic_id,\n )\n end",
"def send_subscription_verification_email(address:, frequency:, topic_id:)\n post_json(\n \"#{endpoint}/subscriptions/auth-token\",\n address: address,\n frequency: frequency,\n topic_id: topic_id,\n )\n end",
"def topic(session, message, options={})\n json_request \"topic\", {:session => session,\n :message => message}, options\n end",
"def set_subscribe\n @subscribe = Subscribe.find(params[:id])\n end",
"def set_subscribe\n @subscribe = Subscribe.find(params[:id])\n end",
"def set_subscribe\n @subscribe = Subscribe.find(params[:id])\n end",
"def set_subscribe\n @subscribe = Subscribe.find(params[:id])\n end",
"def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end",
"def auto_subscribe_topic\n fail NotImplementedError, 'To be implemented by the concrete topic posts controller.'\n end",
"def subscribe\n self.subscribed = true\n end",
"def subscribe_plan\n call(:subscribe_plan, connection_space.plan.remote_id)\n synchro_point\n end",
"def subscribe\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def step3\n user = session[:user]\n #for v1, always this will be the subscription basic 18$, for v2 this will change\n user.subscription_id = 1\n end",
"def subscribe_to_topic(topic, device)\n raise NotImplementedError.new\n end",
"def set_api_subscription\n @api_subscription = Api::Subscription.find(params[:id])\n end",
"def update!(**args)\n @pubsub_subscription = args[:pubsub_subscription] if args.key?(:pubsub_subscription)\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def subscription=(subscription)\n attributes[:subscription] = subscription\n end",
"def set_sub_topic\n @sub_topic = SubTopic.find(params[:id])\n end",
"def set_subtopic\n @subtopic = Subtopic.find(params[:id])\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def subscribe_to_topic(topic_arn, protocol, end_point)\n # TODO handle different SubscriptionArn results? Let's\n # just return the raw subscription arn for now\n req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => end_point)\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger))\n end",
"def edit_subscription(subscription_id, payload)\n put(url_(\"subscription\", subscription_id), payload)\n end",
"def subscribe\n \nend",
"def subscription(options = {})\n\t\t\t# provide the client with another (i.e. the external address) if given\n\t\t\tsub = {server: config[:server_external] || config[:server], timestamp: (Time.now.to_f * 1000).round}.merge(options)\n\t\t\tsub[:signature] = Digest::SHA1.hexdigest([config[:secret_token], sub[:channel], sub[:timestamp]].join)\n\t\t\tsub\n\t\tend",
"def authenticate_subscribe(message)\n subscription = PrivatePub.subscription(:channel => message[\"subscription\"], :timestamp => message[\"ext\"][\"private_pub_timestamp\"])\n end",
"def change_subscription\n @user = User.find(params[:id])\n @user.notify = !@user.notify\n @user.save\n respond_with(@user) do\n redirect_to \"/users/successful_unsubscribe\"\n end\n end",
"def subscription=(new_subscription)\n should_unsubscribe = false\n old = nil\n @gate.synchronize do\n should_unsubscribe = @unsubscribed\n unless should_unsubscribe\n old = @current\n @current = new_subscription\n end\n end\n\n old.unsubscribe if old\n new_subscription.unsubscribe if should_unsubscribe && !new_subscription.nil?\n end",
"def subid=(subid)\n subscription_node[:subid] = subid\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscription=(val)\n case val\n when :both then attributes['subscription'] = 'both'\n when :from then attributes['subscription'] = 'from'\n when :none then attributes['subscription'] = 'none'\n when :remove then attributes['subscription'] = 'remove'\n when :to then attributes['subscription'] = 'to'\n else attributes['subscription'] = nil\n end\n end",
"def subscribe(url, id = nil, opts = {}, &block)\n feed_id = \"#{id ? id : Base64.urlsafe_encode64(url)}\"\n if block\n @verifications[feed_id] ||= {}\n @verifications[feed_id]['subscribe'] = block\n end\n endpoint = opts[:hub] || SUPERFEEDR_ENDPOINT\n opts.delete(:hub)\n\n retrieve = opts[:retrieve] || false\n opts.delete(:retrieve)\n\n\n if endpoint == SUPERFEEDR_ENDPOINT\n opts[:userpwd] = \"#{@params[:login]}:#{@params[:password]}\"\n end\n\n\n opts = opts.merge({\n :params => {\n 'hub.mode' => 'subscribe',\n 'hub.topic' => url,\n 'hub.callback' => generate_callback(url, feed_id)\n },\n :headers => {\n :accept => @params[:format] == \"json\" ? \"application/json\" : \"application/atom+xml\"\n }\n })\n\n if retrieve\n opts[:params][:retrieve] = true\n end\n\n opts[:params][:'hub.verify'] = @params[:async] ? 'async' : 'sync'\n\n response = http_post(endpoint, opts)\n\n #@error = response.body\n\n # TODO Log error (response.body)\n if !retrieve\n @params[:async] && response.code == '202' || response.code == '204' # We return true to indicate the status.\n else\n\n if response.code == 200\n\n if @params[:format] != \"json\"\n content = Nokogiri.XML(response.body)\n else\n content = JSON.parse(response.body)\n end\n # Let's now send that data back to the user.\n if defined? Hashie::Mash\n info = Hashie::Mash.new(req: req, body: body)\n end\n if !@callback.call(content, feed_id, info)\n # We need to unsubscribe the user\n end\n true\n else\n puts \"Error #{response.code}. #{@error}\"\n false\n end\n end\n end",
"def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result.error}\"\n connection.terminate\n false\n end\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def set_webhook_subscription(id)\n\t\tputs \"Setting subscription for 'host' account for webhook id: #{id}\"\n\n\t\turi_path = \"#{@twitter_api.uri_path}/webhooks/#{id}/subscriptions.json\"\n\t\tresponse = @twitter_api.make_post_request(uri_path, nil)\n\t\t\n\t\tif response == '204'\n\t\t\tputs \"Webhook subscription for #{id} was successfully added.\"\n\t\telse\n\t\t\tputs response\n\t\tend\n\n response\n\tend",
"def subscription(topic_name, subscription_name)\n pubsub.subscription(subscription_name) ||\n create_subscription(topic_name, subscription_name)\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result ? e.result.error : '<No Response!>'}\"\n connection.terminate\n false\n end\n end",
"def topic=(topic)\n tinycache_adapter.write(:topic, topic)\n client.api.set_room_topic(id, topic)\n topic\n end",
"def grant_subscribe client, &block\n control_request(\"grant_subscribe\", client, &block)\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def unsubscribe_from_channel; end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def subscription=(new_subscription)\n if !new_subscription.nil?\n case new_subscription\n when true\n unless subscribed?\n @attributes << :Subscribed\n subscription_changed!\n end\n when false\n if subscribed?\n @attributes.delete(:Subscribed)\n subscription_changed!\n end\n end\n end\n end",
"def set_category_subscription\n @category_subscription = CategorySubscription.find(params[:id])\n end",
"def set_category_subscription\n @category_subscription = CategorySubscription.find(params[:id])\n end",
"def set_category_subscription\n @category_subscription = CategorySubscription.find(params[:id])\n end"
] | [
"0.7160374",
"0.6106317",
"0.57910156",
"0.5741319",
"0.55150294",
"0.5457976",
"0.5431595",
"0.54250175",
"0.53621566",
"0.53432983",
"0.5337536",
"0.5233994",
"0.5226833",
"0.52050966",
"0.5175315",
"0.5174477",
"0.51672274",
"0.51595294",
"0.5157737",
"0.5157737",
"0.5149044",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51230925",
"0.51227456",
"0.5114758",
"0.5047842",
"0.5038092",
"0.50356364",
"0.50300175",
"0.5029726",
"0.4990756",
"0.49681213",
"0.49673158",
"0.4950677",
"0.49400103",
"0.4933827",
"0.4931932",
"0.49301916",
"0.49301916",
"0.49301916",
"0.49044552",
"0.49044552",
"0.4888758",
"0.48710343",
"0.48710343",
"0.48710343",
"0.48710343",
"0.48699242",
"0.48638788",
"0.48601958",
"0.48505154",
"0.48394814",
"0.48389077",
"0.48272082",
"0.48261625",
"0.48254836",
"0.48210987",
"0.48195115",
"0.48178658",
"0.4811547",
"0.48104227",
"0.48043016",
"0.48022583",
"0.47824132",
"0.47692898",
"0.47557074",
"0.47492364",
"0.47485766",
"0.4748098",
"0.47382957",
"0.4722315",
"0.47188586",
"0.4711212",
"0.4709986",
"0.4709893",
"0.47062573",
"0.47017166",
"0.4701652",
"0.47010505",
"0.46983615",
"0.46959585",
"0.46952617",
"0.4682792",
"0.46816838",
"0.46765774",
"0.4676508",
"0.4676508",
"0.4676508"
] | 0.823721 | 0 |
Verify that a subscription response is valid. | def verify_subscription(token)
# Is there a token?
result = @tokens.include?(token)
# Ensure we cannot reuse the token
@tokens.delete(token)
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_subscription(subscriptions)\n # TODO: move out of vba documents\n schema_path = Pathname.new('modules/vba_documents/spec/fixtures/subscriptions/webhook_subscriptions_schema.json')\n schemer_formats = {\n 'valid_urls' => ->(urls, _schema_info) { validate_urls(urls) },\n 'valid_events' => ->(subscription, _schema_info) { validate_events(subscription) }\n\n }\n schemer = JSONSchemer.schema(schema_path, formats: schemer_formats)\n unless schemer.valid?(subscriptions)\n raise SchemaValidationErrors, [\"Invalid subscription! Body must match the included example\\n#{SUBSCRIPTION_EX}\"]\n end\n\n subscriptions\n end",
"def ensure_has_subscription\n if !has_valid_subscription?\n raise ApiErrors::StandardError.new(\n message: 'Sorry, you must have a valid subscription to perform this action',\n status: 403,\n )\n end\n end",
"def verify_subscription(package, subscription_id, token)\n parameters = {\n 'packageName' => package,\n 'subscriptionId' => subscription_id,\n 'token' => token\n }\n execute(parameters, rpc.purchases.subscriptions.get)\n end",
"def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end",
"def verify_subscription(package, subscription_id, token)\n @api_client.get_purchase_subscription(\n package,\n subscription_id,\n token\n )\n end",
"def verify!\n if signature.missing? && assertion.signature.missing?\n raise Samlr::SignatureError.new(\"Neither response nor assertion signed with a certificate\")\n end\n\n if document.xpath(\"//samlp:Response\", Samlr::NS_MAP).size > 1\n raise Samlr::FormatError.new(\"multiple responses\")\n end\n\n signature.verify! unless signature.missing?\n assertion.verify!\n\n true\n end",
"def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end",
"def verify_subscription_purchase(package_name:, subscription_id:, token:)\n verifier = CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionVerification.new(\n package_name: package_name,\n subscription_id: subscription_id,\n token: token,\n authorization: @authorization,\n )\n verifier.call!\n end",
"def verify_subscription(package, subscription_id, token)\n execute(\n :get_purchase_subscription,\n package,\n subscription_id,\n token\n )\n end",
"def validate(response)\n # Invalid if the zuora timestamp is more than 300 seconds ago\n timestamp = from_zuora_time(response[\"timestamp\"].to_i)\n return false if timestamp < Time.now - 300\n # Match the signature with the signature from zuora\n create(response[\"id\"], response[\"timestamp\"], response[\"token\"]).signature == response[\"responseSignature\"]\n end",
"def call!\n verify!\n if valid?\n CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionPurchase.new(@response[:result])\n else\n CandyCheck::PlayStore::VerificationFailure.new(@response[:error])\n end\n end",
"def valid_response?(message)\n return true\n end",
"def check\n @response = nil\n verified?\n end",
"def subscription_data_valid?\n # empty credential file\"s size is about 50-55.\n # 65 is when you have a very short email, password, and save_path.\n # So when you filled in data, probably will > 65.\n if CREDENTIAL_FILE.size < 65\n abort \"Did you fill in your subscription data in #{CREDENTIAL_FILE}?\"\n return false\n end\n\n credential_data_valid?(get_validate load_credential_data)\n end",
"def valid_response?\n if self.required? && !self.has_response? then\n false\n else\n # other validations\n true\n end\n end",
"def validate_response!(response)\n raise \"empty response\" unless response\n\n status = response[\"stat\"]\n if status and status != \"ok\"\n error = response[\"err\"]\n if error\n raise RequestFailed, \"#{error[\"code\"]}: #{error[\"msg\"]}, explanation: #{error[\"expl\"]}\"\n else\n raise RequestFailed, \"Error: #{status}, no error message\"\n end\n end\n end",
"def guard_against_incomplete\n raise Reji::SubscriptionUpdateFailureError.incomplete_subscription(self) if incomplete\n end",
"def check_subscription\n !subscribed || subscription_present?\n end",
"def ensure_valid_response(validation)\n status = validation[\"status\"]\n return true if status[\"name\"] == \"Ok\"\n\n error = ComTradeError.new(\n validation[\"message\"] + \" (\" +\n status[\"name\"] + \" \" +\n status[\"description\"] + \")\"\n )\n Rails.logger.error error\n Appsignal.send_error(error)\n return false\n end",
"def valid?\n subscriber && data&.any?\n end",
"def validate(response)\n raw_validate response\n\n response.parsed_response\n end",
"def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end",
"def response_must_validate_against_schema\n check_validity_against_schema(doc, 'application_response.xsd')\n end",
"def check_response\n unless (res = get).valid?\n raise BadResponse, \"#{res.code} #{res['Code'].first}\"\n end\n\n res\n end",
"def verify_sub(jwt)\n errors << 'Subject not present' if jwt[:sub].blank?\n end",
"def validate_response(resp)\n # The length for a chunked response is 0, so checking it isn't meaningful.\n return resp if resp.headers['Transfer-Encoding'] == 'chunked'\n\n exp_content_length = resp.headers['Content-Length'].to_i\n actual_content_length = resp.body.length\n return resp if actual_content_length == exp_content_length\n\n errmsg = \"Incomplete response received from Symphony for #{@catkey} - expected #{exp_content_length} bytes but got #{actual_content_length}\"\n Honeybadger.notify(errmsg)\n raise ResponseError, errmsg\n end",
"def valid?\n @hydra.queue(request('verify'))\n end",
"def validate_subscription_with_http_info(sub_id, validation_callback_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionsApi.validate_subscription ...\"\n end\n # verify the required parameter 'sub_id' is set\n fail ArgumentError, \"Missing the required parameter 'sub_id' when calling SubscriptionsApi.validate_subscription\" if sub_id.nil?\n # verify the required parameter 'validation_callback_request' is set\n fail ArgumentError, \"Missing the required parameter 'validation_callback_request' when calling SubscriptionsApi.validate_subscription\" if validation_callback_request.nil?\n # resource path\n local_var_path = \"/subscriptions/{subId}/validate\".sub('{format}','json').sub('{' + 'subId' + '}', sub_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(validation_callback_request)\n auth_names = ['artikcloud_oauth']\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 => 'SubscriptionEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionsApi#validate_subscription\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def validate_subscription(sub_id, validation_callback_request, opts = {})\n data, _status_code, _headers = validate_subscription_with_http_info(sub_id, validation_callback_request, opts)\n return data\n end",
"def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"def check_subscription\n unless self.blog_url_was == self.blog_url\n unless unsubscribe(self.blog_url_was) and subscribe(self.blog_url)\n self.errors.add(:blog_url, \"might be invalid -- double check to ensure it \n has an RSS/Atom feed and the feed contains <link rel='hub'...\")\n end\n end\n end",
"def validate_endpoint_response\n begin\n return if response.nil?\n res = JSON.parse(response)\n \n if res[\"code\"].present?\n errors.add(:response, 'response code must have value of data type integer') if !res[\"code\"].is_a? Integer\n else\n errors.add(:response, \"response code can't be blank\") \n end\n\n if res[\"headers\"].present?\n isValid = true\n res[\"headers\"].each do | key, value |\n isValid = (value.instance_of? String)? true : false\n errors.add(:response, \"response headers attributes: #{key} must have value of data type string\") if !isValid\n end\n end\n\n if res[\"body\"].present?\n isValid = true\n isValid = (res[\"body\"].instance_of? String)? true : false\n errors.add(:response, \"response body value must be of data type string\") if !isValid \n end\n rescue JSON::ParserError => e\n errors[response.to_s] << \"is not valid JSON\" \n end\n end",
"def validate_response(response, response_resource_prefix, request_id=nil)\n method = (response_resource_prefix + '_response').to_sym\n response_id = send(method, response[0])\n expect(response_id).to eq(request_id) unless request_id.nil?\nend",
"def valid?\n @http_response.is_a?(Net::HTTPSuccess) && @errors.blank?\n end",
"def _verify\n unless (@_headers['x-allopass-response-signature'] || []).include?(@_signature)\n raise Allorails::ApiFalseResponseSignatureError\n end\n end",
"def test_response_valid_in_this_phase\n response = Response.new\n\n response.updated_at = Time.parse(\"2012-12-02 06:00:00 UTC\")\n\n #resubmission_time3 after the response time\n #but it is after the current review phase\n latest_review_phase_start_time = Time.parse(\"2012-12-02 07:00:00 UTC\")\n\n resubmission_time1 = ResubmissionTime.new\n resubmission_time1.resubmitted_at = Time.parse(\"2012-12-02 04:00:00 UTC\")\n resubmission_time2 = ResubmissionTime.new\n resubmission_time2.resubmitted_at = Time.parse(\"2012-12-02 05:00:00 UTC\")\n resubmission_time3 = ResubmissionTime.new\n resubmission_time3.resubmitted_at = Time.parse(\"2012-12-02 08:00:00 UTC\")\n\n resubmission_times = [resubmission_time3, resubmission_time2, resubmission_time1]\n\n assert response.is_valid_for_score_calculation?(resubmission_times, latest_review_phase_start_time)\n end",
"def check_subscription(user, device_id, sub)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n return \"{\\\"subscribed\\\": \\\"#{device.hasSubscription?(sub)}\\\"}\"\n else\n return \"{\\\"subscribed\\\": \\\"false\\\"}\"\n end\n end",
"def test_subscribe\n jid = 'foo@example.com'\n @roster.deliver_subscription_request(jid)\n assert_equal([jid], @roster.accepted_subscriptions)\n end",
"def valid_status?(response)\n response.is_a?(Net::HTTPSuccess)\n end",
"def is_signed_response(response)\n\t str = response.body + API_KEY\n\t hash = Digest::SHA1.hexdigest str\n\t if hash == response.header['X-Sponsorpay-Response-Signature']\n \t true\n\t else\n\t @result[:error] = {code: \"Invalid response\"\n\t\t\t message: \"Response generated from unauthorized source. \"}\n\t false\n\t end\n\tend",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def valid?\n verify\n end",
"def verify\n response = @client.call :payment_verification, message: {\n 'MerchantID' => Zarinpal.configuration.merchant_id,\n 'Authority' => @authority,\n 'Amount' => @amount,\n }\n\n @response.validate(response.body)\n end",
"def check_rest_response(response)\n assert_not_nil(response.body)\n assert_equal(200, response.code)\n\n result = JSON.parse(response.body)\n\n assert(result['success'])\n assert(result['id'])\n end",
"def verify_response\n\n self.exec\n end",
"def valid?\n status == 200\n end",
"def can_charge_subscription?\n # * cannot charge subscription until trial period is running\n # * can only charge with a valid shipped_at or panic event\n !order.blank? && !subscription_deferred? && ( senior.any_panic_received? || !shipped_at.blank?)\n end",
"def verify_sub; end",
"def verify_sub; end",
"def checkSubscription\n @check_sub= Subscription.where(user_id:@current_user.id , channel_id:@channel.id )\n if @check_sub.length>0\n render :json=>{subscribed:true, message:@check_sub[0]}, status: :ok\n else\n render :json=>{subscribed:false, message:@check_sub[0]}, status: :ok\n end\n end",
"def valid?\n raise_error(@resource['error']) if ok? || error?\n end",
"def verifyPostIdeaResponseContract\n return verifyResponseContract(@postIdea_response_structure)\n end",
"def check_response\n if @res.blank? || @res.error\n flash[:error] = t \"errors.api\"\n end\n end",
"def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end",
"def subscription_update\n data = request.body.read\n @verified = verify_webhook(data, request)\n if @verified\n ReserveInventory.delay(:retry => false).update_reserve_inventory\n head :ok\n else\n head :error\n end\n end",
"def valid_payload(payload)\n if expired(payload) || payload['iss'] != meta[:iss] || payload['aud'] != mata[:aud]\n false\n else\n true\n end\n end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def test_webhook_subscription(subscription_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/webhooks/subscriptions/{subscription_id}/test',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def verifyIdeaResponseContract\n return verifyResponseContract(@idea_response_structure)\n end",
"def validate(response)\n unless response.code == 200\n message = response.parsed_response\n message = message['error'] if message.respond_to?(:has_key?) and message.has_key?('error')\n message = message['message'] if message.respond_to?(:has_key?) and message.has_key?('message')\n raise RequestError.new(message, response.code)\n end\n\n response\n end",
"def verifyCategoriesResponseContract\n verifyResponseContract(@categories_response_structure)\n end",
"def assert_response_contains_error\n assert JSON.parse(response.body).key?('error'), 'Error message should be included in response'\n end",
"def response_successful?(response)\n return false if response.body[\"errors\"]\n response.success?\n end",
"def test_successful_purchase\n skip\n @gateway.expects(:ssl_post).returns(successful_purchase_response)\n\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_instance_of\n assert_success response\n\n # Replace with authorization number from the successful response\n assert_equal '', response.authorization\n assert response.test?\n end",
"def api_payment_subscription_status\n\n raise \"No subscription Transaction ID\" unless @payment_subscription_txid\n\n url = \"#{@config['api_host']}/1/payments/transactions/#{@payment_subscription_txid}?access_token=#{@oauth_token}\"\n\n log \"Finding subscription info\"\n log_error \"Request: #{url}\" if @debug >= AttApiReporter::DEBUG_INFO\n\n begin\n page = @agent.get(url)\n subscriptionStatus = JSON.parse(page.body)\n log \"Got subscription info\"\n log_error JSON.pretty_generate(subscriptionStatus)\n rescue Exception => e\n log_error e.backtrace\n log_error e.page.body\n return \"FAILED\"\n end\n return \"OK\"\n end",
"def verify_unpublished_access\n unless resource.published || (!resource.published && logged_in? && current_user.send(pluralized_name).exists?(resource.id))\n render json: ErrorSerializer.serialize(resource_name => \"is invalid\"), status: 422 and return false\n end\n true\n end",
"def allowed?\n errors_count = self.errors.count\n self.validate_allows_response\n errors_count == self.errors.count\n end",
"def valid?\n code == 200\n end",
"def has_accepted_response?\n self.responses.accepted.any? {|response| response.accepted?}\n end",
"def paid_subscriptions?\r\n !self.subscriptions.map { |sub| sub.periods.paid }.flatten.empty?\r\n end",
"def paid_subscriptions?\r\n !self.subscriptions.map { |sub| sub.periods.paid }.flatten.empty?\r\n end",
"def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end"
] | [
"0.70428723",
"0.67207235",
"0.6518188",
"0.65162784",
"0.64482665",
"0.6391007",
"0.6338562",
"0.6279137",
"0.62723386",
"0.62565184",
"0.617986",
"0.615574",
"0.61510926",
"0.61398524",
"0.6071308",
"0.60654736",
"0.6045898",
"0.6039437",
"0.5991898",
"0.5961188",
"0.5938602",
"0.5936069",
"0.59174955",
"0.5891886",
"0.5875178",
"0.5831705",
"0.5829701",
"0.582483",
"0.57939166",
"0.578822",
"0.5761827",
"0.57134396",
"0.5700157",
"0.56544006",
"0.56465185",
"0.56330526",
"0.5579345",
"0.55729246",
"0.5539311",
"0.5531917",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.55280817",
"0.5516875",
"0.5502854",
"0.54989326",
"0.54938227",
"0.54823357",
"0.54722154",
"0.54722154",
"0.5472039",
"0.5452073",
"0.54501665",
"0.5417999",
"0.5415677",
"0.5402954",
"0.54019815",
"0.5379518",
"0.53774995",
"0.5371172",
"0.5356894",
"0.5345758",
"0.53258157",
"0.5310244",
"0.5306453",
"0.53051573",
"0.5285016",
"0.5284501",
"0.5281766",
"0.5281061",
"0.5279145",
"0.5279145",
"0.5277279"
] | 0.5973699 | 19 |
Determines if the given body matches the signature. | def verify_content(body, signature)
hmac = HMAC::SHA1.hexdigest(@secret, body)
check = "sha1=" + hmac
check == signature
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_post_body?(post_body, signature)\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)\n Base64.strict_encode64(hash) == signature\n end",
"def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signature_parts = request_signature.split('sha1=')\n request_signature = signature_parts[1]\n calculated_signature = OpenSSL::HMAC.hexdigest('sha1', @secret, body)\n calculated_signature == request_signature\n end",
"def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end",
"def matches_signature(signature)\n @name == signature.name\n end",
"def signatures_match?\n expected_signature == api_signature\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def check_signature(body)\n received_signature = request.env['HTTP_X_HUB_SIGNATURE'] || ''\n signature = 'sha1=' + hmac_sha1(settings.github_secret, body)\n\n if !Rack::Utils.secure_compare(signature, received_signature)\n build_failed('signature mismatch')\n end\nend",
"def match_signature(signature)\n if !signature[:ok]\n msg_mismatch(text)\n elsif expected_signer && signature[:email] != expected_signer\n msg_wrong_signer(signature[:email])\n end\n end",
"def valid_body?(response, service)\n return true unless service[:body_match]\n\n response.body =~ service[:body_match]\n end",
"def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest::SHA256.digest(timestamped_playload)\n decoded_signature = Base64.decode64(signature)\n public_key.dsa_verify_asn1(payload_digest, decoded_signature)\n rescue StandardError\n false\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['WEBHOOK_SECRET_TOKEN'], payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend",
"def check_signature(secret)\n digest = OpenSSL::Digest::SHA256.new\n expected = OpenSSL::HMAC.hexdigest(digest, secret, @body)\n if @signature == expected\n return true\n else\n Pusher.logger.warn \"Received WebHook with invalid signature: got #{@signature}, expected #{expected}\"\n return false\n end\n end",
"def verify_signature(params = {})\n version = params[:version]\n webhook_secret = params[:webhook_secret]\n stringified_data = params[:stringified_data]\n request_timestamp = params[:request_timestamp]\n signature = params[:signature]\n\n signature_params = \"#{request_timestamp}.#{version}.#{stringified_data}\"\n digest = OpenSSL::Digest.new('sha256')\n signature_to_be_verified = OpenSSL::HMAC.hexdigest(digest, webhook_secret, signature_params)\n\n signature == signature_to_be_verified\n\n end",
"def valid_signature?(signature, data)\n generate_signature(data) == signature\n end",
"def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end",
"def valid?\n return false unless given_signature\n Relax::Query.unescape_value(correct_signature) == given_signature\n end",
"def signature_ok?\n generate_md5 == vps_signature\n end",
"def hashes_match?\n are = doc.clone\n\n digest_value = are.at('xmlns|DigestValue', xmlns: DSIG).content.strip\n\n are.at('xmlns|Signature', xmlns: DSIG).remove\n\n actual_digest = calculate_digest(are)\n\n return true if digest_value == actual_digest\n\n false\n end",
"def valid?\n # If payload does not contain the sha_sign definitely return false.\n return false unless payload.sha_sign\n\n signature == payload.sha_sign\n end",
"def signature?\n SIGNATURES.include?(@simplified.downcase)\n end",
"def valid?(other)\n self.signature === other\n end",
"def verify_signature\n return_code, response = send_command(\"verify_signature\", token)\n return_code == \"200\"\n end",
"def verify(payload, header, tolerance: nil)\n begin\n timestamp, signatures = get_timestamp_and_signatures(header)\n rescue StandardError\n raise InvalidSignature, \"Unable to extract timestamp and signatures from header\"\n end\n\n if signatures.empty?\n raise InvalidSignature, \"No signatures found with expected version #{@version}\"\n end\n\n expected_sig = generate(payload, timestamp)\n unless signatures.any? { |s| secure_compare(expected_sig, s) }\n raise InvalidSignature, \"No signatures found matching the expected signature for payload\"\n end\n\n if tolerance && timestamp < Time.now - tolerance\n raise InvalidSignature, \"Timestamp outside the tolerance zone (#{Time.at(timestamp)})\"\n end\n\n true\n end",
"def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end",
"def signature_ok?(timestamp)\n slack_signature = request.headers['X-Slack-Signature']\n signature = Slack::Utils.signature(\n SLACK_SIGNING_SECRET, timestamp, request.raw_post\n )\n\n return unless slack_signature != signature\n\n raise Unauthorized, \"ERROR: you're not Slack (wrong signature)\"\n end",
"def can_have_body?\n Methods[@method].can_have_body\n end",
"def check_signature\n signature == \"\\x2a\\x2a\\x00\\x00\"\n end",
"def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end",
"def verify_signature(signature, signed_text, base64_encoded=true)\n sig = base64_encoded ? Base64UrlSafe.decode(signature) : signature\n self.public_key.verify(OpenSSL::Digest::SHA256.new, sig, signed_text)\n end",
"def verify(key)\n plaintext = plaintext_sig(body, type, encoding, alg)\n key.public_key.verify(digest, sig, plaintext)\n rescue BadError\n false\n end",
"def signatures?\n @signatures ? true : false\n end",
"def check_signature\n signature == \"ElfChnk\\x00\"\n end",
"def check(params)\n params = params.dup\n\n signature = params.delete('sig')\n\n ::JWT::SecurityUtils.secure_compare(signature, digest(params))\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n end",
"def valid_signature?(params)\n (Time.at(params['ts'].to_i) > 30.minutes.ago) &&\n params['sig'] == signed_request_params(params['ts'])['sig']\n end",
"def accepts(summary)\n summary.signature == summaries.first.signature\n end",
"def has_body?\n @body\n end",
"def receive_verify_post(params, request)\n if request.post?\n [:action, :email, :send_id, :sig].each { |key| return false unless params.has_key?(key) }\n\n return false unless params[:action] == :verify\n\n sig = params[:sig]\n params.delete(:sig)\n return false unless sig == TriggermailClient.get_signature_hash(params, @secret)\n\n _send = self.get_send(params[:send_id])\n return false unless _send.has_key?(:email)\n\n return false unless _send[:email] == params[:email]\n\n return true\n else\n return false\n end\n end",
"def must_have_body?\n Methods[@method].must_have_body\n end",
"def signed?\n !signature.nil?\n end",
"def signature_is_valid?\n node = @ar.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize\n\n signature = @ar.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def verify_signature(result); end",
"def valid? headers, params\n timestamp = get_timestamp headers\n\n message = create_message params[\"token\"], params[\"trx_id\"], params[\"monto\"], timestamp\n authorization = Authorization.new(@env)\n signature = authorization.sign(message)\n signature == pp_signature(headers)\n\n end",
"def validate_update(body, headers)\n unless @secret\n raise AppSecretNotDefinedError, \"You must init RealtimeUpdates with your app secret in order to validate updates\"\n end\n\n request_signature = headers['X-Hub-Signature'] || headers['HTTP_X_HUB_SIGNATURE']\n return unless request_signature\n\n signature_parts = request_signature.split(\"sha1=\")\n request_signature = signature_parts[1]\n calculated_signature = OpenSSL::HMAC.hexdigest('sha1', @secret, body)\n calculated_signature == request_signature\n end",
"def correct_signature?\n client = RestClient.where(:api_key => @api_key).first\n sign=client.nil? ? \"\" : client.secret + @request_uri.gsub(/\\?.*/,\"\")+@timestamp\n calculated_sign= (Digest::SHA256.new << sign).to_s\n Digest::SHA1.hexdigest(@signature)==Digest::SHA1.hexdigest(calculated_sign)\n end",
"def validrequest?(req)\n digest = makehash(req[:body])\n \n if digest == req[:hash]\n @stats[:validated] += 1\n \n return true\n else\n @stats[:unvalidated] += 1\n \n raise(\"Received an invalid signature in message\")\n end\n end",
"def verify_signature\n @req.verify(public_key)\n end",
"def body?\n HTTY::Request::METHODS_SENDING_BODY.include? method\n end",
"def is_signature_valid?\n @params['ps'] == generate_preview_signature\n end",
"def verify_signature(signature, string, base64=false)\n signature = base64_decode(signature) if base64\n\n @public_key.verify(OpenSSL::Digest.new(\"SHA1\"), signature, string)\n end",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_GEOTIX_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, \"#{auth_token}#{@payload_raw}\")\n halt [401, \"Signatures don't match.\"] unless their_digest == our_digest\n end",
"def ==(other)\n return false unless other.is_a?(Signature)\n r == other.r && s == other.s\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end",
"def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end",
"def hashes_match?\n ar = @ar.clone\n\n digest_value = ar.at_css(\n 'xmlns|DigestValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content.strip\n\n ar.at_css(\n \"xmlns|Signature\",\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).remove\n\n actual_digest = calculate_digest(ar)\n\n if digest_value == actual_digest\n true\n else\n false\n end\n end",
"def verifySignature _args\n \"verifySignature _args;\" \n end",
"def _compute_signature(body)\n timestamp = self.class._get_timestamp\n nonce = self.class._get_nonce\n\n # Compute signature: HMAC[SHA256]_{secret} (key | timestamp | seq | nonce | body) => signature\n hm = OpenSSL::HMAC.new(self.secret, OpenSSL::Digest::SHA256.new)\n hm << self.key\n hm << timestamp\n hm << self.sequence.to_s\n hm << nonce.to_s\n hm << body\n signature = Base64.urlsafe_encode64(hm.digest)\n\n return signature, nonce, timestamp\n end",
"def check_for_signature\n if signature_file_name_changed?\n sign if signature.present?\n end\n true\n end",
"def verify_params(params)\n return false if params['Body'].to_s.empty?\n return false if params['Body'].to_s.bytes.size > 1600\n return false unless /\\+\\d+$/.match(params['To'])\n true\n end",
"def verify_signature(cleartext, signature_string)\n cmd_output = run_verify(cleartext, signature_string)\n cmd_result = analyse_verify_output(*cmd_output)\n\n if cmd_result[:well_formed_pgp_data]\n match_constraints(**cmd_result)\n else\n msg_no_pgg_data(signature_string)\n end\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end",
"def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end",
"def signed?\n # Fail immediately if the request is not signed at all\n return false unless oauth_request? and authenticating_client\n # mash and compare with given signature\n self.signature == build_signature\n end",
"def authenticate?(params)\n user = get_user(params['AWSAccessKeyId'])\n return false if !user\n \n signature_params = params.reject { |key,value| \n key=='Signature' or key=='file' }\n\n signature = AWS.encode(\n user[:password], \n AWS.canonical_string(signature_params, @server_host),\n false)\n \n return params['Signature']==signature\n end",
"def verify_signatures?; end",
"def matches?\n return @block.call(@actual) if @block\n\n false\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end",
"def valid_signature? signature\n # We create a new XML document in Nokogiri to canonicalize the\n # signature. Nokogiri needs the xmlns:ds tag on the root element to\n # preserve the 'ds:' namespace on all the elements. Not exactly sure\n # why this is needed, but it works if we do it.\n info = signature.find_first('.//ds:SignedInfo', DS)\n\n canon = LibXML::XML::Document.new\n canon.root = canon.import info\n canonicalized = canon.canonicalize\n\n b64_sig = signature.find_first('.//ds:SignatureValue', DS).content\n dec_sig = Base64.decode64 b64_sig\n\n b64_cert = signature.find_first('.//ds:X509Certificate', DS).content\n cert = OpenSSL::X509::Certificate.new(Base64.decode64(b64_cert))\n\n digest = OpenSSL::Digest::SHA1.new\n cert.public_key.verify(digest, dec_sig, canonicalized)\n end",
"def verify_ecdsa_signature(signature, hash)\n BTC::OpenSSL.ecdsa_verify(signature, hash, self.public_key)\n end",
"def signature_valid?; end",
"def verify!(ha)\n passed_signature = ha[:sig] || ha[\"sig\"]\n raise Tampered, \"No signature given\" unless passed_signature\n raise Tampered, \"Checksum differs\" unless compute_checksum(ha) == passed_signature.to_s\n true\n end",
"def validate_signature(test_doc = nil)\n test_doc ||= @prepared_doc\n\n doc_signature = get_document_tag :esigncode, from: test_doc\n doc_salt = get_document_tag :esignuniquecode, from: test_doc\n validate_prepared_doc_digest test_doc\n\n new_pdd = prepared_doc_digest(from: test_doc)\n new_signature = Hashing.sign_with(doc_salt, new_pdd)\n raise ESignatureUserError, 'Document signature is invalid' unless doc_signature == new_signature\n\n true\n end",
"def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end",
"def compare_keys_and_content(body_json, response_body)\n response_json = JSON.parse(response_body)\n if body_json == response_json\n true\n else\n @error_message = diff_message(body_json, response_json)\n false\n end\n end",
"def verified? key\n Nelumba::Crypto.emsa_verify(@plaintext, @signature, key)\n end",
"def matches_regex?(regex)\n @message[:body].to_s.match(regex)\n end",
"def body_allowed?\n @status.allows_body? && @request_method.allows_body?\n end",
"def check_signature\n signature == \"ElfFile\\x00\"\n end",
"def secure?\n self.generated_signature == self.signature\n end",
"def body_contains\n return @body_contains\n end",
"def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signature = CGI.unescape(token[/&HMACSHA256=(.*)$/, 1])\n bare_token = token.gsub(/&HMACSHA256=(.*)$/, '')\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(shared_secret)).update(bare_token.toutf8).digest).strip\n return original_signature == signature\n end",
"def body_has_meaningful_content?(body_elt)\n body_elt && body_elt.to_s != \"<body><p></p></body>\"\n end",
"def body?\n !body.empty?\n end",
"def verify_signature\n @spki.verify(public_key)\n end",
"def safe_equals?(signature, other_signature)\n check = signature.bytesize ^ other_signature.bytesize\n signature.bytes.zip(other_signature.bytes) { |x, y| check |= x ^ y.to_i }\n check.zero?\n end",
"def verify_compact_signature(signature, hash)\n raise BTCError, \"Not implemented\"\n end",
"def validate_signature(doc, certificate, canonicalization_method)\n node = doc.at('xmlns|SignedInfo', xmlns: DSIG)\n\n return false unless node\n\n node = case canonicalization_method\n when :normal\n node.canonicalize\n when :exclusive\n canonicalize_exclusively node\n end\n\n signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content\n signature = decode(signature)\n\n # Return true or false\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def check_signature!\n request.body.rewind\n payload_raw = request.body.read # We need the raw text of the body to check the webhook signature\n begin\n @payload = JSON.parse payload_raw\n rescue\n @payload = {}\n end\n\n # Check X-Hub-Signature to confirm that this webhook was generated by GitHub, and not a malicious third party.\n # The way this works is: We have registered with GitHub a secret, and we have stored it locally in WEBHOOK_SECRET.\n # GitHub will cryptographically sign the request payload with this secret. We will do the same, and if the results\n # match, then we know that the request is from GitHub (or, at least, from someone who knows the secret!)\n # If they don't match, this request is an attack, and we should reject it.\n # The signature comes in with header x-hub-signature, and looks like \"sha1=123456\"\n # We should take the left hand side as the signature method, and the right hand side as the\n # HMAC digest (the signature) itself.\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, payload_raw)\n halt 401 unless their_digest == our_digest\n @payload\n end",
"def verify_signature(signature, bytes, signer_public_key)\n signature = Validation.check_filled_array_argument!(signature)\n bytes = Validation.check_filled_array_argument!(bytes)\n signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key)\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512)\n signer = Core::VirgilSigner.new(native_algorithm)\n signer.verify(bytes, signature, signer_public_key.raw_key)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n\n end",
"def _verify\n unless (@_headers['x-allopass-response-signature'] || []).include?(@_signature)\n raise Allorails::ApiFalseResponseSignatureError\n end\n end",
"def intact?\n @signature.md5 == Digest::MD5.digest(@content)\n end",
"def validrequest?(req)\n message = req[:body]\n signature = req[:hash]\n\n Log.debug(\"Validating request from #{req[:callerid]}\")\n\n if verify(public_key_file(req[:callerid]), signature, message.to_s)\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end",
"def body?\n\t\t\t\t\t@body and !@body.empty?\n\t\t\t\tend",
"def validrequest?(req)\n ssl = SSL.new(\"/home/rip/.mcollective.d/rip.pem\")\n\n ssl.verify_signature(req[:hash], SSL.md5(req[:body]), true)\n\n req[:callerid] = \"webuser=%s\" % ssl.rsa_decrypt_with_public(ssl.base64_decode(req[:callerid]))\n req[:body] = deserialize(req[:body])\n\n @stats.validated\n\n true\n rescue\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end",
"def valid_hashes? signature\n refs = signature.find('.//ds:Reference', DS).map{ |r| r['URI'][1..-1] }\n\n without_signature = LibXML::XML::Document.document(signature.doc)\n without_signature.find_first('//ds:Signature', DS).remove!\n # The XML digested must be canonicalized as per the W3's specification\n # at http://www.w3.org/TR/xml-c14n\n c14n = without_signature.canonicalize\n digest = Base64.encode64(Digest::SHA1.digest(c14n)).chomp\n\n refs.all? do |ref|\n hashed_element = @doc.find_first(\"//*[ID='#{ref}']\")\n digest_listed = signature.find_first('.//ds:DigestValue', DS).content\n\n digest == digest_listed\n end\n end",
"def verify_signature(url, params)\n submit VerifySignature.new(:url_end_point => url, :http_parameters => params)\n end"
] | [
"0.7437906",
"0.712865",
"0.7121173",
"0.692363",
"0.6910715",
"0.6827787",
"0.6827674",
"0.6740603",
"0.6598621",
"0.6550687",
"0.64843714",
"0.6434735",
"0.6434735",
"0.6426174",
"0.64208806",
"0.63046473",
"0.6290229",
"0.6231722",
"0.6198167",
"0.6130173",
"0.60319704",
"0.60152715",
"0.5983405",
"0.597674",
"0.59689057",
"0.59620845",
"0.59570867",
"0.59527755",
"0.5942593",
"0.5942508",
"0.59381",
"0.58926284",
"0.5854706",
"0.5853153",
"0.58397907",
"0.58262604",
"0.58231914",
"0.5798294",
"0.5789558",
"0.5788512",
"0.5773994",
"0.57620347",
"0.5745153",
"0.57242256",
"0.5723868",
"0.57235587",
"0.57037973",
"0.5675022",
"0.567232",
"0.56690353",
"0.5660665",
"0.5652432",
"0.56478447",
"0.56473875",
"0.56254464",
"0.56251556",
"0.55992776",
"0.5599063",
"0.5576241",
"0.55678034",
"0.55526674",
"0.55509895",
"0.5547135",
"0.5508253",
"0.5503563",
"0.5496382",
"0.5488341",
"0.5482742",
"0.5480254",
"0.5472425",
"0.5463144",
"0.54379654",
"0.54179955",
"0.5417318",
"0.5405136",
"0.53941315",
"0.5392789",
"0.53908044",
"0.53878593",
"0.5383664",
"0.5376215",
"0.53731006",
"0.5364905",
"0.53608614",
"0.53526825",
"0.53457475",
"0.5345675",
"0.53412455",
"0.5329798",
"0.53297025",
"0.5325753",
"0.53128505",
"0.5311718",
"0.5286134",
"0.52833825",
"0.52804023",
"0.52728623",
"0.5270326",
"0.52621186",
"0.5214944"
] | 0.7715647 | 0 |
Gives the content of a challenge response given the challenge body. | def challenge_response(challenge_code)
{
:body => challenge_code,
:status => 200
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenge\n @challenge = decode_challenge\n respond\n end",
"def response\n get_header_and_body\n end",
"def challenge(_request, _response)\n end",
"def challenge!\n response_headers = { \"WWW-Authenticate\" => %(Basic realm=\"My Application\"), 'Content-Type' => 'text/plain' }\n response_headers['X-WHATEVER'] = \"some other value\"\n body = \"401 Unauthorized\"\n response = Rack::Response.new(body, 401, response_headers)\n custom! response.finish\n end",
"def body\n @response.body if success?\n end",
"def response_body\n @response[:body]\n end",
"def respond_to_challenge(request, response)\n authenticate_header = response['www-authenticate'].downcase\n authenticate_header.sub!(/^digest /, '')\n\n @authentication_params = authenticate_header.split(\", \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value.gsub(/^\"|\"$/, '') # strip quotes.\n \n h\n }\n add_cookies!(request)\n authenticate_request!(request)\n request.each{|k,v| puts \"#{k}: #{v}\" }\n # Resend the request\n @client.request(request)\n end",
"def body\n response.body\n end",
"def get_challenge\n @ruby\n @done\n end",
"def response\n lines = []\n lines << \"HTTP/1.1 101 Switching Protocols\"\n lines += response_headers.map { |header| header.join(\": \") }\n lines << \"\"\n lines << \"\"\n lines.join(CRLF)\n end",
"def get_challenge\n result = @client.call(\"LJ.XMLRPC.getchallenge\")\n challenge = result[\"challenge\"]\n response = MD5.md5(challenge + @password).to_s\n\n @paramhash[\"auth_challenge\"] = challenge\n @paramhash[\"auth_response\"] = response\n end",
"def contents\n response ? response.read_body : nil\n end",
"def handle_response(response)\n response.body if response.success?\n end",
"def body\n response&.body.to_s\n end",
"def challenge\n $challenge = Challenge.new()\n yield\nend",
"def response_body; end",
"def response_body; end",
"def get_response(request)\n socket = TCPSocket.open(@host, @port)\n socket.print(request)\n response = socket.read\n \n headers, body = response.split(\"\\r\\n\\r\\n\", 2)\n response_code, response_message = headers.split(\"\\r\\n\")[0].split(\" \")[1], headers.split(\"\\r\\n\")[0].split(\" \")[2..-1].join(\" \")\n if response_code =~ /^2\\d\\d/\n print body # And display it\n else\n puts \"#{response_code} #{response_message}\"\n end\n end",
"def response\n @content_data.string[0..-3]\n end",
"def body\n @response.body\n end",
"def body\n @response.body\n end",
"def respond_to_challenge(params)\n challenge_name = params[:challenge_name]\n username = params[:challenge_parameters]['USER_ID_FOR_SRP'] || params[:email]\n challenge_responses = { \"USERNAME\": username }\n case challenge_name\n when 'NEW_PASSWORD_REQUIRED'\n challenge_responses.merge!(\"NEW_PASSWORD\": params[:new_password])\n send_challenge(session: params[:cognito_session_id], challenge_name: challenge_name, challenge_responses: challenge_responses)\n when 'SMS_MFA', 'SOFTWARE_TOKEN_MFA'\n software_token_mfa_response(params, challenge_name, challenge_responses)\n when 'MFA_SETUP'\n mfa_setup_response(params, challenge_name, challenge_responses)\n else\n raise AuthenticationBackendException, \"Unknown challenge_name returned by cognito. Challenge name returned: #{challenge_name}\"\n end\n rescue Aws::CognitoIdentityProvider::Errors::EnableSoftwareTokenMFAException,\n Aws::CognitoIdentityProvider::Errors::InvalidPasswordException => e\n response_hash(params, e)\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException,\n Aws::CognitoIdentityProvider::Errors::CodeMismatchException => e\n raise NotAuthorizedException, e\n end",
"def challenge; end",
"def challenge(req, res)\n res[@response_field] = \"#{@auth_scheme} realm=\\\"#{@realm}\\\"\"\n raise @auth_exception\n end",
"def body\n response.body || ''\n end",
"def challenge\n 'Basic realm=\"%s\"' % realm\n end",
"def challenge\n # Use the request path (which we know) that includes the unknown challenge file name. We remove the leading '/' to get a relative path.\n render file: Rails.public_path.join(request.path[1..-1]), layout: false\n end",
"def body\n @body ||= begin\n begin\n io = Java.java_to_ruby(\n org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object\n )\n io.read\n rescue Exception => e\n puts \"Error in Response#body: #{e.message}\"\n end\n end\n end",
"def response_body(uri)\n req = Net::HTTP::Get.new(uri)\n req.basic_auth(@username, @password)\n resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n JSON.parse resp.body\n end",
"def content\n part.response\n end",
"def content\n part.response\n end",
"def content_from_response(response)\n body = JSON.parse(response.body)\n \n case body['code']\n when 'success' then body['content']\n when 'validation_error' then raise( ValidationError, body['content'] )\n else; false # System error on SnapSearch; Nothing we can do # TODO: Raise exception?\n end\n end",
"def body\n response.body.to_s\n end",
"def response(env)\n response = Colloquy::Response.new\n\n begin\n parameters = {}\n parameters = validate_request(env)\n parameters = sanitize_parameters(parameters)\n logger.debug \"REQUEST flow: #{parameters[:flow_name]}, msisdn: #{parameters[:msisdn]}, \\\n session_id: #{parameters[:session_id]}, input: #{parameters[:input]}, other: #{parameters[:params].inspect}\"\n rescue Exception => e\n logger.error \"Exception #{e.inspect} when trying to validate request flow: #{parameters[:flow_name]}, \\\n msisdn: #{parameters[:msisdn]}, session_id: #{parameters[:session_id]}, input: #{parameters[:input]}\"\n logger.debug \"#{e.backtrace.inspect}\"\n logger.info 'Responding with default error message'\n\n response = Colloquy::Response.new(Colloquy::Renderer::DEFAULT_ERROR_MESSAGE)\n response.flow_state = :notify\n end\n\n response = @renderer.apply(parameters[:flow_name], parameters[:msisdn], parameters[:session_id], parameters[:input], parameters[:params]) if response.empty?\n\n body = case parameters[:params][:accept]\n when 'text/plain'\n response.to_s\n else\n Yajl.dump({ response: response, flow_state: response.flow_state })\n end\n\n [200, {}, body]\n end",
"def get_challenge(error='', options={})\n s=''\n if options[:options]\n s << \"<script type=\\\"text/javascript\\\">\\nvar RecaptchaOptions = { \"\n options[:options].each do |k,v|\n val = (v.class == Fixnum) ? \"#{v}\" : \"\\\"#{v}\\\"\"\n s << \"#{k} : #{val}, \"\n end\n s.sub!(/, $/, '};')\n s << \"\\n</script>\\n\"\n end\n errslug = (error.empty?||error==nil||error==\"success\") ? '' : \"&error=#{CGI.escape(error)}\"\n s <<<<-EOF\n <script type=\"text/javascript\" src=\"#{@proto}://#{@host}/challenge?k=#{CGI.escape(@pubkey)}#{errslug}\"> </script>\n <noscript>\n <iframe src=\"#{@proto}://#{@host}/noscript?k=#{CGI.escape(@pubkey)}#{errslug}\"\n height=\"300\" width=\"500\" frameborder=\"0\"></iframe><br>\n <textarea name=\"recaptcha_challenge_field\" rows=\"3\" cols=\"40\">\n </textarea>\n <input type=\"hidden\" name=\"recaptcha_response_field\"\n value=\"manual_challenge\">\n </noscript>\n EOF\n s.html_safe\n end",
"def raw_body\n @response.body\n end",
"def get_http_content\n uri.query = URI.encode_www_form(params)\n res = Net::HTTP.get_response(uri)\n\n raise HTTPError.new(\"invalid #{res.code} response\") unless res.is_a?(Net::HTTPSuccess)\n\n puts res.code\n res.body\n end",
"def body\n @raw.split(header)[1]\n end",
"def challenge_get(credential)\n _post(\"/challenge\", {\"nuid/credential\" => credential})\n end",
"def content\n @content ||= body.split(/\\r?\\n/, 2)\n end",
"def getchallenge\n result = self.call('LJ.XMLRPC.getchallenge')\n challenge = result['challenge']\n digest = Digest::MD5.new\n digest << challenge\n digest << Digest::MD5.hexdigest(@password)\n [challenge, digest.hexdigest]\n rescue XMLRPC::FaultException => e\n raise LjException.new(e.faultCode, e.faultString)\n end",
"def response_body(response)\n case response\n when Net::HTTPSuccess\n return JSON.parse(response.body)[0]['translations'][0]['text']\n when Net::HTTPUnauthorized\n msg = 'invalid API key?'\n when Net::HTTPServerError\n msg = 'try again later?'\n end\n @progress.logMessage(\"ERROR: #{response.message}\")\n @progress.logMessage(msg) unless msg.nil?\n end",
"def respond_to_challenge(params)\n challenge_name = params[:challenge_name]\n case challenge_name\n when 'NEW_PASSWORD_REQUIRED'\n challenge_responses = {\n \"USERNAME\": params[:challenge_parameters]['USER_ID_FOR_SRP'],\n \"NEW_PASSWORD\": params[:new_password]\n }\n when 'SOFTWARE_TOKEN_MFA'\n challenge_responses = {\n \"USERNAME\": params[:challenge_parameters]['USER_ID_FOR_SRP'],\n \"SOFTWARE_TOKEN_MFA_CODE\": params[:totp_code]\n }\n else\n raise AuthenticationBackendException.new(\"Unknown challenge_name returned by cognito. Challenge name returned: #{challenge_name}\")\n end\n client.respond_to_auth_challenge(\n client_id: cognito_client_id,\n session: params[:cognito_session_id],\n challenge_name: challenge_name,\n challenge_responses: challenge_responses\n )\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException,\n Aws::CognitoIdentityProvider::Errors::CodeMismatchException => e\n raise NotAuthorizedException.new(e.message)\n end",
"def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end",
"def challenge(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n auth.require_login\n end",
"def response\n @reponse ||= website_overview_builder.response\n rescue => e\n Rails.logger.error(e)\n nil\n end",
"def read_response(command)\n header = read_data\n check_rpc_error!(header)\n if COMMANDS[command].include?(:body)\n body = read_data\n Response.new(header, body)\n else\n Response.new(header)\n end\n end",
"def content\n @content ||= parts.map(&:response).join(\"\\n\")\n end",
"def response\n response = typhoeus_response\n ErrorHandler.precheck(response)\n parsed_body = MultiJson.load(response.body, JSON_OPTIONS)\n ErrorHandler.check(parsed_body.fetch(:meta))\n\n if @block\n @block.call(parsed_body)\n else\n parsed_body\n end\n rescue MultiJson::ParseError => e\n logger = Logger.new($stdout)\n logger.error(\"#{e.class}: #{e.message}\")\n\n if response\n logger.error('Response body:')\n logger.error(response.body.inspect)\n end\n\n raise Error::InternalError, 'AfterShip internal error, please try again.'\n end",
"def raw_response\n Net::HTTP.get(endpoint)\n end",
"def read_response(req, body = nil, &block) # :yield: +response+\n begin\n res = HTTPResponse.read_new(@socket)\n end while res.kind_of?(HTTPContinue)\n res.reading_body(@socket, req.response_body_permitted?) {\n yield res if block_given?\n }\n end_transport req, res\n\n res\n end",
"def body_of(response)\n json_response = response.respond_to?(:body) ? response.body : response\n format_to(json_response)\n end",
"def response\n http = Net::HTTP.new(@options[:url], 443)\n http.use_ssl = true\n path = '/nvp'\n headers = {\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n\n # dryrun support, provides a 204 which is success without content\n return ResponseHandler.new(\n Net::HTTPNoContent.new(true, true,true)\n ) if dryrun?\n\n # request caching\n silence_warnings do\n return @cached_response if @cached_response\n resp, data = http.post(path, request_string, headers)\n @cached_response = ResponseHandler.new(resp, data)\n end\n end",
"def response_from_rule(rule)\n body = rule.response.dig(\"body\") || \"\"\n status = rule.response.dig(\"status\") || 200\n header = rule.response.dig(\"header\") || {}\n Rack::Response.new(body, status, header)\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end",
"def get_response_body\n uri = URI.parse(@url)\n response = Net::HTTP.get_response(uri)\n response.body\n end",
"def prepare_response(status, headers, body)\n status_reason_phrase = STATUS_REASON_PHRASES[status]\n header_lines = headers.map { |key, value| \"#{key}: #{value}\" }\n <<~EOF\n HTTP/1.1 #{status} #{status_reason_phrase}\n #{header_lines.join(\"\\n\")}\n\n #{body}\n EOF\n end",
"def command(request)\n @request = request\n @challenge_id = nil\n\n establish_connection\n\n @socket.print \"\\xFF\" * 4 + \"challenge rcon\\n\\x00\"\n \n tmp = retrieve_socket_data\n challenge_id = /challenge rcon (\\d+)/.match tmp\n if challenge_id\n @challenge_id = challenge_id[1]\n end\n\n if @challenge_id.nil?\n raise RCon::NetworkException.new(\"RCon challenge ID never returned: wrong rcon password?\")\n end\n\n @socket.print \"\\xFF\" * 4 + \"rcon #{@challenge_id} \\\"#{@password}\\\" #{@request}\\n\\x00\"\n @response = retrieve_socket_data\n @response.force_encoding('binary')\n\n @response.sub! /^\\xFF\\xFF\\xFF\\xFF#{@server_type}/n, \"\"\n @response.sub! /\\x00+$/, \"\"\n \n return @response\n end",
"def body\n @http_response.body\n end",
"def structureResponse(code, codeMessage, file, contentType)\n # grab file contents\n data = getFileContents(file);\n\n # Return response\n \"HTTP/1.1 #{code}\\r\\n\" +\n \"Content-Length: #{data.size}\\r\\n\" +\n \"\\r\\n\" +\n \"#{data}\\r\\n\";\nend",
"def response_for(response_file, options = {})\n response = {}\n response[:body] = load_json(response_file)\n if options[:status]\n response[:status] = options[:status]\n end\n response\n end",
"def body_raw\n @response.body\n end",
"def response body=nil, status=nil\n return @current.response unless body\n\n response.status status || 200\n response.body body\n throw :done\n end",
"def body\n connection.get(@url.path).body\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end",
"def http_get_body(uri, credentials=nil, headers={})\n response = http_request(:get, uri, credentials, headers)\n\n ### filter body\n if response\n return response.body_utf8\n end\n\n nil\n end",
"def response\n @response\n end",
"def body(response)\n JSON.parse(response[:body])\n end",
"def get_body(env)\n Kickbox::HttpClient::ResponseHandler.get_body(env)\n end",
"def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end",
"def response(provider, fixture, action_dispatch = false)\n contents = File.read(File.expand_path(\"../fixtures/#{provider}/#{fixture}.txt\", __FILE__))\n io = StringIO.new(contents)\n socket = Net::BufferedIO.new(io)\n response = Net::HTTPResponse.read_new(socket)\n\n # `response.reading_body(socket, true) {}`, for whatever reason, fails to read\n # all of the body in files like `cloudmailin/multipart/valid.txt`.\n body = contents[/(?:\\r?\\n){2,}(.+)\\z/m, 1]\n\n # It's kind of crazy that no library has an easier way of doing this.\n if response.header['content-type']['multipart/form-data']\n body = Rack::Multipart.parse_multipart(Rack::MockRequest.env_for('/', {\n 'CONTENT_TYPE' => response.header['content-type'],\n :input => body,\n }))\n end\n\n if action_dispatch\n klass = Class.new(MultiMail::Service) do\n include MultiMail::Receiver::Base\n end\n normalize_encode_params(klass.parse(body))\n else\n body\n end\nend",
"def generic_Generate_Response(initial,headers,body)\n\ts=initial\n\ts << \"\\r\\n\" << headers # headers start in second line\n\tif body.length>0\n\t\ts << \"\\r\\n\" << body # body start after a blank line, first \\r\\n is for change line from headers, second is for blank line\n\tend\n\treturn s\nend",
"def to_rack_response\n # 'action' denotes the next action.\n case @action\n when 'INTERNAL_SERVER_ERROR'\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return to_rack_response_www_authenticate(500, @response_content)\n\n when 'BAD_REQUEST'\n # 400 Bad Request\n # The request from the client application does not\n # contain an access token.\n return to_rack_response_www_authenticate(400, @response_content)\n\n when 'UNAUTHORIZED'\n # 401 Unauthorized\n # The presented access token does not exist or has expired.\n return to_rack_response_www_authenticate(401, @response_content)\n\n when 'FORBIDDEN'\n # 403 Forbidden\n # The access token does not cover the required scopes\n # or the subject associated with the access token is\n # different.\n return to_rack_response_www_authenticate(403, @response_content)\n\n when 'OK'\n # The access token is valid (= exists and has not expired).\n # Basically, the caller won't use the array returned from here.\n # Instead, it will return the protected resource to the client\n # application which has presented the valid access token.\n return [ 200, nil, nil ]\n\n else\n # This should not happen.\n return to_rack_response_www_authenticate(500,\n 'Bearer error=\"server_error\",error_description=\"Unknown action\"')\n end\n end",
"def generate_server_challenge(&block)\n \"\\x11\\x22\\x33\\x44\\x55\\x66\\x77\\x88\"\n end",
"def response(status, headers, body = '')\n body = yield if block_given?\n [status, headers, [body]]\nend",
"def get_content(content_ref_path)\n puts \" get_content() #{@curl_get_prefix} #{content_ref_path}\" if @debug\n content_details = Jive_ruby_api.cleanse_security_string(`#{@curl_get_prefix} #{content_ref_path}`)\n content_details = JSON.parse(content_details)\n html_string = content_details['content']['text']\n\n return html_string\n\n end",
"def ok_response(body, headers = {})\n body = [body] unless body.respond_to?(:each)\n [ 200, headers, body ]\n end",
"def response; return @response end",
"def body(path)\n get(path).body\n end",
"def get_response(body)\n MO::Handler.send(:get_response, phones(:one), body)\n end",
"def response_body! body\n enum_of_body(body).each do |body_part|\n body_part = body_part.to_s\n\n # This return value works differently to all the other msc_ calls.\n # 0 means\n # body too large, so it was only partially processed;\n # or\n # body too large and and intervention is needed.\n #\n # 1 means everything went fine\n #\n # so we ignore the non-useful return code and rely on intervention! below\n Wrapper.msc_append_response_body txn_ptr, (strptr body_part), body_part.bytesize\n end\n\n # This MUST be called, otherwise rules aren't triggered\n rv = Wrapper.msc_process_response_body txn_ptr\n rv == 1 or raise Error, 'msc_process_response_body failed'\n\n intervention!\n end",
"def read_response(path, response, request)\n file_path = page_cache_path(path)\n if metadata = read_metadata(path)\n response.headers.merge!(metadata['headers'] || {})\n # if client_has_cache?(metadata, request)\n # # we need to see if this is really what we want to do. it causes issues with localization\n # # since I'm being \"smart\" and sending the same url. ugh. I might be too \"smart\" for my\n # # own good on this one\n # response.headers.merge!('Status' => '200 OK')\n if use_x_sendfile\n response.headers.merge!('X-Sendfile' => \"#{file_path}.data\")\n else\n response.body = File.open(\"#{file_path}.data\", \"rb\") {|f| f.read}\n end\n end\n response\n end",
"def get_response\n response = @raw_client.get_response\n if response\n response[1] = reader_deserialize(response.last)\n else\n raise ServerError, \"No response.\"\n end\n\n raise ServerError, \"Malformed response.\" unless response[1].is_a?Hash\n\n if response[0] == 0\n response[1][\"errors\"] ||= [\"Unknown server error.\"]\n raise ServerError, response[1][\"errors\"].join(\"\\n\")\n end\n\n response\n end",
"def generate_server_challenge(&block)\n if block.nil?\n @generate_server_challenge.call\n else\n @generate_server_challenge = block\n end\n end",
"def string_content(rack_response)\n full_content = ''\n rack_response.each{|c| full_content << c }\n full_content\n end",
"def result(body)\n begin\n ActiveSupport::JSON.decode body\n rescue => e\n {\n code: 502,\n msg: '内容解析错误',\n detail: e.to_s\n }\n end\n end",
"def download\n if verb == :get\n body = get_http_content\n elsif verb == :post\n body = post_http_content\n end\n\n body\n end",
"def response\n @response ||= JSON.parse(request.feedback.body).deep_symbolize_keys if valid_body?\n end",
"def hnl_http_get_text(uri, include_http_response = false)\n # setup the request\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n # make the request\n response = http.request(request)\n # and return the result\n return [response.body, response] if include_http_response\n response.body\n end",
"def response\n connection.send(request_method) do |req|\n req.url path\n req.headers['LicenseID'] = client.license_id\n req.headers['Host'] = client.host\n req.headers['Connection'] = 'Keep-Alive'\n req.headers['Expect'] = '100-continue'\n req.headers['Content-Type'] = 'text/xml'\n req.body = body\n end\n end",
"def content\n h @content\n end",
"def parse_response_body(body)\r\n case body\r\n when SUCCESS_REGEXP\r\n log :success, $1\r\n $1\r\n when FAILURE_REGEXP \r\n log :failure, $1.gsub(\"<BR>\", \"\\n\")\r\n nil\r\n else \r\n raise \"unparseable response: #{body}\"\r\n end\r\n end",
"def make_response(type = \"text/html\", compressed = false, code = 200, msg = \"OK\", &block)\n response = [ \"HTTP/1.1 #{code} #{msg}\" ]\n result = (block_given?) ? yield : nil\n if result then \n size = (result) ? result.bytesize : 0\n response += [ \"Content-Type: #{type}\",\n \"Content-Length: #{size}\" ]\n end\n response += [ \"Content-Encoding: gzip\" ] if compressed\n response += [ \"Connection: close\", \"\" ]\n response.push(result) if result\n return response.join(\"\\r\\n\")\n end",
"def body_text(http_resp)\n if http_resp[:nbody] > 0\n http_resp[:body].read_string(http_resp[:nbody])\n else\n ''\n end\n end",
"def get_response()\n\t\t\tdata = \"\"\n\n\t\t\twhile true\n\t\t\t\tdata += @connection.read(4)\n\n\t\t\t\tcase data[-1]\n\t\t\t\t\twhen ' '\n\t\t\t\t\t\tdata += @connection.gets(\"\\r\\n\")\n\t\t\t\t\t\tputs(\"received #{data.inspect}\") if $DEBUG\n\t\t\t\t\t\treturn data\n\n\t\t\t\t\twhen '-'\n\t\t\t\t\t\tdata += @connection.gets(\"\\r\\n\")\n\n\t\t\t\t\twhen '+'\n\t\t\t\t\t\tdata += @connection.gets(\"\\r\\n.\\r\\n\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tdata\n\t\tend",
"def response(arg, opt = {})\n usr = arg[:user]\n pwd = arg[:password]\n if usr.nil? or pwd.nil?\n raise ArgumentError, \"user and password have to be supplied\"\n end\n\n if opt[:workstation]\n ws = opt[:workstation]\n else\n ws = \"\"\n end\n\n if opt[:client_challenge]\n cc = opt[:client_challenge]\n else\n cc = rand(CONST::MAX64)\n end\n cc = Rex::Text::pack_int64le(cc) if cc.is_a?(Integer)\n opt[:client_challenge] = cc\n\n if has_flag?(:OEM) and opt[:unicode]\n usr = Rex::Text::to_ascii(usr,'utf-16le')\n pwd = Rex::Text::to_ascii(pwd,'utf-16le')\n ws = Rex::Text::to_ascii(ws,'utf-16le')\n opt[:unicode] = false\n end\n\n if has_flag?(:UNICODE) and !opt[:unicode]\n usr = Rex::Text::to_unicode(usr,'utf-16le')\n pwd = Rex::Text::to_unicode(pwd,'utf-16le')\n ws = Rex::Text::to_unicode(ws,'utf-16le')\n opt[:unicode] = true\n end\n\n tgt = self.target_name\n ti = self.target_info\n\n chal = self[:challenge].serialize\n\n if opt[:ntlmv2]\n ar = {\t:ntlmv2_hash => CRYPT::ntlmv2_hash(usr, pwd, tgt, opt),\n :challenge => chal, :target_info => ti}\n lm_res = CRYPT::lmv2_response(ar, opt)\n ntlm_res = CRYPT::ntlmv2_response(ar, opt)\n elsif has_flag?(:NTLM2_KEY)\n ar = {:ntlm_hash => CRYPT::ntlm_hash(pwd, opt), :challenge => chal}\n lm_res, ntlm_res = CRYPT::ntlm2_session(ar, opt)\n else\n lm_res = CRYPT::lm_response(pwd, chal)\n ntlm_res = CRYPT::ntlm_response(pwd, chal)\n end\n\n Type3.create({\n :lm_response => lm_res,\n :ntlm_response => ntlm_res,\n :domain => tgt,\n :user => usr,\n :workstation => ws,\n :flag => self.flag\n })\n end",
"def body\n fetch\n @body\n end",
"def get_response_body\n uri = URI.parse(@url) #parse the url being passed in with 'URI.parse'\n response = Net::HTTP.get_response(uri) # 'GET' the response of the uri with 'Net::HTTP.get_resonse' and pass in the uri variable\n response.body #return the 'body' from the 'response' variable\n end",
"def poll_response\n begin\n r = JSON.parse(content.gsub('\\\"', '\\'')).to_hash\n puts r\n return r\n rescue JSON::ParserError\n return content\n end\n end"
] | [
"0.67253035",
"0.62437975",
"0.60938525",
"0.57907385",
"0.5765408",
"0.5646408",
"0.56344783",
"0.5613111",
"0.56094533",
"0.55950004",
"0.55777925",
"0.5523152",
"0.5489182",
"0.54876626",
"0.54464895",
"0.54340017",
"0.54340017",
"0.54257554",
"0.54189813",
"0.54122823",
"0.54122823",
"0.540625",
"0.5393555",
"0.5389695",
"0.5357548",
"0.5345037",
"0.5324008",
"0.5314552",
"0.52999717",
"0.5294969",
"0.5294969",
"0.526239",
"0.52616525",
"0.5258897",
"0.5245231",
"0.52449167",
"0.5240086",
"0.5219976",
"0.5199411",
"0.5197747",
"0.5172608",
"0.51660156",
"0.51579374",
"0.5145104",
"0.5132767",
"0.51225835",
"0.5119679",
"0.5114",
"0.51066804",
"0.5103435",
"0.51023906",
"0.5095847",
"0.50953466",
"0.5092959",
"0.5092388",
"0.5088754",
"0.5084529",
"0.50772953",
"0.5076424",
"0.50739187",
"0.5068397",
"0.5064521",
"0.50616586",
"0.5056623",
"0.50563437",
"0.5045077",
"0.5042385",
"0.50383395",
"0.5034651",
"0.50338286",
"0.50261676",
"0.50250936",
"0.5021234",
"0.50199425",
"0.50157356",
"0.50143796",
"0.50021183",
"0.49991336",
"0.49981114",
"0.49980396",
"0.49863076",
"0.49845213",
"0.49818584",
"0.49787524",
"0.49774122",
"0.4975328",
"0.49721408",
"0.49707243",
"0.49641812",
"0.49629495",
"0.49614593",
"0.49561885",
"0.49536157",
"0.49530527",
"0.49497378",
"0.4946747",
"0.49371335",
"0.49318236",
"0.49286208",
"0.49235442"
] | 0.6785793 | 0 |
Get the Middle Character You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters. Examples: Kata.getMiddle("test") should return "es" Kata.getMiddle("testing") should return "t" Kata.getMiddle("middle") should return "dd" Kata.getMiddle("A") should return "A" | def get_middle(s)
if s.length.even? == true
else
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middle_word(string)\n words = string.split\n case words.size.odd?\n when true\n index = (words.size/2) \n words[index]\n when false\n \"Unable to determine middle word. An odd number of words are necessary.\"\n end\nend",
"def middle_word(string)\n words = string.split\n word_count = words.length\n mid_index = word_count / 2\n if word_count == 0\n ''\n elsif word_count.even?\n # if even number of words, return the two words across the middle.\n \"#{words[mid_index - 1]} #{words[mid_index]}\"\n else\n words[mid_index]\n end\nend",
"def middle_word(str)\n words = str.split(\" \")\n middle_word = words[words.size/2]\nend",
"def middle(str)\r\n words = str.split\r\n n = words.size\r\n case\r\n when (0..1).include?(n)\r\n return str\r\n when n.even?\r\n middle_ind = (n / 2) - 1\r\n else\r\n middle_ind = (n / 2)\r\n end\r\n words[middle_ind]\r\nend",
"def middle(string)\n words = string.split\n size = words.size\n if size < 2\n puts 'Sorry, you have to provide a string with at least 2 words'\n nil\n else\n size.even? ? middle = (size / 2) - 1 : middle = (size / 2)\n words[middle]\n end\nend",
"def middle(str)\n words = str.split\n\n if words.size == 0\n 'empty string provided'\n elsif words.size == 1\n words[0]\n elsif words.size.odd?\n words[(words.size / 2.0).floor]\n else\n words[(words.size / 2) - 1] + ' ' + words[(words.size / 2)]\n end\nend",
"def middle_word(text)\n words = text.split\n return '' if words.size <= 1\n\n words[words.size / 2]\nend",
"def get_middle(str)\n l = str.length\n return str.chars[l / 2] if l.odd?\n\n str.chars[l / 2 - 1] + str.chars[l / 2]\nend",
"def get_middle(string)\n if string.length.even?\n return string[string.length/2-1] + string[string.length/2]\n else\n return string[string.length/2]\n end\nend",
"def middle_character(string)\n array = string.split('')\n middle_char = ''\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n middle_char << array[middle_index]\n else\n middle_char << array[middle_index - 1] << array[middle_index]\n end\n middle_char\nend",
"def get_middle(s)\n if s.length % 2 == 0\n return \"#{s[(s.length / 2) - 1]}#{s[s.length / 2]}\"\n else\n return \"#{s[(s.length - 1) / 2]}\"\n end\nend",
"def middle_string(str)\n mid = str.length / 2\n if str.length.odd?\n return str.[mid]\n else\n return str[middle -1 ] + [str.middle]\n end\nend",
"def middle(string)\n index = string.split.size/2\n size = string.split.size\n if size == 1\n string\n elsif size.odd?\n string.split[index]\n else\n \"#{string.split[index - 1]} #{string.split[index]}\"\n end\nend",
"def get_middle(str)\n str.length.even? ? str.slice(str.length / 2 - 1, 2) : str.slice(str.length / 2)\nend",
"def middle_character(string)\n array = string.split('')\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n array.slice(middle_index)\n else\n array.slice((middle_index - 1), (middle_index)).join\n end\nend",
"def get_middle(s)\n\tif s.size.odd?\n\t\taverage_letter = s.size.div 2 #3\n\t\treturn s[average_letter]\n\telsif s.size.even?\n\t\taverage_letter = s.size.div 2\n\t\treturn s[(average_letter - 1)..average_letter]\n\tend\nend",
"def get_middle(s)\n count = s.length\n count % 2 == 0 ? s[count/2-1..count/2] : s[count/2]\nend",
"def middle_of(sentence)\n return \"\" if sentence == \"\"\n words = sentence.split\n if words.size % 2 == 0 \n words[words.size/2-1] + \" \" + words[words.size/2]\n else\n words[words.size/2]\n end\nend",
"def get_middle(s)\n mid = (s.length - 1) / 2\n s.length.odd? ? s[mid] : s[mid..mid+1]\nend",
"def get_middle(s)\n mid = (s.length - 1) / 2\n s.length.odd? ? s[mid] : s[mid..mid+1]\nend",
"def get_middle(s)\n if s.length % 2 == 0\n s[s.length/2-1] + s[s.length/2]\n else\n s[s.length/2]\n end\nend",
"def get_middle(s)\r\n s.length.odd? ? s[s.length / 2] : s[s.length / 2 - 1] + s[s.length / 2]\r\nend",
"def get_middle(s)\nreturn s.length % 2 == 0 ? s[s.length / 2 - 1] + s[s.length / 2] : s[(s.length / 2).floor]\n\nend",
"def get_middle(s)\n s.length.even? ? s[s.length/2 -1] + s[s.length/2] : s[s.length/2]\nend",
"def get_middle(s)\n len = s.length\n return s if len == 1\n\n half = len / 2\n return s[half - 1..half] if len % 2 == 0\n\n s[half]\nend",
"def middle_substring(str)\n length = str.length\n if length.odd?\n str[length/2]\n else\n str[length/2-1,2]\n end\nend",
"def get_middle(string)\n half, remainder = string.size.divmod(2)\n middle = (half + remainder) - 1\n string.size.even? ? string[middle..(middle + 1)] : string[middle]\nend",
"def get_middle(s)\n s.length.even? ? s[s.length/2 - 1] + s[s.length/2] : s[s.length/2]\nend",
"def middle_word(string)\n words = string.split(' ')\n size = words.size\n if size == 0\n \"Invalid input! Empty string!\"\n elsif size.even?\n \"Invalid input! Even number of words in sentance!\"\n elsif size == 1\n \"Invalid input! Only one word in the string!\"\n else\n words[-(size/2)-1]\n end\nend",
"def middle_word(string)\n if (string.is_a? String) == false || string.empty? || (string.split.size == 1)\n puts 'You did not enter a valid String, please try again'\n elsif string.split.size.even?\n puts \"Your string doesn't have a middle word, it's an even amount of words\"\n else\n words = string.split\n words[words.size / 2]\n end\nend",
"def get_middle(s)\n if (s.length.odd?)\n return (s[(s.length / 2).ceil])\n else\n return (s[(s.length / 2) - 1] + s[(s.length/2)])\n end\nend",
"def get_middle(s)\n return s if s.size == 1 || s.size == 2\n get_middle(s[1..-2])\nend",
"def middle_substring(str)\r\n # your code goes here\r\n x = str.length\r\n if x % 2 == 1\r\n return str[x/2]\r\n else\r\n str[x/2 - 1] + str[x/2]\r\n end\r\nend",
"def middle_substring(str)\n mid = str.length/2\n if str.length%2==0\n return str[mid-1..mid]\n else\n return str[mid]\n end\nend",
"def center_of(string)\n if string.size.odd?\n middle_character = string[string.size / 2]\n else\n middle_characters = string[string.size / 2 - 1, 2]\n end\nend",
"def middle_substring(str)\n mid = str.length / 2\n str.length.odd? ? str[mid] : str[mid - 1] + str[mid]\nend",
"def middle_substring(str)\n mid = str.length / 2\n str.length.odd? ? str[mid] : str[mid-1..mid]\nend",
"def middle_substring(str)\n mid = str.length / 2\n str.length.even? ? str[mid-1..mid] : str[mid]\nend",
"def get_middle(s)\n (s.size.odd?) ? s[(s.size / 2)] : s[(s.size - 1) / 2, 2]\nend",
"def middle_substring(str)\n output_str = ''\n\n if str.length % 2 == 1\n odd_i = str.length / 2\n output_str += str[odd_i]\n else\n even_i1 = str.length / 2 - 1\n even_i2 = (str.length / 2)\n\n output_str += str[even_i1]\n output_str += str[even_i2]\n end\n\n output_str\nend",
"def middle(string)\n\ta=string.size/2\n\treturn string[a-1]<<string[a] if string.size.even?\n\tstring[a]\n\t\nend",
"def middle_substring(str)\n median = (str.size / 2)\n str.length.even? ? str[(median - 1)..median] : str[median]\nend",
"def middle_substring(str)\n middle_left = str.length / 2\n middle_right = middle_left - 1\n if str.length % 2 == 0\n return \"#{str[middle_right]}#{str[middle_left]}\"\n else\n return \"#{str[middle_left]}\"\n end\nend",
"def center_of(string)\n str_length = string.size\n middle = \"\"\n \n return string if str_length < 3\n \n if str_length.odd?\n middle = string[str_length / 2, 1]\n else\n middle = string[(str_length / 2) - 1, 2]\n end\n \n middle\nend",
"def middle_two(str)\n mid = str.length / 2\n str[mid - 1...mid + 1]\n end",
"def middle_name\n name.split[1..-2].join(' ')\n end",
"def middle_substring(str)\n return str[str.length/2] if str.length % 2 != 0\n str[str.length/2-1] + str[str.length/2]\nend",
"def middle_substring(str)\n n = str.length / 2\n if str.length % 2 == 0\n str[(n-1)..(n)]\n else\n str[n]\n end\nend",
"def find_middle_value\r\n middle_index = self.length/2\r\n return get_at_index(middle_index)\r\n end",
"def middle_sign(string)\n\n a_string = string.chars\n\n if a_string.length % 2 == 0\n middle = [a_string[a_string.length / 2], a_string[a_string.length / 2 - 1]].join\n else\n middle = a_string[a_string.length / 2]\n end\n\nmiddle\nend",
"def middle\n termarray = [@major.subject.label, @major.predicate.label, @minor.subject.label, @minor.predicate.label]\n middle = nil\n if self.three_term?\n termarray.detect do |term|\n if termarray.count(term) == 2\n middle = Term.new(term)\n end\n end\n else\n middle = \"Error: this is not a three term syllogism\"\n end\n middle\n end",
"def middle_sign(words)\n length_words = words.size\n if length_words.odd?\n words[length_words / 2]\n else\n words[length_words / 2 - 1..length_words / 2]\n end\nend",
"def get_middle(s)\n s[(s.size - 1) / 2..s.size / 2] # s.size / 2 will round down == .floor\nend",
"def center_of(str)\n middle = (str.length/2)\n if str.length.odd?\n str[middle]\n else\n str[(middle-1)..middle]\n end\nend",
"def center_of(string)\n middle_index = string.size / 2\n\n if string.size.odd?\n string[middle_index]\n else\n string[middle_index - 1] + string[middle_index]\n end\nend",
"def center_of(string)\n middle = string.size / 2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend",
"def middle\n len = self.size\n return nil if len.zero?\n div = len.div(2)\n if len.modulo(2).zero?\n [self[div-1],self[div]] \n else\n self[div]\n end\n end",
"def center_of(string)\n middle = string.size/2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend",
"def center_of(string)\n middle = string.length / 2\n string.length.even? ? string.slice(middle - 1, 2) : string.slice(middle)\nend",
"def middle_substring(str)\n\ta = str.chars\n\twhile (a.length >= 3)\n\t\ta.pop\n\t\ta.shift\n\tend\n\ta.join\nend",
"def middle\n middle = members.length/2;\n end",
"def middle_name\n self[:MiddleInitial]\n end",
"def center_of(string)\n middle = string.size / 2\n return string[middle] if string.size % 2 == 1\n string[middle - 1..middle] if string.size % 2 == 0\nend",
"def center_of(string)\n index = string.size/2\n if string.size.odd?\n string[index]\n else\n string[index - 1, 2]\n end\nend",
"def center_of(str)\n middle_range = (str.length/2 -1..str.length/2 )\n middle_index = str.length / 2\n index = str.length.odd? ? middle_index : middle_range\n str[index]\nend",
"def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index - 1, 2]\n end\nend",
"def center_of(string)\n center = string.length / 2\n\n if string.length.odd?\n string[center]\n else\n \"#{string[center - 1]}#{string[center]}\"\n end\nend",
"def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index -1, 2]\n end\nend",
"def center_of(str)\n count = str.size\n middle = count / 2\n count.odd? ? str[middle] : str[middle-1..middle]\nend",
"def middle_node(node)\n\tlength = get_length(node,0)\n\tmid = (length%2 == 0 ? (length/2-1) : length/2)\n\t@middle = nil\n\tget_mid(node,mid)\n\t@middle\nend",
"def middle_initial\n middlename.to_s[0]\n end",
"def center_of(str)\n if str.length.odd?\n str[str.length / 2]\n else\n str[str.length / 2 - 1, 2] # this sets length of 2 char from position\n end\nend",
"def center_of(string)\n string_length = string.size\n string_center = string_length / 2\n \n if string_length.odd?\n string[string_center]\n else\n string[(string_center - 1)..string_center]\n end\nend",
"def center_of(string)\n half_size = string.size / 2\n case \n when string.size.odd? then string[half_size]\n when string.size.even? then string[half_size - 1, 2] \n end\nend",
"def center_of(str)\n mid_point = str.size / 2.0\n if str.size.odd?\n str[mid_point]\n else \n str[(mid_point - 1), 2]\n end\nend",
"def center_of(string)\n length = string.length\n\n case length % 2\n when 1 then string[length / 2]\n else string[(length /2) - 1, 2]\n end\nend",
"def center_of(string)\n if string.size.odd?\n p string[string.size / 2] # no need: string[(string.size - 1) / 2], since/2 get an integer\n else\n p string[(string.size / 2 - 1), 2]\n end\nend",
"def center_of(str)\n index = str.size / 2\n str.size.even? ? str[index - 1, 2] : str[index]\nend",
"def center_of(string)\n half = (string.length / 2) - 1\n center = string[(string.length / 2)] if string.length.odd?\n center = string[half..half+1] if string.length.even?\n center\nend",
"def center_of(str)\n midpoint = str.length / 2\n if str.length.even?\n str[midpoint - 1..midpoint]\n else\n str[midpoint]\n end\nend",
"def center_of(str)\n str.length.odd? ? str[str.length / 2] : str[(str.length / 2) - 1, 2]\nend",
"def center_of(string)\n char = ''\n if string.size.odd?\n char << string[string.size / 2]\n else\n char << string[(string.size / 2) - 1, 2]\n end\nend",
"def center_of(string)\n center = ''\n\n if string.size.even?\n center = string[string.size/2 - 1 .. string.size/2]\n else\n center = string[string.size/2]\n end\n center\nend",
"def center_of(string)\n array = string.chars\n if array.size.odd?\n array[array.length/2]\n else\n array[(array.length/2 -1)..array.length/2].join\n end \nend",
"def make_second_half(word)\n word.each_char { |c|\n if is_vowel?(c)\n i = word.index(c)\n return word.slice(i...word.length)\n end\n }\n return word\nend",
"def center_of(str)\n new_str = ''\n if str.length.odd?\n new_str = str[str.length / 2]\n else\n new_str = str[(str.length / 2) - 1] + str[str.length / 2] \n end\n p new_str\nend",
"def find_middle_value\r\n return \"empty list\" if !@head \r\n return @head.data if !@head.next \r\n\r\n # brute force: count total # nodes, then go back and get the middle\r\n # better method: set potentialWinner & currScout, move potentialWinner up by 1 and currScout up by 2 until currScout reach nil\r\n\r\n # first possible middle node requirements (must have 3 nodes) met\r\n if @head.next.next \r\n potentialWinner = @head.next \r\n currScout = @head.next.next\r\n else \r\n return \"only 2 nodes in the list\"\r\n end\r\n\r\n # traverse down SLL until end of tail is met\r\n while currScout\r\n if currScout.next \r\n if currScout.next.next \r\n currScout = currScout.next.next \r\n potentialWinner = potentialWinner.next \r\n else\r\n return \"not quite the middle, but the middle is between #{potentialWinner.data} and #{potentialWinner.next.data}\"\r\n end\r\n else \r\n # perfect middle\r\n return potentialWinner.data\r\n end\r\n end\r\n end",
"def center_of(str)\n half_point = str.size / 2 \n \n if str.size.odd?\n str[half_point]\n else\n str[half_point-1,2]\n end\nend",
"def center_of(str)\ncharacters = str.chars\naverage = characters.size / 2\nif characters.size.even?\ncharacters[average - 1] + characters[average]\nelse\ncharacters[average]\nend\nend",
"def center_of(string)\n midpoint = string.size / 2\n string.length.odd? ? string[midpoint] : string[midpoint - 1..midpoint]\nend",
"def center_of(string)\n if string.size.odd?\n index1 = string.size / 2\n elsif string.size.even?\n index1 = string.size / 2\n index2 = (string.size / 2) - 1\n end\n\n new_string = []\n string_array = string.chars\n if string.size.odd?\n new_string << string_array[index1]\n elsif string.size.even?\n new_string << string_array[index2]\n new_string << string_array[index1]\n end\n new_string.join\nend",
"def center_of(string)\n size = string.size\n mid = size / 2\n \n size.odd? ? string[mid] : string[mid - 1] + string[mid]\nend",
"def center_of(str)\n length = str.length\n center = length / 2\n if length.even?\n center_right = center\n center_left = center - 1\n str[center_left .. center_right]\n else\n str[center]\n end\nend",
"def center_of(str)\n str.chars.size.odd? ? str.slice(str.chars.length/2, 1) : str.slice(str.chars.length/2-1, 2)\nend",
"def center_of(str)\n working_arr = str.chars\n if working_arr.size.odd?\n working_arr[working_arr.size / 2]\n elsif working_arr.size.even?\n (working_arr[working_arr.size / 2 - 1]) +\n (working_arr[working_arr.size / 2])\n end\nend",
"def center_of(str)\n return str[str.size/2] if str.size.odd?\n return str[(str.size/2)-1] + str[(str.size/2)]\nend",
"def flip_word(word)\n first_half = \"\"\n second_half = \"\"\n middle = \"\"\n idx = 0\n\n word.each_char do |letter|\n if (idx == word.length / 2) && (word.length % 2 != 0)\n middle << letter\n elsif idx <= (word.length / 2 - 1)\n first_half << letter\n elsif idx > (word.length / 2 - 1)\n second_half << letter\n end\n\n idx += 1\n end\n\n puts second_half + middle + first_half\nend",
"def middle(list)\n if list.size % 2 == 1\n #odd length lists\n return list[list.size / 2]\n else\n # even length lists\n return (list[list.size / 2] + list[list.size / 2 - 1]) / 2.0\n end\nend",
"def middle(list)\n if list.size%2 == 1 # odd length sorted\n return list[list.size/2]\n else # even length sorted\n return (list[list.size/2] + list [list.size / 2 -1]) / 2.0\n end \n\nend",
"def center_of(str)\n sz = str.size\n sz.even? ? str[sz / 2 - 1, 2] : str[sz / 2]\nend"
] | [
"0.79567516",
"0.7946197",
"0.7852843",
"0.78287125",
"0.7798002",
"0.77541465",
"0.7729286",
"0.7632451",
"0.7557507",
"0.7556252",
"0.7507475",
"0.7499818",
"0.7486011",
"0.7445402",
"0.7408992",
"0.73516864",
"0.7320952",
"0.7299202",
"0.72701716",
"0.72701716",
"0.72504115",
"0.72250104",
"0.72094107",
"0.7207489",
"0.7207203",
"0.7192347",
"0.71820253",
"0.7175171",
"0.7144526",
"0.7137558",
"0.71289945",
"0.70955944",
"0.7016118",
"0.7015318",
"0.7013925",
"0.6994937",
"0.6988898",
"0.69622123",
"0.69387144",
"0.69368225",
"0.6932505",
"0.6922218",
"0.6874949",
"0.686615",
"0.68610144",
"0.6850294",
"0.68137443",
"0.67946887",
"0.6734097",
"0.6702065",
"0.66393137",
"0.6583091",
"0.64689827",
"0.6450772",
"0.6408249",
"0.6405567",
"0.6379565",
"0.6368365",
"0.6328172",
"0.63219494",
"0.63140553",
"0.6297677",
"0.6232772",
"0.6222747",
"0.62123173",
"0.6191994",
"0.61891615",
"0.6184232",
"0.6143864",
"0.612409",
"0.6100539",
"0.6089625",
"0.6069116",
"0.6056597",
"0.60524476",
"0.6042404",
"0.6040047",
"0.6030552",
"0.60245156",
"0.599997",
"0.5986001",
"0.59677064",
"0.5962098",
"0.59613866",
"0.5933092",
"0.59159553",
"0.5868208",
"0.58573484",
"0.5828422",
"0.5823085",
"0.582051",
"0.58159125",
"0.5798005",
"0.57856613",
"0.5775647",
"0.5767262",
"0.57652354",
"0.57592005",
"0.5745535",
"0.5716932"
] | 0.6977287 | 37 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.sign_up_notification.subject | def sign_up_notification
# @greeting = "Hi"
# mail to: "to@example.org"
# @admin = User.where(is_admin: true).last
@user = params[:user]
mail(to: @user.email, subject: 'Sign Up successfull')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def signup_notification(user)\n\t\tsetup_email(user)\n\t\t subject self.site_name+\" : \"+I18n.t('mailer.signup_notification.subject')\n\t\t body :url => self.daurl+\"/admin/activate/#{user.activation_code}\",\n\t\t\t:site => self.site_name,\n\t\t\t:user_login => user.login,\n\t\t\t:user_password => user.password\n end",
"def subject\n @mail.subject\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def title_for_user_applied_to_travel\n I18n.t(\"notification.user_applied_to_travel.title\")\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def sign_up(new_user)\n @user = new_user\n @notify_subject = strip_tags \"NEW SIGN UP AT #{ENV['APPLICATION_CONFIG_name']}\"\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end",
"def subject\n self['subject']\n end",
"def subject_name\n subject_full_name\n end",
"def message_subject\n return @message_subject\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end",
"def subject_name\n return @subject_name\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def subject\n message.subject\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def signup_email(user)\n mail(\n to: \"terry.p.dignon@gmail.com\",\n subject: 'Thanks for signing up'\n )\n end",
"def twiki_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Twiki account information (\"+@person.email+\")\",\n :date=>Time.now)\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def push_message_title\n case notification_type\n when 'conversation_creation'\n I18n.t('notifications.notification_title.conversation_creation', display_id: primary_actor.display_id, inbox_name: primary_actor.inbox.name)\n when 'conversation_assignment'\n I18n.t('notifications.notification_title.conversation_assignment', display_id: primary_actor.display_id)\n when 'assigned_conversation_new_message'\n I18n.t(\n 'notifications.notification_title.assigned_conversation_new_message',\n display_id: conversation.display_id,\n content: primary_actor.content&.truncate_words(10)\n )\n when 'conversation_mention'\n \"[##{conversation.display_id}] #{transform_user_mention_content primary_actor.content}\"\n else\n ''\n end\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def welcome_signup_email(signup)\n @signup = signup\n mail(\n :subject => \"We will be coming to your school soon!\",\n :from => \"noreply@studyhall.com\",\n :to => @signup.email\n )\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def notify_sign_up_confirmation!\n UserMailer.sign_up_confirmation(self).deliver!\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def new_signup_notification\n user = User.first\n UserMailer.new_signup_notification(user, \"x.x.x.x (aprox y)\")\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def subject; @message_impl.getSubject; end",
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def sign_up_mail(user_id,school_id)\n # @greeting = \"Hi\"\n\n # mail to: \"to@example.org\"\n\n\n @user = HMMC.db.get_user(user_id)\n @school = HMMC.db.get_school(school_id)\n\n mail(\n from: \"notifier@my-app.com\",\n to: @user.email,\n subject: \"Thank you for registering with the Hundread millionaire mile club\"\n )\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 send_signup_email(user)\n\t\tuser = user\n subject = \"Thank you for sign up on miniflix.\"\n merge_vars = {\n \"USER_NAME\" => user.name\n }\n body = mandrill_template(\"Paid-user-signup-mail\", merge_vars)\n\n send_mail(user.email, subject, body)\n\tend",
"def signup_email(user)\n mail( :to => user.email,\n :subject => 'Thanks for signing up' )\n end",
"def notify_publication(meetup, user)\n @user = user\n @meetup = meetup\n @date = I18n.l(meetup.date)\n I18n.with_locale(@user.locale) do\n mail(to: @user.email,\n subject: I18n.t('meetup_mailer.notify_publication.subject', \\\n meetup: @meetup.title), \\\n date: @date)\n end\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end",
"def user_sign_up_notification(user)\n @user = user\n\n mail(to: \"<#{user.email}>\", subject: \"Success! You did it.\")\n end",
"def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end",
"def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end",
"def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end",
"def subject\n title \n end",
"def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up for Sublets at Penn!\" )\n end",
"def signup_notification(user)\n provider = self.provider_account = user.account.provider_account\n\n subject = user.account.provider? ? \"3scale account confirmation\" : \"#{account_name(user)} API account confirmation\"\n\n headers(\n 'Return-Path' => from_address(user),\n 'X-SMTPAPI' => '{\"category\": \"Signup Notification\"}'\n )\n\n if user.activation_code\n activate_url = if user.account.provider?\n provider_activate_url(activation_code: user.activation_code, host: domain(user))\n else\n developer_portal.activate_url(activation_code: user.activation_code, host: domain(user))\n end\n end\n\n assign_drops user: Liquid::Drops::User.new(user),\n domain: Liquid::Drops::Deprecated.wrap(domain(user)),\n account_name: Liquid::Drops::Deprecated.wrap(account_name(user)),\n account: Liquid::Drops::Account.wrap(user.account),\n provider: Liquid::Drops::Provider.wrap(user.account.provider_account),\n url: activate_url,\n admin_url: Liquid::Drops::Deprecated.wrap(admin_url(user))\n\n mail(\n template_name: 'signup_notification_email',\n subject: subject,\n to: user.email,\n from: from_address(user)\n )\n end",
"def sender\n ENV['NOTIFICATION_FROM_EMAIL'] || 'noreply@some.gov'\n end",
"def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end",
"def set_subject(subject)\n\t\tend",
"def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up\" )\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def send_devise_notification(notification, *args)\n I18n.with_locale(locale) { super notification, *args }\n end",
"def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up!\" )\n end",
"def reminder_email(user)\n @user = user\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def email_verification_instructions(user)\n load_settings\n @user = user\n subject_suffix = \"Account Activation Instructions\"\n #@url = \"http://example.com/login\"\n mail(:to => user.email,\n :subject => \"[#{user.company_name}] #{subject_suffix}\",\n :template_path => 'notifications',\n :template_name => 'another',\n :activate_account_url => activate_accounts_url(:code => user.perishable_token,\n :subdomain => user.company.subdomain),\n :username => user.login,\n :token => user.perishable_token, :subdomain => user.company.subdomain)\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def send_notification(user, questionnaire)\n I18n.default_locale = I18n.locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you'),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers)\n end",
"def new_notification_email(notification,receiver)\n @notification = notification\n @receiver = receiver\n #DIFFERENT FROM ORIGINAL----------------------\n subject = notification.subject.to_s\n subject = decode_basic_notification(subject,notification.notified_object)\n subject = subject.gsub(/\\n/,'')\n #END OF DIFFERENCE----------------------------\n subject = strip_tags(subject) unless subject.html_safe?\n mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject)) do |format|\n format.text {render __method__}\n format.html {render __method__}\n end\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def send_signup_email(user)\n @user = user\n mail( :to => @user.email,\n :subject => 'Thanks for signing up with Linchpin' )\n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def send_signup_email\n mail( :to => 'davidbliu@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' ).deliver\n end",
"def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def employee_signup_email(employee)\n @employee = employee\n mail( :to => @employee.email,\n :subject => 'Thanks for signing up for Shiift' )\n end"
] | [
"0.67989194",
"0.67111087",
"0.66632926",
"0.666101",
"0.65482634",
"0.6421273",
"0.6389339",
"0.6372051",
"0.637055",
"0.63448995",
"0.6310573",
"0.6309523",
"0.6307496",
"0.6305691",
"0.62805027",
"0.62159854",
"0.6200072",
"0.6119486",
"0.6116144",
"0.6111704",
"0.6083866",
"0.60759366",
"0.6022934",
"0.6007732",
"0.60042095",
"0.59633917",
"0.5941917",
"0.59365976",
"0.5912688",
"0.59104407",
"0.59104407",
"0.59104407",
"0.59104407",
"0.5909693",
"0.590601",
"0.5905126",
"0.5889959",
"0.5876617",
"0.58633643",
"0.5854208",
"0.5854208",
"0.5854208",
"0.5854208",
"0.5854208",
"0.5854208",
"0.5854208",
"0.5854208",
"0.58082724",
"0.57923347",
"0.578701",
"0.57836646",
"0.5778728",
"0.5772513",
"0.5762474",
"0.576189",
"0.576189",
"0.576189",
"0.576189",
"0.576189",
"0.576189",
"0.5751569",
"0.57508403",
"0.57358634",
"0.57135",
"0.5698124",
"0.5696427",
"0.56826407",
"0.56739146",
"0.566443",
"0.5659729",
"0.56457424",
"0.562546",
"0.5625432",
"0.562263",
"0.5617764",
"0.5615519",
"0.5609857",
"0.56032825",
"0.560005",
"0.5596856",
"0.5594706",
"0.5592451",
"0.5590342",
"0.5590204",
"0.55873567",
"0.55868137",
"0.55721164",
"0.55585843",
"0.5548584",
"0.55478907",
"0.55378497",
"0.55357575",
"0.55159634",
"0.5509274",
"0.5506918",
"0.55028677",
"0.5496908",
"0.54947877",
"0.5486472",
"0.5479453"
] | 0.5682123 | 67 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.approved_notification.subject | def approved_notification
@user = params[:user]
mail(to: @user.email, subject: 'Library Card Request Approved')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def subject\n @mail.subject\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def title_for_user_approved_by_driver(name, surname)\n I18n.t(\"notification.user_approved_by_driver.title\", name: name, surname: surname)\n end",
"def title_for_user_applied_to_travel\n I18n.t(\"notification.user_applied_to_travel.title\")\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end",
"def message_subject\n return @message_subject\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def title_for_received_review\n I18n.t(\"notification.user_received_review.title\")\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject_name\n subject_full_name\n end",
"def subject\n message.subject\n end",
"def subject\n self['subject']\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def title_for_request_message_for_requester\n I18n.t(\"notification.received_a_travel_request_message_is_owner.title\")\n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def subject_name\n return @subject_name\n end",
"def push_message_title\n case notification_type\n when 'conversation_creation'\n I18n.t('notifications.notification_title.conversation_creation', display_id: primary_actor.display_id, inbox_name: primary_actor.inbox.name)\n when 'conversation_assignment'\n I18n.t('notifications.notification_title.conversation_assignment', display_id: primary_actor.display_id)\n when 'assigned_conversation_new_message'\n I18n.t(\n 'notifications.notification_title.assigned_conversation_new_message',\n display_id: conversation.display_id,\n content: primary_actor.content&.truncate_words(10)\n )\n when 'conversation_mention'\n \"[##{conversation.display_id}] #{transform_user_mention_content primary_actor.content}\"\n else\n ''\n end\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def subject; @message_impl.getSubject; end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def set_subject(subject)\n\t\tend",
"def set_title\n @title = t(:message_0, :scope => [:controller, :scholarships])\n end",
"def subject\n title \n end",
"def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end",
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end",
"def new_notification_email(notification,receiver)\n @notification = notification\n @receiver = receiver\n #DIFFERENT FROM ORIGINAL----------------------\n subject = notification.subject.to_s\n subject = decode_basic_notification(subject,notification.notified_object)\n subject = subject.gsub(/\\n/,'')\n #END OF DIFFERENCE----------------------------\n subject = strip_tags(subject) unless subject.html_safe?\n mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject)) do |format|\n format.text {render __method__}\n format.html {render __method__}\n end\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 community_member_email(sender, recipient, email_subject, email_content, community)\n @email_type = \"email_from_admins\"\n set_up_layout_variables(recipient, community, @email_type)\n with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do\n @email_content = email_content\n @no_recipient_name = true\n premailer_mail(:to => recipient.confirmed_notification_emails_to,\n :from => community_specific_sender(community),\n :subject => email_subject,\n :reply_to => \"\\\"#{sender.name(community)}\\\"<#{sender.confirmed_notification_email_to}>\")\n end\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def approved_by\n t(:message_0, :scope => [:model, last_approver.to_s.underscore])\n end",
"def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end",
"def post_approve_email\n NotificationMailer.post_approve_email('default@email.com')\n end",
"def get_subject\n\t\tend",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def rezm_subject_and_status(message)\n if message.receiver_deleted?\n message.subject + \" (Deleted)\" \n elsif message.read_at.nil?\n message.subject + \" (Unread)\" \n else \n message.subject\n end\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend",
"def set_subject\n url = Settings.hqva_mobile.url\n icn = user.icn\n appointment_id = data[:appointment_id]\n\n {\n use: SUBJECT_USE,\n value: \"#{url}/appointments/v1/patients/#{icn}/Appointment/#{appointment_id}\"\n }\n end",
"def course_notification_card_text(course)\n t('notifications.new_course_created_html', title: course.title)\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def notification_subject_publish(brother)\n if (brother == self.brother)\n return \"[Voucher] You Just Created a Voucher\"\n else\n return \"[Voucher] Voucher request from: \" + self.brother.display_name\n end\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end",
"def notify(msg, subject)\n end",
"def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end",
"def adhoc_test_subj_call\n ->(candidate) { I18n.t('email.test_adhoc_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def application_approved(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end",
"def subject_and_status(message)\n tag = ''\n if message.receiver_deleted?\n tag = \" (Deleted)\"\n elsif message.read_at.nil? and params[:action] != \"outbox\"\n \"· <strong>#{message.subject}</strong>\".html_safe\n else\n message.subject\n end\n end",
"def normalize_subject_name\n self.subject = subject.downcase.titleize\n end",
"def i18n_scope\n \"exhibits.notifications.order.delivery_confirmation_period_elapsed.#{role}\"\n end",
"def subject_names\n @subject_names ||= sw_subject_names\n end",
"def subject_contains=(value)\n @subject_contains = value\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def user_rejected_email(course, user)\n ActsAsTenant.without_tenant do\n @course = course\n end\n @recipient = 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 sender\n ENV['NOTIFICATION_FROM_EMAIL'] || 'noreply@some.gov'\n end"
] | [
"0.6953471",
"0.6851552",
"0.68108493",
"0.66740793",
"0.6556023",
"0.65067506",
"0.6479987",
"0.64354974",
"0.63558203",
"0.63076705",
"0.62724805",
"0.6184268",
"0.6167953",
"0.6164907",
"0.61641526",
"0.6163602",
"0.61215615",
"0.6119967",
"0.6119941",
"0.6105301",
"0.6101048",
"0.6063546",
"0.6055562",
"0.60073036",
"0.59867793",
"0.59317",
"0.59178066",
"0.59178066",
"0.59178066",
"0.59178066",
"0.59178066",
"0.59178066",
"0.5913677",
"0.5906145",
"0.5894151",
"0.58940715",
"0.5874206",
"0.5872902",
"0.58515203",
"0.58475167",
"0.5847385",
"0.5847385",
"0.5847385",
"0.5847385",
"0.5847385",
"0.5847385",
"0.5847385",
"0.5847385",
"0.58404005",
"0.5825929",
"0.5821853",
"0.5814643",
"0.5811739",
"0.5811739",
"0.5811739",
"0.5811739",
"0.5795417",
"0.5791227",
"0.5766552",
"0.5758698",
"0.5758392",
"0.5756925",
"0.5743451",
"0.57023144",
"0.5689084",
"0.5674999",
"0.5672715",
"0.56610495",
"0.56593984",
"0.56508034",
"0.5627702",
"0.56165504",
"0.56129485",
"0.5600551",
"0.55952996",
"0.55857974",
"0.55853826",
"0.5582582",
"0.55405873",
"0.5537727",
"0.5517569",
"0.5513191",
"0.5503778",
"0.54994756",
"0.54976",
"0.5488921",
"0.54855996",
"0.5463575",
"0.5463285",
"0.54484963",
"0.5441901",
"0.5438606",
"0.543658",
"0.541952",
"0.5418207",
"0.54171705",
"0.53992206",
"0.5398726",
"0.5382252",
"0.53646207",
"0.5361199"
] | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.rejected_notification.subject | def rejected_notification
@user = params[:user]
mail(to: @user.email, subject: 'Library Card Request Rejected')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def user_rejected_email(course, user)\n ActsAsTenant.without_tenant do\n @course = course\n end\n @recipient = 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 subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def rejected(request)\n @request = request\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject\n @mail.subject\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def subject\n 'Report a problem'.freeze\n end",
"def message_subject\n return @message_subject\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def subject\n message.subject\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def message_for(key,options={})\n handwritten_message || I18n.translate(key, {:scope => 'activerecord.errors.messages'}.merge(options))\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end",
"def default_i18n_subject(interpolations = {})\n ''\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def questionnaire_duplication_failed(user, questionnaire, error_message)\n I18n.locale = user.language\n @questionnaire = questionnaire\n @user = user\n @error_message = error_message\n @subject = (questionnaire.email_subject(user.language) ? questionnaire.email_subject(user.language) : \"\") + I18n.t('user_mailer.questionnaire_duplication_failed.subject')\n mail(\n to: @user.email,\n subject: @subject\n )\n end",
"def subject\n self['subject']\n end",
"def role_request_rejected(instance_user, message)\n @instance_user = instance_user\n @recipient = instance_user.user\n\n ActsAsTenant.without_tenant do\n @instance = instance_user.instance\n @message = message\n end\n\n I18n.with_locale(instance_user.user.locale) do\n mail(to: instance_user.user.email, subject: t('.subject'))\n end\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def title_for_received_review\n I18n.t(\"notification.user_received_review.title\")\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def rejected\n RequestMailer.rejected\n end",
"def translated_message\n lookups = []\n lookups << :\"activemodel.errors.template.message\"\n lookups << :\"activerecord.errors.template.message\"\n lookups << :\"case_form.errors.template.message\"\n lookups << \"There were problems with the following fields:\"\n I18n.t(lookups.shift, :default => lookups)\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def subject_name\n return @subject_name\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def subject; @message_impl.getSubject; end",
"def title_for_request_message_for_requester\n I18n.t(\"notification.received_a_travel_request_message_is_owner.title\")\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def new_notification_email(notification,receiver)\n @notification = notification\n @receiver = receiver\n #DIFFERENT FROM ORIGINAL----------------------\n subject = notification.subject.to_s\n subject = decode_basic_notification(subject,notification.notified_object)\n subject = subject.gsub(/\\n/,'')\n #END OF DIFFERENCE----------------------------\n subject = strip_tags(subject) unless subject.html_safe?\n mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject)) do |format|\n format.text {render __method__}\n format.html {render __method__}\n end\n end",
"def send_questionnaire_notification(user, questionnaire)\n @locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <noreply@svivatova.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you', :locale => @locale),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers) do |format|\n format.text\n format.html\n end\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def translated_header_message\n lookups = []\n lookups << :\"activemodel.errors.template.header_message\"\n lookups << :\"activerecord.errors.template.header_message\"\n lookups << :\"case_form.errors.template.header_message\"\n lookups << \"Some errors prohibited this object from being saved\"\n I18n.t(lookups.shift, :default => lookups)\n end",
"def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end",
"def send_notification(user, questionnaire)\n I18n.default_locale = I18n.locale = questionnaire.language.locale\n headers = {\n :from => 'Bnei Baruch <internet@kbb1.com>',\n :subject => I18n.t('notification.mailer.new_questionnaire_for_you'),\n :to => user.email,\n :date => Time.now.to_formatted_s(:rfc822)\n }\n @user = user\n @questionnaire = questionnaire\n mail(headers)\n end",
"def title_for_user_applied_to_travel\n I18n.t(\"notification.user_applied_to_travel.title\")\n end",
"def unpaid_user_notification(user)\n mail(to: user.email, subject: I18n.t('user_mailer.unpaid_user_notification.subject'))\n end",
"def subject_name\n subject_full_name\n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def rejected_loan(loan, options = {})\n to_email = 'MB Servicing <MBservicing@mbmortgage.com>'\n subject = (Rails.env == 'development') ? \"TESTING -- MBWEB/TSS: #{options[:reason]} Loan Notification\" : \"MBWEB/TSS: #{options[:reason]} Loan Notification\"\n @loan = loan\n @options = options\n mail(:to => to_email, :subject => subject) do |format|\n format.text\n end\n end",
"def devalert(subject, body='', extra_to=[])\n recipients = CONTACT_EMAIL_ACCOUNTS\n if RAILS_ENV == 'production'\n extra_to = [extra_to] if extra_to.is_a?(String)\n recipients = [recipients].concat(extra_to).join(',')\n end\n @subject = subject\n @body = {:msg => body}\n @recipients = recipients\n @from = ALERT_EMAIL_DEV\n @sent_on = Time.now\n @headers = {}\n end",
"def mailer_to\n resolve_value(_notification_email)\n end",
"def default_message_for(key)\n if @options[:message]\n :message\n else\n @options[:\"#{key}_message\"] = key\n :\"#{key}_message\"\n end\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def set_subject(subject)\n\t\tend",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def invalid_invitation_email_errors\n invalid_invitations.map do |invitation|\n message = invitation.errors.full_messages.to_sentence\n t('course.user_invitations.errors.invalid_email', email: invitation.email, message: message)\n end\n end",
"def invalid_invitation_email_errors\n invalid_invitations.map do |invitation|\n message = invitation.errors.full_messages.to_sentence\n t('course.user_invitations.errors.invalid_email', email: invitation.email, message: message)\n end\n end",
"def reject_user\n ProjectUserMailer.reject_user\n end",
"def translated_error_message(identifier)\n return default_translated_error_message(identifier) if utility.nil?\n I18n.t(\n \"errors.messages.#{utility_class_name}.#{identifier}\",\n default: default_translated_error_message(identifier)\n )\n end",
"def title\r\n fail \"There are no messages yet\" if self.messages.size == 0\r\n\r\n @messages[0].subject.size == 0 ? \"No title\" : @messages[0].subject\r\n end",
"def push_message_title\n case notification_type\n when 'conversation_creation'\n I18n.t('notifications.notification_title.conversation_creation', display_id: primary_actor.display_id, inbox_name: primary_actor.inbox.name)\n when 'conversation_assignment'\n I18n.t('notifications.notification_title.conversation_assignment', display_id: primary_actor.display_id)\n when 'assigned_conversation_new_message'\n I18n.t(\n 'notifications.notification_title.assigned_conversation_new_message',\n display_id: conversation.display_id,\n content: primary_actor.content&.truncate_words(10)\n )\n when 'conversation_mention'\n \"[##{conversation.display_id}] #{transform_user_mention_content primary_actor.content}\"\n else\n ''\n end\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end",
"def i18n_scope\n \"exhibits.notifications.order.delivery_confirmation_period_elapsed.#{role}\"\n end",
"def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end",
"def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"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 send_error_email(subject: nil, message: nil)\n mail_opts = {\n to: AppConst::ERROR_MAIL_RECIPIENTS,\n subject: \"[Error #{AppConst::ERROR_MAIL_PREFIX}] #{subject}\",\n body: message\n }\n DevelopmentApp::SendMailJob.enqueue(mail_opts)\n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def invalid_user_email_errors\n invalid_user_emails.map do |user_email|\n message = user_email.errors.full_messages.to_sentence\n t('course.user_invitations.errors.invalid_email', email: user_email.email, message: message)\n end\n end",
"def job_signup_canceled_notification\n UserMailer.job_signup_canceled_notification(User.first, Job.first)\n end",
"def subject\n title \n end"
] | [
"0.68627334",
"0.67048913",
"0.6604195",
"0.65682906",
"0.64851487",
"0.6447959",
"0.6248173",
"0.62248915",
"0.61789006",
"0.6111783",
"0.6110676",
"0.60503715",
"0.6018146",
"0.59767115",
"0.5970228",
"0.59551007",
"0.59481394",
"0.58914465",
"0.5798777",
"0.5790437",
"0.57775307",
"0.57681805",
"0.5766734",
"0.5753708",
"0.5718472",
"0.57168084",
"0.5700566",
"0.5694349",
"0.56849533",
"0.56599766",
"0.5644922",
"0.5639527",
"0.563721",
"0.56063867",
"0.5604587",
"0.5603625",
"0.559757",
"0.55778164",
"0.557747",
"0.55681235",
"0.55657774",
"0.5554621",
"0.55491704",
"0.55473644",
"0.55472577",
"0.55472577",
"0.55472577",
"0.55472577",
"0.55472577",
"0.55472577",
"0.5547047",
"0.55338544",
"0.5523982",
"0.5510951",
"0.5504019",
"0.550085",
"0.54966927",
"0.54945076",
"0.5492978",
"0.54909235",
"0.5474923",
"0.54732984",
"0.5444434",
"0.54159963",
"0.54094017",
"0.54094017",
"0.54094017",
"0.54094017",
"0.53981143",
"0.53981143",
"0.53981143",
"0.53981143",
"0.53981143",
"0.53981143",
"0.53981143",
"0.53981143",
"0.5397956",
"0.5370123",
"0.53219813",
"0.53137445",
"0.5309437",
"0.5309346",
"0.5293583",
"0.52904135",
"0.52904135",
"0.52894384",
"0.52740085",
"0.5258438",
"0.5255143",
"0.52548826",
"0.5252051",
"0.5248698",
"0.52461517",
"0.5240751",
"0.5230007",
"0.52253485",
"0.52105135",
"0.5208479",
"0.5197399",
"0.51969"
] | 0.546816 | 62 |
the profile, attack, reduce_hitpoint, isDead and deflect are called instance methods or behaviour implementation of encapsulation attribute writer method | def change_profile(new_name = @name, new_hitpoint = @hitpoint, new_attack_damage = @attack_damage)
@name = new_name
@hitpoint = new_hitpoint
@attack_damage = new_attack_damage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths\n speed_of_spread\n end",
"def set_attack_info\n case @attack_type\n when :magic\n @dice_pool = 6\n @opponent_armor = 2\n @opponent_save = 6\n when :ranged\n @dice_pool = @attacker.ranged_dice_pool\n @opponent_armor = @defender.armor_ranged\n @opponent_save = 5\n when :melee\n @last_attack_cac = true\n\n @dice_pool = @attacker.melee_dice_pool\n @opponent_armor = @defender.armor_cac\n @opponent_save = 4\n else\n raise \"Attack type unknown : #{@attack_type}\"\n end\n end",
"def profile()\r\n puts \"#{@name} has #{@hitpoint} and #{@attack_damage} attack damage\"\r\n end",
"def player_base\n @wealth = 0\n @fame = 0\n @current_exp = 0\n @exp_needed = 100\n @available_attribute_points = 30\n @total_proficiency_points = 1\n @available_proficiency_points = 1\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables? Instance variables are available to all methods of the instance. There is no need to pass the instance variables into the instance methods.\n\n predicted_deaths()\n speed_of_spread()\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths\n speed_of_spread\n end",
"def customAssign( str, dex, con, int, wis, cha )\n\n # Include racial modifiers\n case @race\n when \"dwarf\"\n con += 2\n wis += 2\n cha -=2\n when \"elf\"\n dex += 2\n int += 2\n con -= 2\n else\n # Human: Put bonus in best class ability\n wis += 2\n end\n\n @strength = Ability.new( str )\n @dexterity = Ability.new( dex )\n @constitution = Ability.new( con )\n @intelligence = Ability.new( int )\n @wisdom = Ability.new( wis )\n @charisma = Ability.new( cha )\n\n end",
"def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end",
"def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables? # Helper method used to call the methods down below\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def attack() stat(:attack) end",
"def sniff\n attributes_in_context.map do |_attribute, line|\n smell_warning(\n lines: [line],\n message: 'is a writable attribute')\n end\n end",
"def add_attr_accessors_to_self\n instance_variables.each do |name|\n method_name = name[1..-1].to_sym\n MetricFu::Configuration.send(:attr_accessor, method_name)\n end\n end",
"def virus_effects #looks DRY but not using the full scope of the variables \r\n predicted_deaths\r\n speed_of_spread\r\n end",
"def attack_effect_setup\r\n self.critical = false\r\n end",
"def attr_writer(sym, *more) end",
"def gr_policy_setup\n begin\n # If there are no accessors for the model object's accessors,\n # they need to be defined so we can alias them\n define_attribute_methods\n rescue\n end\n \n if self.respond_to?(\"reflections\")\n\n # Make a dummy instance of the ActiveRecord class\n # so that we can read off its list of attributes\n dummy = eval(\"#{self}.new\")\n attrs = dummy.attribute_names\n\n # We need to override the accessors both for attributes\n # and reflections (i.e belongs_to, has_many, etc.)\n for var in reflections.keys + attrs do\n\n # Setter - \n self.class_eval(\"alias :old_#{var}= :#{var}=\")\n self.class_eval(\"\n define_method(:#{var}=) do |val|\n # We need the old value in order to make judgments \n # about whether or not certain accesses are allowed\n # In particular, the access control policies are attached\n # to the value being edited (unless its frozen) so \n # we need the object itself to decide if it can be changed.\n # In addition, the old object is used for comparisons\n # to distinguish complete edits from simple appends.\n\n\t\t target = old_#{var}\n\n # If the current version of the data is frozen, then\n # we can't judge it by its attached data policy and\n # instead must turn to its owner and its frozen_policy_store\n # then put that in target so it looks no different\n # than if it were not frozen\n\n\t\t if target.nil? || target.frozen?\n target = Object.new\n\t\t if !self.frozen_policy_store[:#{var}].nil?\n \t\t target.assign_policy(:write_access, \n self.frozen_policy_store[:#{var}][:write_access])\t\t\n\t\t end\n\t\t end\n \n # In order for an edit to be allowed, both the object\n # to be edited, and the object that owns the field that\n # is being edited must have edit permissions. The exception\n # to this is if the change is appending to the content and\n # appends are explicity allowed\n\n if gr_can_edit? and target.gr_can_edit?\n return self.send('old_#{var}=',val) #Edits allowed \n elsif target.gr_append_check? val\n if gr_can_append? and target.gr_can_append?\n return self.send('old_#{var}=',val)\n else\n return eval_violation(:append_access) if target.gr_can_append?\n return target.eval_violation(:append_access)\n end\n else\n # Edits not allowed and appends either not applicable\n # or also not allowed\n return eval_violation(:write_access) if target.gr_can_edit?\n return target.eval_violation(:write_access)\n end\n\t end\")\n\n # Getter\n self.class_eval(\"alias :old_#{var} :#{var}\")\n self.class_eval(\"\n define_method(:#{var}) do\n \n # Actually get the value in question, but we only\n # return it if read access is allowed. We also\n # need this value to perform checks against the\n # access control policy\n\n \t target = old_#{var}\n\n # We assume that having a value of nil tells no one\n # any particularly useful information, so if the \n # object is nil, we just skip the rest and return it.\n\n\t return if target.nil?\n \n # If the data being returned is an array, then we need\n # to do some extra checks. First, the array cannot \n # contain any objects which are themselves hidden. \n # Second, we need to check if the Array is wrapped\n # with a Rails proxy that will allow it to make changes\n # to the database after the leaving this function. If\n # this is the case, we must wrap the proxy with one of\n # our proxies (AssociationProxyWrapper) so that methods\n # called on the returned proxied array cannot change\n # the database if not allowed by the access control policies\n\n isproxy = target.respond_to?('proxy_reflection')\n if target.is_a?(Array)\n new_array = visible_array(target)\n if isproxy\n target.target = new_array\n target = AssociationProxyWrapper.new(target,self)\n\n # Pull the appropriate policy from the owner of the\n # field's plural policy store (see GObject.rb)\n\n hsh = self.plural_policy_store[:#{var}]\n if !hsh.nil?\n hsh.each do |policy, func|\n target.assign_policy(policy, func)\n end\n end\n else\n target = new_array\n end\n end\n \n # If the object in question is visible, then we can return it \n\t return target if (target.gr_is_visible? && self.gr_is_visible?)\n\n # If the target is visible, then it must be the owner that\n # is hidden, so evaluate the violation there\n return eval_violation(:read_access) if target.gr_is_visible?\n\n # If this line is reached, then the visibility issue\n # lies with the target, so the violation should be \n # evaluated on it\n return target.eval_violation(:read_access)\n\t end\")\n \n # Our current implementation overrides only the\n # default accessors, however, [var]_before_type_cast\n # offers another route to the raw data that we need \n # to cover. For now, the two accessors are made\n # identical.\n \n # TODO: Distinguish the _before_type_cast accessor from\n # the normal getter so that they both preserve the security\n # policies, and their intended content formatting differences\n self.class_eval(\"alias :#{var}_before_type_cast #{var}\")\n end\n end\n end",
"def soft_ace\n # softy method refactor for when an ace is played\nend",
"def virus_effects\r\n predicted_deaths\r\n #delete the passing arguments, not necessary since all of them are instance variable\r\n #(@population_density, @population, @state)\r\n speed_of_spread\r\n #this one too\r\n #(@population_density, @state)\r\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def health_benefit; end",
"def character=(character)\n self.name = character.name\n self.base_stats = character.base_stats\n self.default_ability_1 = character.default_ability_1\n self.default_ability_2 = character.default_ability_2\n self.default_ability_3 = character.default_ability_3\n end",
"def isAttack\r\n \"#{@name}\"\r\nend",
"def process_attrs_before_write(surgical_profile)\n if surgical_profile.hospital_admission_date\n surgical_profile.hospital_admission_date =\n surgical_profile.hospital_admission_date.to_s\n end\n if surgical_profile.operation_date\n surgical_profile.operation_date =\n surgical_profile.operation_date.to_s\n end\n end",
"def sniff(ctx)\n attributes_in(ctx).map do |_attribute, line|\n smell_warning(\n context: ctx,\n lines: [line],\n message: 'is a writable attribute')\n end\n end",
"def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density)\n end",
"def calc_secondary_attributes\n self.san = self.pow * 5\n self.idea = self.int * 5\n self.health = ((self.siz+self.con)/2.0).ceil\n self.luck = self.pow * 5\n self.know = self.edu * 5 \n self.magic = self.pow\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def attack()\r\n @warrior.attack!\r\n end",
"def attack()\r\n @warrior.attack!\r\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables? these methods can only be used within a virusPredictor class, its scope.\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n #removed parameters for predicted_deaths and speed_of_spread, as these are class variables and are accessible throughout the method\n predicted_deaths\n speed_of_spread\n end",
"def perception(char, update_priority = BlizzABS::UPDFull)\n # temporary variables\n dir, x, y, ai, in_range = char.direction, char.x, char.y, char.ai, []\n # if enemy\n if char.is_a?(Map_Enemy)\n # if heavy update required\n if update_priority >= BlizzABS::UPDHeavy\n # find all battlers within perception range\n in_range = ($game_map.battlers + $BlizzABS.battlers - [char]).\n find_all {|b| b.valid? && !b.battler.dead? && ai.view_range * 128 >=\n Math.hypot(b.real_x-char.real_x, b.real_y-char.real_y) &&\n !wall?(char, b.x, b.y)}\n # find all who are in sight\n ai.sight = in_range.find_all {|b| b.in_action > 0 ||\n can_see_char?(char, b.real_x, b.real_y) ||\n can_hear_char?(char, b.real_x, b.real_y)}\n # if full update required\n if update_priority == BlizzABS::UPDFull\n # memorize all unmemorized, seen battlers\n ai.add_to_memory(ai.sight - ai.memory.keys)\n end\n end\n # if medium update required\n if update_priority >= BlizzABS::UPDMedium\n # if observing attribute is active\n if ai.observe\n # valid and lost actors\n valid_actors, lost_actors = [], []\n # for each battler in sight\n ai.sight.each {|b|\n # if actor\n if b.is_a?(Map_Actor)\n # add the appropriate array\n (b.valid? ? valid_actors : lost_actors).push(b)\n end}\n # add all actors lost out of sight\n lost_actors |= (ai.memory.keys - ai.sight).find_all {|b|\n b.is_a?(Map_Actor)}\n # for each actor in sight\n valid_actors.each {|key|\n # get observation logs\n data = ai.observation[key.battler]\n # if no observation log exists\n if data == nil\n # create an observation log\n ai.observation[key.battler] = [Graphics.frame_count]\n # if interval not started yet\n elsif !data[data.size - 1].is_a?(Numeric)\n # start observation interval right now\n data.push(Graphics.frame_count)\n end}\n # for all actors that need to be forgotten\n lost_actors.each {|key|\n # get observation logs\n data = ai.observation[key.battler]\n # if logs exist, last log is a number and time has passed\n if data != nil && data[data.size-1].is_a?(Numeric) &&\n data[data.size-1] < Graphics.frame_count\n # convert number into inteval\n data.push(data.pop..Graphics.frame_count)\n end}\n end\n end\n # if actor\n elsif char.is_a?(Map_Actor)\n # in sight are all battlers in range\n ai.sight = ($game_map.battlers + $BlizzABS.battlers - [char]).\n find_all {|b| b.valid? && b.in_screen?}\n end\n # get alignment setup\n negative, positive = ai.negative, ai.positive\n # invert setup if confused\n negative, positive = positive, negative if char.restriction == 3\n # if a target exists\n if ai.target != nil\n # if force moving\n if char.move_type == 3\n # if delay counter expired\n if ai.act.ready?\n # execute action\n try_execute(char)\n # if nobody around\n if ai.memory.keys.size == 0 && ai.sight.size == 0\n # reset action\n char.reset_action\n # if about to move and target exists\n elsif char.force_move.size == 0 && ai.target != nil\n # get pixel movement rate and initialize flag\n pix, found = $BlizzABS.pixel, false\n # find the target in memory\n ai.memory.each_key {|key|\n # if this is the target\n if key == ai.target\n # if lost target completely\n if ai.memory[key].x / pix == char.x / pix &&\n ai.memory[key].y / pix == char.y / pix\n # reset action\n char.reset_action\n # abort method\n return\n end\n # found the target\n found = true\n break\n end}\n # reset action if not found in memory\n char.reset_action unless found\n end\n end\n else\n # face the target\n char.turn_toward(ai.target)\n # if running away\n if char.ai.act.escape?\n # move away from reference target\n char.move_away_random(ai.target, true, ai.act.range)\n # if delay counter expired\n elsif ai.act.ready?\n # execute action\n try_execute(char)\n # if nobody around\n if ai.memory.keys.size == 0 && ai.sight.size == 0\n # reset action\n char.reset_action\n # if about to move and target exists\n elsif char.force_move.size == 0 && ai.target != nil\n # if within sight\n if ai.sight.include?(ai.target)\n # request path to target\n request_path(char, ai.target)\n else\n # get pixel movement rate and initialize flag\n pix, found = $BlizzABS.pixel, false\n # find the target in memory\n ai.memory.each_key {|key|\n # if this is the target\n if key == ai.target\n # temporary variables\n x, y = ai.memory[key].x / pix, ai.memory[key].y / pix\n # if lost target completely\n if x == char.x / pix && y == char.y / pix\n # reset action\n char.reset_action\n # abort method\n return\n end\n # find path to last known coordinates\n request_path(char, x, y)\n found = true\n break\n end}\n # reset action if not found in memory\n char.reset_action unless found\n end\n end\n # if negative action and too close\n elsif negative.include?(ai.target.ai.group) &&\n Math.hypot(char.real_x-ai.target.real_x,\n char.real_y-ai.target.real_y) < 384\n # delete movement commands\n char.force_move = []\n # back off from reference target\n char.move_away_random(ai.target, false, ai.act.range)\n end\n # exit method\n return\n end\n end\n # if not actor\n unless char.is_a?(Map_Actor)\n # call for help\n call_for_help(char, in_range, negative, positive)\n end\n end",
"def perform_damage_effect\n end",
"def perform_damage_effect\n end",
"def attack_technique=(value)\n @attack_technique = value\n end",
"def virus_effects\r\n # predicted_deaths(@population_density, @population, @state)\r\n # speed_of_spread(@population_density, @state)\r\n predicted_deaths\r\n speed_of_spread\r\n end",
"def set_counter(user, damage, skill, kind)\n if kind == 'Actor' and Counter_Setting['Actor'][self.id] != nil\n counter = Counter_Setting['Actor'][self.id].dup\n set_counter_values(user, damage, skill, kind, counter)\n end\n if kind == 'Enemy' and Counter_Setting['Enemy'][self.id] != nil\n counter = Counter_Setting['Enemy'][self.id].dup\n set_counter_values(user, damage, skill, kind, counter)\n end\n if kind == 'State'\n for id in self.states\n if Counter_Setting['State'][id] != nil\n counter = Counter_Setting['State'][id]\n set_counter_values(user, damage, skill, kind, counter)\n end\n end\n end\n if kind == 'Skill'\n for id in self.skills\n if Counter_Setting['Skill'][id] != nil\n counter = Counter_Setting['Skill'][id]\n set_counter_values(user, damage, skill, kind, counter)\n end\n end\n end\n if kind == 'Armor'\n for armor in self.armors\n id = armor.id\n if Counter_Setting['Armor'][id] != nil\n counter = Counter_Setting['Armor'][id]\n set_counter_values(user, damage, skill, kind, counter)\n end\n end\n end\n if kind == 'Weapon'\n for weapon in self.weapons\n id = weapon.id\n if Counter_Setting['Weapon'][id] != nil\n counter = Counter_Setting['Weapon'][id]\n set_counter_values(user, damage, skill, kind, counter)\n end\n end\n end\n end",
"def skill_effect_miss\r\n self.damage = 'Miss'\r\n end",
"def atk\n apply_param_limiter(super + party_gift(:atk) + spirit_attack)\n end",
"def enableAttack _obj, _args\n \"_obj enableAttack _args;\" \n end",
"def attack_effect_miss\r\n self.damage = 'Miss'\r\n self.critical = false\r\n end",
"def skill_effect_setup\r\n self.critical = false\r\n end",
"def allowDamage _obj, _args\n \"_obj allowDamage _args;\" \n end",
"def attack_effect_base_damage(attacker)\r\n atk = [attacker.atk - self.pdef / 2, 0].max\r\n self.damage = atk * (20 + attacker.str) / 20\r\n end",
"def adventuring() skill(:adventuring) end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def profile; end",
"def profile; end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def update!(**args)\n @attack_complexity = args[:attack_complexity] if args.key?(:attack_complexity)\n @attack_vector = args[:attack_vector] if args.key?(:attack_vector)\n @availability_impact = args[:availability_impact] if args.key?(:availability_impact)\n @base_score = args[:base_score] if args.key?(:base_score)\n @confidentiality_impact = args[:confidentiality_impact] if args.key?(:confidentiality_impact)\n @exploitability_score = args[:exploitability_score] if args.key?(:exploitability_score)\n @impact_score = args[:impact_score] if args.key?(:impact_score)\n @integrity_impact = args[:integrity_impact] if args.key?(:integrity_impact)\n @privileges_required = args[:privileges_required] if args.key?(:privileges_required)\n @scope = args[:scope] if args.key?(:scope)\n @user_interaction = args[:user_interaction] if args.key?(:user_interaction)\n end",
"def compute_damage\n super * @weapon_level\n end",
"def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end",
"def key_skill; end",
"def pbMoveBaseDamage(move,user,target,skill)\r\n baseDmg = move.baseDamage\r\n baseDmg = 60 if baseDmg==1\r\n return baseDmg if skill<PBTrainerAI.mediumSkill\r\n # Covers all function codes which have their own def pbBaseDamage\r\n case move.function\r\n when \"010\" # Stomp\r\n baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]\r\n # Sonic Boom, Dragon Rage, Super Fang, Night Shade, Endeavor\r\n when \"06A\", \"06B\", \"06C\", \"06D\", \"06E\"\r\n baseDmg = move.pbFixedDamage(user,target)\r\n when \"06F\" # Psywave\r\n baseDmg = user.level\r\n when \"070\" # OHKO\r\n baseDmg = 200\r\n when \"071\", \"072\", \"073\" # Counter, Mirror Coat, Metal Burst\r\n baseDmg = 60\r\n when \"075\", \"076\", \"0D0\", \"12D\" # Surf, Earthquake, Whirlpool, Shadow Storm\r\n baseDmg = move.pbModifyDamage(baseDmg,user,target)\r\n # Gust, Twister, Venoshock, Smelling Salts, Wake-Up Slap, Facade, Hex, Brine,\r\n # Retaliate, Weather Ball, Return, Frustration, Eruption, Crush Grip,\r\n # Stored Power, Punishment, Hidden Power, Fury Cutter, Echoed Voice,\r\n # Trump Card, Flail, Electro Ball, Low Kick, Fling, Spit Up\r\n when \"077\", \"078\", \"07B\", \"07C\", \"07D\", \"07E\", \"07F\", \"080\", \"085\", \"087\",\r\n \"089\", \"08A\", \"08B\", \"08C\", \"08E\", \"08F\", \"090\", \"091\", \"092\", \"097\",\r\n \"098\", \"099\", \"09A\", \"0F7\", \"113\"\r\n baseDmg = move.pbBaseDamage(baseDmg,user,target)\r\n when \"086\" # Acrobatics\r\n baseDmg *= 2 if !user.item || user.hasActiveItem?(:FLYINGGEM)\r\n when \"08D\" # Gyro Ball\r\n targetSpeed = pbRoughStat(target,:SPEED,skill)\r\n userSpeed = pbRoughStat(user,:SPEED,skill)\r\n baseDmg = [[(25*targetSpeed/userSpeed).floor,150].min,1].max\r\n when \"094\" # Present\r\n baseDmg = 50\r\n when \"095\" # Magnitude\r\n baseDmg = 71\r\n baseDmg *= 2 if target.inTwoTurnAttack?(\"0CA\") # Dig\r\n when \"096\" # Natural Gift\r\n baseDmg = move.pbNaturalGiftBaseDamage(user.item_id)\r\n when \"09B\" # Heavy Slam\r\n baseDmg = move.pbBaseDamage(baseDmg,user,target)\r\n baseDmg *= 2 if Settings::MECHANICS_GENERATION >= 7 && skill>=PBTrainerAI.mediumSkill &&\r\n target.effects[PBEffects::Minimize]\r\n when \"0A0\", \"0BD\", \"0BE\" # Frost Breath, Double Kick, Twineedle\r\n baseDmg *= 2\r\n when \"0BF\" # Triple Kick\r\n baseDmg *= 6 # Hits do x1, x2, x3 baseDmg in turn, for x6 in total\r\n when \"0C0\" # Fury Attack\r\n if user.hasActiveAbility?(:SKILLLINK)\r\n baseDmg *= 5\r\n else\r\n baseDmg = (baseDmg * 31 / 10).floor # Average damage dealt\r\n end\r\n when \"0C1\" # Beat Up\r\n mult = 0\r\n @battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i|\r\n mult += 1 if pkmn && pkmn.able? && pkmn.status == :NONE\r\n end\r\n baseDmg *= mult\r\n when \"0C4\" # Solar Beam\r\n baseDmg = move.pbBaseDamageMultiplier(baseDmg,user,target)\r\n when \"0D3\" # Rollout\r\n baseDmg *= 2 if user.effects[PBEffects::DefenseCurl]\r\n when \"0D4\" # Bide\r\n baseDmg = 40\r\n when \"0E1\" # Final Gambit\r\n baseDmg = user.hp\r\n when \"144\" # Flying Press\r\n if GameData::Type.exists?(:FLYING)\r\n if skill>=PBTrainerAI.highSkill\r\n targetTypes = target.pbTypes(true)\r\n mult = Effectiveness.calculate(:FLYING,\r\n targetTypes[0],targetTypes[1],targetTypes[2])\r\n baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round\r\n else\r\n mult = Effectiveness.calculate(:FLYING,\r\n target.type1,target.type2,target.effects[PBEffects::Type3])\r\n baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round\r\n end\r\n end\r\n baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]\r\n when \"166\" # Stomping Tantrum\r\n baseDmg *= 2 if user.lastRoundMoveFailed\r\n when \"175\" # Double Iron Bash\r\n baseDmg *= 2\r\n baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]\r\n end\r\n return baseDmg\r\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def enemy; end",
"def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end",
"def virus_effects \n # predicted_deaths(@population_density, @population, @state) - ORIGINAL\n # speed_of_spread(@population_density, @state) - ORIGINAL\n # REFACTOR\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\r\n predicted_deaths(self)\r\n speed_of_spread(self)\r\n end",
"def allocateTraits\r\n\r\n\tif $class == \"1\" #Soldier\r\n\t\t$lvl=1\t#character level\r\n\t\t$str=8\t#Strength\r\n\t\t$dex=8\t#dexterity\r\n\t\t$con=8\t#constitution\r\n\t\t$int=8\t#intelligence\r\n\t\t$wis=8\t#wisdom\r\n\t\t$cha=8\t#charisma\t\r\n\t\t$maxVit=10 #vitality\r\n\t\t$vit=10\r\n\t\t$atk=$lvl #base attack\r\n\t\t$defenseBonus=0 \r\n\t\t\r\n\r\n\telsif $class == 2 #Scout\r\n\t\t$lvl=1\t\r\n\t\t$str=8\r\n\t\t$dex=8\r\n\t\t$con=8\r\n\t\t$int=8\r\n\t\t$wis=8\r\n\t\t$cha=8\r\n\t\t$maxVit=8\r\n\t\t$vit=8\r\n\t\t$atk=($lvl*0.75) #base attack\r\n\t\t$defenseBonus=2\r\n\r\n\telsif $class == 3 #Scoundrel\r\n\t\t$str=8\r\n\t\t$dex=8\r\n\t\t$con=8\r\n\t\t$int=8\r\n\t\t$wis=8\r\n\t\t$cha=8\r\n\t\t$maxVit=6\r\n\t\t$vit=6\r\n\t\t$atk=($lvl*0.75) #base attack\r\n\t\t$defenseBonus=4\r\n\t\t\r\n\telse\r\n\t\t$vit = 6\r\n\t\t$maxVit = 6\r\n\t\r\n\r\n\tend\r\n\r\nend",
"def profile=(_arg0); end",
"def abilities\n\t\t\t@abilities ||= {}\n\t\tend",
"def hero_ability(target)\n case\n when @hero_class == 'druid'\n @attack = 1\n @armour = amour + 1\n when @hero_class == 'hunter'\n target.health = target.health - 2\n when @hero_class == 'mage'\n target.health = target.health - 2\n when @hero_class == 'paladin'\n @battlefield.push(\"Silver Hand Recruit\")\n when @hero_class == 'priest'\n target.health = target.health + 2\n when @hero_class == 'rouge'\n @weapon = \"Dagger Mastery\"\n when @hero_class == 'shaman'\n totems = ['Healing Totem', 'Searinhg Totem', 'Stoneclaw Totem', 'Wrath of Air Totem']\n @battlefield.push(totems.sample)\n when @hero_class == 'warlock'\n darw_card(2)\n @health = @health - 2\n when @hero_class == 'warrior'\n @armour = @armour + 2\n end\n end",
"def base_atk\n return $data_enemies[@enemy_id].atk\n end",
"def virus_effects\r\n predicted_deaths()\r\n speed_of_spread()\r\n end",
"def virus_effects\r\n predicted_deaths()\r\n speed_of_spread()\r\n end",
"def define_tag_setter_methods\n @tags.keys.each do |tag_name|\n next if respond_to? :\"#{tag_name}=\"\n if tag_name =~ /karma:(.*)/\n class_eval %{\n def karma\n def #{$1}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n end\n }\n else\n class_eval %{\n def #{tag_name}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n }\n end \n end\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def skill_effect_damagefix\r\n self.damage = nil unless $game_temp.in_battle\r\n end",
"def weapon; end",
"def weapon; end",
"def weapon; end",
"def add_weapon(weapon)\n add_speed, add_strength, add_intelligence, add_health = weapon.get_attributes()\n @speed += add_speed\n @strength += add_strength\n @intelligence += add_intelligence\n @health += add_health\n end",
"def skill_effect_base_damage(power, rate)\r\n self.damage = power * rate / 20\r\n end",
"def virus_effects\r\n predicted_deaths\r\n speed_of_spread\r\n end",
"def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"def virus_effects\n # predicted_deaths(@population_density, @population, @state)\n # speed_of_spread(@population_density, @state)\n predicted_deaths\n speed_of_spread\n end",
"def setup_damage\n return if item_in_use.nil?\n item = copy(item_in_use) \n # Copy item. In case if you want to modify anything\n \n # ----- Evaluate skill ------- #\n if @acts[1].is_a?(String) # Change formula? No prob ~\n item.damage.formula = @acts[1]\n elsif @acts[1].is_a?(Integer) # Skill link? No prob ~\n item = $data_skills[@acts[1]]\n elsif @acts[1].is_a?(Float) # Rescale damage? No prob ~\n item.damage.formula = \"(#{item.damage.formula}) * #{@acts[1]}\"\n end\n \n # ------- Check target scope ------- #\n if area_flag && target_array\n # Damage to all targets ~\n target_array.uniq.each do |target|\n get_scene.tsbs_invoke_item(target, item, self)\n # Check animation guard\n if !item.ignore_anim_guard? && item.parallel_anim?\n target.anim_guard = target.anim_guard_id\n target.anim_guard_mirror = target.flip\n end\n end\n elsif target\n # Damage to single target\n get_scene.tsbs_invoke_item(target, item, self)\n # Check animation guard\n if !item.ignore_anim_guard? && item.parallel_anim?\n target.anim_guard = target.anim_guard_id\n target.anim_guard_mirror = target.flip\n end\n end\n end",
"def attributes!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = ATTRIBUTES\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 147:4: 'attributes'\n match( \"attributes\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end",
"def instrument_additional_methods\n instrument_save_methods\n instrument_relation_methods\n end",
"def attr_inspector(*attrs)\n @inspectables = attrs\n end",
"def attr_inspector(*attrs)\n @inspectables = attrs\n end",
"def attr_writer(name)\n meth = Rubinius::AccessVariable.set_ivar name\n @method_table.store \"#{name}=\".to_sym, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end",
"def potion; end",
"def attack_town\n @health += 50\n self\n end",
"def melee_weapon; end"
] | [
"0.6494662",
"0.6084706",
"0.60470086",
"0.5999071",
"0.5985195",
"0.5982514",
"0.5951439",
"0.5951439",
"0.5951439",
"0.58382714",
"0.57350683",
"0.56987786",
"0.5691484",
"0.56629795",
"0.5614321",
"0.55811626",
"0.55712205",
"0.5570128",
"0.55580795",
"0.5519975",
"0.55023116",
"0.5501084",
"0.5500249",
"0.5498633",
"0.5487666",
"0.54809856",
"0.5478181",
"0.5473912",
"0.54725134",
"0.54650164",
"0.5455444",
"0.5430405",
"0.54248834",
"0.5412685",
"0.54085433",
"0.54085433",
"0.5394342",
"0.53773665",
"0.5371152",
"0.5366182",
"0.5366182",
"0.5349778",
"0.5341425",
"0.53380203",
"0.5336937",
"0.53281647",
"0.53238803",
"0.53234494",
"0.532339",
"0.53223294",
"0.53212726",
"0.53083843",
"0.53023535",
"0.5298886",
"0.5298886",
"0.52981704",
"0.5288137",
"0.5288137",
"0.52834916",
"0.5282778",
"0.5263116",
"0.52592075",
"0.52552587",
"0.5253967",
"0.5253967",
"0.5253967",
"0.5253967",
"0.5253967",
"0.525123",
"0.52484524",
"0.52440006",
"0.5241709",
"0.52272564",
"0.52262276",
"0.52173936",
"0.5215422",
"0.52152646",
"0.52030724",
"0.52030283",
"0.520223",
"0.5192931",
"0.5192931",
"0.51868993",
"0.51822335",
"0.51822335",
"0.51822335",
"0.51806444",
"0.5180115",
"0.51657885",
"0.51617044",
"0.51587045",
"0.5154788",
"0.51522654",
"0.51504385",
"0.5149148",
"0.5149148",
"0.5144531",
"0.513871",
"0.5137806",
"0.513603"
] | 0.54402775 | 31 |
implementation of encapsulation attribute reader method | def profile()
puts "#{@name} has #{@hitpoint} and #{@attack_damage} attack damage"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_attribute(key); end",
"def set_attributes_to_reader\n if !@attributes.empty?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend",
"def attr_reader(sym, *more) end",
"def _read_attribute(attr)\n @attributes[attr]\n end",
"def attr_reader(*)\n end",
"def _read_attribute(attr_name, &block) # :nodoc:\n @attributes.fetch_value(attr_name, &block)\n end",
"def define_attr_reader(name)\n define_method(name) do\n instance_variable_get(\"@#{name}\")\n end\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def attr(name); end",
"def attr; end",
"def read_attribute(attr)\n if attribute_encrypted?(attr)\n conductor_for(attr).decrypt\n else\n super(attr)\n end\n end",
"def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end",
"def attribute(name); end",
"def define_reader_for_role(rolekey)\n attr_reader rolekey\n private rolekey\n end",
"def attr_reader_tag(text); end",
"def read(object, attribute, ivar = T.unsafe(nil)); end",
"def read_attribute(symbol)\n @__attribs__ ||= {}\n @__attribs__[symbol]\n end",
"def read_attr(name, record=false)\n result =\n case value = instance_variable_get(\"@#{name}\")\n when nil\n yield if block_given?\n when Proc\n value.to_proc.call(self)\n else\n value\n end\n instance_variable_set(\"@#{name}\", result) if record\n result\n end",
"def add_attr_reader(attr_name, column_type)\n=begin\n\t\t\t\t\tif column_type == :text then\n\t\t\t\t\t\tdefine_method(\"#{attr_name}\") do\n\t\t\t\t\t\t\tvalue = read_attribute(attr_name.to_s)\n\t\t\t\t\t\t\t# if the value de-serialized is false, it means a \"\"\n\t\t\t\t\t\t\tif value == false || value == 0 then\n\t\t\t\t\t\t\t\tvalue = \"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n=end\n\t\t\t\tend",
"def define_attribute_reader(name, value=nil, &block)\n\t klass = @sketch.respond_to?(:define_method, true) ? @sketch : @sketch.class\n\t name, value = name.flatten if name.is_a?(Hash)\n\t if value || block_given?\n\t\t@attribute_defaults[name] = value || block\n\t\t@sketch.instance_variable_set('@' + name.to_s, value || instance_eval(&block))\n\t end\n\t klass.send :define_method, name do\n\t\tinstance_variable_get('@' + name.to_s)\n\t end\n\t @attribute_getters[name] = klass.instance_method(name)\n\tend",
"def custom_reader(key); end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def define_read_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}; read_attribute('#{attr_name}'); end\" \n end",
"def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end",
"def attr_info; end",
"def read_attribute(attr_name) #:doc:\n if @attributes.keys.include? attr_name\n if column = column_for_attribute(attr_name)\n @attributes[attr_name] = unserializable_attribute?(attr_name, column) ?\n unserialize_attribute(attr_name) : column.type_cast(@attributes[attr_name])\n end\n \n @attributes[attr_name]\n else\n nil\n end\n end",
"def readable_attributes \n return attributes if permitted_to?(ReadAllPrivilege)\n attributes.reject do |k,v|\n !allowed?(:read, k)\n end\n end",
"def inherited_reader(*attributes)\r\n attributes.each do |attribute|\r\n line = __LINE__ + 1\r\n class_eval %Q{\r\n def raw_#{attribute} # def raw_css_dir\r\n @#{attribute} # @css_dir\r\n end # end\r\n def #{attribute}_without_default # def css_dir_without_default\r\n read_without_default(#{attribute.inspect}) # read_without_default(:css_dir)\r\n end # end\r\n def #{attribute} # def css_dir\r\n read(#{attribute.inspect}) # read(:css_dir)\r\n end # end\r\n }, __FILE__, line\r\n end\r\n end",
"def define_reader_method(mod)\n reader_method_name = name\n attribute = self\n\n mod.send(:define_method, reader_method_name) { attribute.get(self) }\n mod.send(reader_visibility, reader_method_name)\n\n self\n end",
"def dataset_reader(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(attr_name)\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}\n dataset_get(:#{attr_name})\n end\n RUBY\n end\n end",
"def read_attribute(attr_name, &block)\n return super unless attr_name.to_s == 'id' && @primary_key.to_s == 'hid'\n\n _read_attribute('id', &block)\n end",
"def read_attribute\n record.public_send(attribute)\n end",
"def read_attribute(attr_name, &block)\n name = if self.class.attribute_alias?(attr_name)\n self.class.attribute_alias(attr_name).to_s\n else\n attr_name.to_s\n end\n\n primary_key = self.class.primary_key\n name = primary_key if name == \"id\" && primary_key\n sync_with_transaction_state if name == primary_key\n _read_attribute(name, &block)\n end",
"def read_attribute(attr_name)\n return unless attr_name\n\n attr_name = attr_name.to_s\n methods = self.class.generated_external_attribute_methods\n\n if methods.method_defined?(attr_name)\n if @attributes.has_key?(attr_name) || attr_name == 'id'\n methods.send(attr_name, @attributes[attr_name], @attributes, @attributes_cache, attr_name)\n end\n elsif !self.class.attribute_methods_generated?\n # If we haven't generated the caster methods yet, do that and\n # then try again\n self.class.define_attribute_methods\n read_attribute(attr_name)\n else\n # If we get here, the attribute has no associated DB column, so\n # just return it verbatim.\n @attributes[attr_name]\n end\n end",
"def set_attr_with_readers! hash\n hash.each_pair { |symbol, value|\n instance_variable_set \"@#{symbol}\", value\n singleton_class.class_exec { attr_reader symbol }\n }\n end",
"def metaattr_reader(*meths)\n metaclass.instance_eval{attr_reader(*meths)}\n end",
"def read(attrs)\n new(attrs).instance_eval do\n @new_record = false\n @dirty = false\n self\n end\n end",
"def instance_read(attr)\n getter = :\"#{@name_string}_#{attr}\"\n instance.send(getter) if instance.respond_to?(getter)\n end",
"def make_reader( attrtype )\n\t\tself.log.debug \"Generating an attribute reader for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\treturn lambda do |*args|\n\t\t\tif args.empty?\n\t\t\t\tself[ attrname ]\n\t\t\telse\n\t\t\t\tself.traverse_branch( attrname, *args )\n\t\t\tend\n\t\tend\n\tend",
"def create_reader(klass, member); end",
"def readonly_attributes\n read_inheritable_attribute(:attr_readonly)\n end",
"def read_attribute(key)\n if type = namespace.attribute_type(key)\n key = type.names.first\n else\n key = Ldaptic.encode(key)\n end\n @attributes[key] ||= ((@original_attributes || {}).fetch(key, [])).dup\n Ldaptic::AttributeSet.new(self, key, @attributes[key])\n end",
"def define_reader_method(attribute, method_name, visibility)\n define_method(method_name) { attribute.get(self) }\n send(visibility, method_name)\n self\n end",
"def read_attribute(attr_name, &block)\n name = attr_name.to_s\n name = self.class.attribute_aliases[name] || name\n\n return @attributes.fetch_value(name, &block) unless name == \"id\" && @primary_key\n\n if self.class.composite_primary_key?\n @attributes.fetch_value(\"id\", &block)\n else\n if @primary_key != \"id\"\n ActiveRecord.deprecator.warn(<<-MSG.squish)\n Using read_attribute(:id) to read the primary key value is deprecated.\n Use #id instead.\n MSG\n end\n @attributes.fetch_value(@primary_key, &block)\n end\n end",
"def attribute(key, type = nil)\n reader = :\"#{key}\"\n writer = :\"#{key}=\"\n\n define_method(reader) do\n self.attributes[reader]\n end\n\n define_method(writer) do |value|\n self.attributes[reader] = value\n end\n end",
"def my_attr_reader(*args)\n\targs.each do |a|\n\t\tself.class_eval do\n\t\t\tinstance_variable_set \"@#{a}\", nil\n\t\t\tdefine_method a do\n\t\t\t\tinstance_variable_get \"@#{a}\"\n\t\t\tend\n\t\tend\n\tend\nend",
"def attr_reader(*fields)\n check_fields(fields)\n added_fields = jiak.data.readable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}\n @jiak.object.data.#{field}\n end\n EOM\n end\n nil\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def private_attr_reader(*method_names)\n attr_reader(*method_names)\n private(*method_names)\n end",
"def delegate_object_reader_method; end",
"def read_attribute(attr_name)\n attr_name = attr_name.to_sym\n\n @attributes_cache[attr_name] || @attributes_cache.fetch(attr_name) do\n data = @attributes.fetch(attr_name) do\n # This statement overrides id to return the primary key\n # if it is set to something other than :id\n if attr_name == :id && self.class.primary_key != attr_name\n return read_attribute(self.class.primary_key)\n end\n\n # For some reason hashes return false for key? if the value\n # at that key is nil. It also executes this block for fetch\n # when it really shouldn't. Detect that error here and give\n # back nil for data\n if @attributes.keys.include?(attr_name)\n nil\n else\n # In this case the attribute was truly not found, if we're\n # given a block execute that otherwise return nil\n return block_given? ? yield(attr_name) : nil\n end\n end\n # This sets and returns the typecasted value\n @attributes_cache[attr_name] = self.typecast_attribute_for_read(\n attr_name,\n data\n )\n end\n end",
"def read_attribute(name)\n fields[name].get(@attributes[name])\n end",
"def instance_read(attr)\n getter = :\"#{name}_#{attr}\"\n responds = instance.respond_to?(getter)\n cached = self.instance_variable_get(\"@_#{getter}\")\n return cached if cached\n instance.send(getter) \n end",
"def underbang_reader(key); end",
"def reader; end",
"def define_read_method(symbol, attr_name, column)\n\n cast_code = column.type_cast_code('v') if column\n access_code = cast_code ? \"(v=@attributes['#{attr_name}']) && #{cast_code}\" : \"@attributes['#{attr_name}']\"\n\n unless attr_name.to_s == self.primary_key.to_s\n access_code = access_code.insert(0, \"missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); \")\n end\n\n # This is the Hobo hook - add a type wrapper around the field\n # value if we have a special type defined\n if can_wrap_with_hobo_type?(symbol)\n access_code = \"val = begin; #{access_code}; end; wrapper_type = self.class.attr_type(:#{attr_name}); \" +\n \"if HoboFields.can_wrap?(wrapper_type, val); wrapper_type.new(val); else; val; end\"\n end\n\n if cache_attribute?(attr_name)\n access_code = \"@attributes_cache['#{attr_name}'] ||= begin; #{access_code}; end;\"\n end\n\n generated_attribute_methods.module_eval(\"def #{symbol}; #{access_code}; end\", __FILE__, __LINE__)\n end",
"def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end",
"def get_attributes\n h = {}\n if @reader.has_attributes?\n if @reader.move_to_first_attribute == 1\n h[@reader.name] = @reader.value\n while @reader.move_to_next_attribute == 1\n h[@reader.name] = @reader.value\n end\n end\n @reader.move_to_element # reset main pointer in libxml\n end\n # p h\n h\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attribute_for_audience(attr, audience)\n return read_attribute(attr) if audience.nil?\n audience = Event.process_audience(audience)\n audience = :Student if audience == :Participant\n read_attribute(audience.to_s.downcase + \"_\" + attr.to_s)\n end",
"def read_only_attribute(name, options={}, &block)\n name = name.to_s\n\n attr_accessors.send :define_method, name do\n value = read_attribute(name)\n value.nil? ? options[:default] : value\n end unless attr_accessors.instance_methods.include?(name)\n self.send :define_method, name, &block if block_given?\n\n enforce_type(name, options[:type]) if options[:type]\n\n define_attribute_method name\n self._read_only_attributes |= [name]\n\n nil\n end",
"def attribute\n @attribute ||= Pod::Specification::DSL.attributes.find { |attr| attr.reader_name.to_s == name }\n end",
"def attributes(*attrs)\n @attributes = attrs\n attr_reader(*attrs)\n end",
"def read_original_attribute(attr_name)\n ensure_original_attributes_stored\n attr_name = attr_name.to_s\n \n if excluded_attribute?(attr_name)\n read_attribute(attr_name)\n else\n if !(value = @original_attributes[attr_name]).nil?\n if column = column_for_attribute(attr_name)\n if unserializable_attribute?(attr_name, column)\n unserialize_attribute(attr_name)\n else\n column.type_cast(value)\n end\n else\n value\n end\n else\n nil\n end\n end\n end",
"def parse_attr_accessor(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg\n rw = \"?\"\n\n tmp = RDoc::CodeObject.new\n read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS\n # TODO In most other places we let the context keep track of document_self\n # and add found items appropriately but here we do not. I'm not sure why.\n return if @track_visibility and not tmp.document_self\n\n case tk[:text]\n when \"attr_reader\" then rw = \"R\"\n when \"attr_writer\" then rw = \"W\"\n when \"attr_accessor\" then rw = \"RW\"\n else\n rw = '?'\n end\n\n for name in args\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n end\n end",
"def attr_reader?(name)\n (instance_methods | private_instance_methods).include?(name)\n end",
"def [](attr_name) \n read_attribute(attr_name)\n end",
"def load\n @content = @reader.read\n if @content.nil?\n return\n end\n @attribute_storage = {}\n attributes = @content.first.class.attributes\n attributes.each do |key, attribute|\n if attribute.options.has_key? :storage\n @attribute_storage[key] = attribute.options[:storage].new\n else\n @attribute_storage[key] = Hash.new\n end\n end\n @content.each do |doc|\n add_doc doc\n end\n end",
"def [](attr_name)\n read_attribute(attr_name)\n end",
"def read_attribute(key)\n @attributes[key]\n end",
"def read_attribute(key)\n @attributes[key]\n end",
"def is_attribute?; end",
"def attributes=(_arg0); end",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def initializing_reader(key); end",
"def read_attribute_for_validation(key)\n super\n end",
"def read_attribute_for_validation(key)\n super\n end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def read_attr(anno, res, col, offset = 0)\n if anno[:class].ancestor? Integer\n self.class.parse_int(res[col + offset])\n elsif anno[:class].ancestor? Float\n self.class.parse_float(res[col + offset])\n elsif anno[:class].ancestor? String\n res[col + offset]\n elsif anno[:class].ancestor? Time\n self.class.parse_timestamp(res[col+ offset])\n elsif anno[:class].ancestor? Date\n self.class.parse_date(res[col + offset])\n elsif anno[:class].ancestor? TrueClass\n self.class.parse_boolean(res[col + offset])\n elsif anno[:class].ancestor? Og::Blob\n self.class.parse_blob(res[col + offset])\n else\n if res[col+offset].nil? or res[col+offset].empty?\n return nil\n else\n return YAML::load(res[col + offset])\n end\n end\n end",
"def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end"
] | [
"0.7211231",
"0.699463",
"0.694054",
"0.6804783",
"0.6657404",
"0.6654877",
"0.65958893",
"0.65935606",
"0.65935606",
"0.6572367",
"0.657057",
"0.6535748",
"0.6505798",
"0.6481784",
"0.6450294",
"0.6431738",
"0.64302325",
"0.63963467",
"0.6390249",
"0.6374584",
"0.637208",
"0.6366181",
"0.634243",
"0.634243",
"0.634243",
"0.634243",
"0.634243",
"0.634243",
"0.634243",
"0.63027316",
"0.6290245",
"0.62711734",
"0.6265487",
"0.6263013",
"0.6220449",
"0.62144804",
"0.6160037",
"0.61558557",
"0.61380744",
"0.612225",
"0.6084517",
"0.6082947",
"0.6082376",
"0.60785353",
"0.60690165",
"0.6068868",
"0.6062091",
"0.6061397",
"0.6025037",
"0.60056025",
"0.6004263",
"0.5982816",
"0.59776944",
"0.59673077",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.59577405",
"0.5953585",
"0.5953452",
"0.5951387",
"0.59507185",
"0.593609",
"0.5934436",
"0.5924457",
"0.59185046",
"0.59144664",
"0.5900147",
"0.589666",
"0.589666",
"0.589666",
"0.58917505",
"0.5891282",
"0.58885974",
"0.588743",
"0.5880562",
"0.5868415",
"0.5847467",
"0.58414906",
"0.58302975",
"0.5818365",
"0.5814762",
"0.5814762",
"0.579812",
"0.5796091",
"0.5793195",
"0.5791341",
"0.5789764",
"0.5789764",
"0.5785216",
"0.5782077",
"0.57817745",
"0.5779508",
"0.5779508"
] | 0.0 | -1 |
implementation of encapsulation encapsulation is hide the internal represantion or state of an object | def reduce_hitpoint(damage)
@hitpoint -= damage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def internal; end",
"def private=(_); end",
"def delegate_object_reader_method; end",
"def expose; end",
"def isolated; end",
"def isolated; end",
"def accessibility; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def private_method; end",
"def private_method\n end",
"def public; end",
"def public; end",
"def decorated_object_behavior\n #code\n end",
"def under_construction\n end",
"def implementation; end",
"def implementation; end",
"def intern_state\n super\n end",
"def set_private(data)\n res = super(self,data)\n return res\n end",
"def private_model; @private_model = true end",
"def expose=(_arg0); end",
"def hack\n self.price = 200\n end",
"def public=(_arg0); end",
"def record; end",
"def record; end",
"def record; end",
"def to_none\n self.public = true\n end",
"def object\n raise NotImplementedError\n end",
"def transient=(_arg0); end",
"def ob\n return self.class.ob\n end",
"def retain()\n res = super(self)\n end",
"def retain()\n res = super(self)\n end",
"def retain()\n res = super(self)\n end",
"def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"def __setobj__(obj); end",
"def extra_state; end",
"def public_method; end",
"def internal?; end",
"def instance=(instance); end",
"def freeze\n __getobj__.freeze\n super()\n end",
"def __setobj__\n raise \"ObjectProxy does not support changing referenced object\"\n end",
"def get_private()\n res = super(self)\n return res\n end",
"def original; end",
"def instance_cache; end",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def modify\n super\n end",
"def private_method\n\tend",
"def private_method\n\tend",
"def transient?; end",
"def internal_methods; end",
"def full_object\n fail NotImplementedError\n end",
"def contract; end",
"def contract; end",
"def code_of_conduct; end",
"def __getobj__\n raise \"Abstract class requires implementation\"\n end",
"def abstract!; end",
"def __getobj__; end",
"def dup\n super().extend IndifferentAccess\n end",
"def attr_reader(*)\n end",
"def __object\n __value\n end",
"def __getobj__\n end",
"def wrapper; end",
"def delegate_object; end",
"def a_private_method\n\tend",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def protected_method\n end",
"def implementation=(implementation); end",
"def object\n @obj\n end",
"def __setobj__(obj)\n __raise__ ::NotImplementedError, \"need to define `__setobj__'\"\n end",
"def attr_accessor( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"def same; end",
"def __delegate\n@o\nend",
"def instance_variables; end",
"def instance; end",
"def instance; end"
] | [
"0.6926775",
"0.67813987",
"0.67750967",
"0.6600834",
"0.6482705",
"0.644682",
"0.644682",
"0.64030313",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.62951356",
"0.6281346",
"0.62021",
"0.6186916",
"0.6186916",
"0.61314636",
"0.6114529",
"0.61144054",
"0.61144054",
"0.6068491",
"0.6029015",
"0.6022868",
"0.59735125",
"0.59594333",
"0.59449106",
"0.58898103",
"0.58898103",
"0.58898103",
"0.58883154",
"0.5877381",
"0.5870742",
"0.5870169",
"0.5856405",
"0.5856405",
"0.5856405",
"0.58430314",
"0.58406156",
"0.583897",
"0.5767403",
"0.57672286",
"0.5763501",
"0.576323",
"0.5751017",
"0.5749403",
"0.5741822",
"0.5740146",
"0.5731573",
"0.5731573",
"0.5731573",
"0.5731573",
"0.57214195",
"0.57214195",
"0.57214195",
"0.57214195",
"0.57214195",
"0.57214195",
"0.57214195",
"0.57214195",
"0.5720576",
"0.57196593",
"0.57196593",
"0.57130504",
"0.5707014",
"0.57051456",
"0.5700919",
"0.5700919",
"0.5697613",
"0.5693938",
"0.56920457",
"0.56650466",
"0.56629854",
"0.5661327",
"0.56598854",
"0.5656551",
"0.5654888",
"0.56547517",
"0.5650598",
"0.56468546",
"0.56468546",
"0.5642735",
"0.5635557",
"0.5632175",
"0.56187874",
"0.5613538",
"0.56048775",
"0.55933887",
"0.5590124",
"0.55761",
"0.55761"
] | 0.0 | -1 |
creates a sorting link (used in table headers), swapping asc/desc | def sortable(column, title = nil)
title ||= column.titleize
direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc"
link_to title, :sort => column, :direction => direction
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_sort_link(text, sort)\n link_to(text, :sort => sort, \n :order => params[:order] == 'desc' ? 'asc' : 'desc', \n :page => params[:page] ||= 1, \n :daysprune => params[:daysprune] ||= -1\n )\n end",
"def sortable(column, title)\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end",
"def sortable(column,title=nil)\n title ||=column.titleize\n direction = column==sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, :sort => column,:direction => direction\nend",
"def table_sort(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column_string && sort_direction_string == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end",
"def link_to_sortable_column_header(field, order_by, sort_order, name)\n if order_by == field.to_s\n sort_order = (sort_order || '').upcase == 'DESC' ? 'ASC' : 'DESC'\n arrow = (sort_order == 'ASC') ? 'down' : 'up' \n else\n sort_order = 'ASC'\n arrow = nil\n end\n new_params = params.merge(:order_by => field.to_s, :sort_order => sort_order)\n html = link_to(name, new_params)\n html << image_tag(\"/tog_core/images/ico/arrow-#{arrow}.gif\") if arrow\n html\n end",
"def sort_link(*args)\n\t\toptions = {\n\t\t\t:image => true\n\t\t}.merge(args.extract_options!)\n\t\tcolumn = args[0]\n\t\ttext = args[1]\n\t\t#\tmake local copy so mods to muck up real params which\n\t\t#\tmay still be references elsewhere.\n\t\tlocal_params = params.dup\n\n#\n#\tMay want to NOT flip dir for other columns. Only the current order.\n#\tWill wait until someone else makes the suggestion.\n#\n\t\torder = column.to_s.downcase.gsub(/\\s+/,'_')\n\t\tdir = ( local_params[:dir] && local_params[:dir] == 'asc' ) ? 'desc' : 'asc'\n\n\t\tlocal_params[:page] = nil\n\t\tlink_text = text||column\n\t\tclasses = ['sortable',order]\n\t\tarrow = ''\n\t\tif local_params[:order] && local_params[:order] == order\n\t\t\tclasses.push('sorted')\n\t\t\tarrow = if dir == 'desc'\n\t\t\t\tif File.exists?( sort_down_image ) && options[:image]\n\t\t\t\t\timage_tag( File.basename(sort_down_image), :class => 'down arrow')\n\t\t\t\telse\n\t\t\t\t\t\"<span class='down arrow'>↓</span>\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif File.exists?( sort_up_image ) && options[:image]\n\t\t\t\t\timage_tag( File.basename(sort_up_image), :class => 'up arrow')\n\t\t\t\telse\n\t\t\t\t\t\"<span class='up arrow'>↑</span>\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ts = \"<div class='#{classes.join(' ')}'>\"\n\t\ts << link_to(link_text,local_params.merge(:order => order,:dir => dir))\n\t\ts << arrow unless arrow.blank?\n\t\ts << \"</div>\"\n\t\ts.html_safe\n#\tNOTE test this as I suspect that it needs an \"html_safe\" added\n\tend",
"def sort_link_for(title, sort_method, action=:list)\n link_to title, {:action => action, :order_by => sort_method, :order => (@order_by == sort_method) ? 'desc' : 'asc'},\n {:class => 'tooltip', :title => \"Sort By #{title}\", :id => \"header-#{title.downcase.gsub(' ', '-')}\"}\n end",
"def sortable(sort_sym, column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column(sort_sym) ? \"current #{sort_direction}\" : nil\n direction = column == sort_column(sort_sym) && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n end",
"def sort_links\n resource_service.sortable_fields.collect do |key,value|\n \tlink_to key, params.dup.update(:sort => key), :class => ((params[:sort].to_s==key.to_s) ? 'current' : '')\n end.join(' | ')\n end",
"def sort_link(inner_text, sort_variable, opts = {})\n sort_direction = (sort_variable == @search_opts['sort'] and @search_opts['sort_direction'] != 'down') ? 'down' : 'up'\n arrow = (sort_variable == @search_opts['sort']) ? (@search_opts['sort_direction'] == 'down') ? image_tag('site/arrow_desc.gif') : image_tag('site/arrow_asc.gif') : ''\n link_to(inner_text, @search_opts.merge('sort' => sort_variable, 'sort_direction' => sort_direction).merge(opts)) + arrow\n end",
"def link_sort_header(column_translation_code )\n #title ||= column.titleize\n if column_translation_code.index('.') then\n column=column_translation_code.split.last\n else\n column=column_translation_code\n end\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n # need to add back the sqlinjection protection here\n #css_class = \"current #{sort_direction}\" \n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to tlabel(column_translation_code), {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sort_link_helper(text,param,action)\n key = param\n key += \"_reverse\" if params[:sort] == param\n options = {\n :url => {:action => action, :params => params.merge({:sort => key, :page => nil})},\n :method=>\"POST\"\n }\n html_options = {\n :title => \"Sort by this field\",\n :href => url_for(:action => 'list', :params => params.merge({:sort => key, :page => nil})),\n :class=> \"sort\"\n }\n link_to(text, options, html_options)\n end",
"def sort_header(label, options={})\n if @order.nil? || @order.split(' ').first != options[:field]\n # this is the default direction\n direction = options[:direction] || 'DESC'\n else\n # current field, so let's invert the direction\n direction = (@order.split(' ').last == 'ASC') ? 'DESC' : 'ASC'\n end\n\n # defines the HTML class for the link, based on the direction of the link\n if @order.split(' ').first == options[:field]\n html_class = {'ASC' => 'descending', 'DESC' => 'ascending'}[direction]\n end\n link_to label, url_for(sort_field: options[:field],\n sort_direction: direction,\n tab: options[:tab]), :class => html_class\n end",
"def sort_link(title, column=nil, options = {})\n condition = options[:unless] if options.has_key?(:unless)\n\n unless column.nil?\n current_column = (params[:sort_column] == column.to_s) || params[:sort_column].blank? && options[:sort_default]\n css_class = current_column ? \"current\" : nil\n if current_column # explicitly or implicitly doing the existing sorting, so we need to toggle\n if params[:sort_direction]\n direction = params[:sort_direction].to_s.upcase == 'ASC' ? 'DESC' : 'ASC'\n else \n direction = options[:desc_default] ? 'ASC' : 'DESC'\n end\n else\n direction = options[:desc_default] ? 'DESC' : 'ASC'\n end\n link_to_unless condition, ((direction == 'ASC' ? '↑<span class=\"landmark\">ascending</span> ' : '↓<span class=\"landmark\">descending</span> ') + title).html_safe, \n request.parameters.merge( {:sort_column => column, :sort_direction => direction} ), {:class => css_class}\n else\n link_to_unless params[:sort_column].nil?, title, url_for(params.merge :sort_column => nil, :sort_direction => nil)\n end\n end",
"def sort_table column, human_name, date_param = nil\n\t\thtml = \"\"\n\t\t\n\t\t# if already sorting by this column then it reverses the sort\n\t\tif (request.url.include? column) && !(request.url.include? \"DESC\")\n\t\t\tif date_param\n\t\t\t\t# TODO: Return from this depth, makes for a simpler function\n\t\t\t\thtml << (link_to human_name, :sort => column + \" DESC\", :date => date_param).html_safe\n\t\t\telse\n\t\t\t\thtml << (link_to human_name, :sort => column + \" DESC\").html_safe\n\t\t\tend\n\t\telse\n\t\t\tif date_param\n\t\t\t\thtml << (link_to human_name, :sort => column, :date => date_param).html_safe\n\t\t\telse\n\t\t\t\thtml << (link_to human_name, :sort => column).html_safe\n\t\t\tend\n\t\tend\n\t\t\n\t\thtml.html_safe\n\tend",
"def direction_link\n link_to_function \"<span class='asc' title='#{t(\"winnow.sort_direction.ascending_tooltip\")}'>#{t(\"winnow.sort_direction.ascending\")}</span><span class='desc' title='#{t(\"winnow.sort_direction.descending_tooltip\")}'>#{t(\"winnow.sort_direction.descending\")}</span>\", \"\", :id => \"direction\"\n end",
"def sort_column(title, path, table, field, order, ascending)\n path = path[0..(path.index(\"table=\")-2)] if path.index(\"table=\")\n if path.index(\"?\").nil?\n path = path + \"?\"\n else\n path = path + \"&\"\n end\n return link_to title, path + \n \"table=#{table}&order=#{field}¤t_order=#{order}&ascending=#{ascending}\"\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_asc_or_desc}\" : nil\n direction = column == sort_column && sort_asc_or_desc == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :asc_or_desc => direction}, {:class => css_class}\n end",
"def sort_link_helper(text, param, action, title = I18n.t('Sistema.Body.General.ordenar_por_este_campo'))\n key = param\n if params[:sort] == param\n title.concat(I18n.t('Sistema.Body.General.de_forma_descendente'))\n key += \" DESC\"\n else\n title.concat(I18n.t('Sistema.Body.General.de_forma_ascendente'))\n end\n params.delete(:controller);\n\n options = {\n :loading =>'image_load()',\n :loaded => 'image_unload()',\n :url => {:action => action, :params => params.merge({:sort => key, :page => nil, :method => :get })}\n\n }\n html_options = {\n :title => title,\n :href => \"/\" + url_for(:action => action, :params => params.merge({:sort => key, :page => nil, :method => :get}))\n }\n link_to_remote(text, options, html_options)\n end",
"def sortlink(label, param)\n\t if params[:order] == param\n\t link_to raw(\"#{label} ↓\"), \"#{request.path}?order=#{param} desc\"\n\t elsif params[:order] == \"#{param} desc\"\n\t link_to raw(\"#{label} ↑\"), \"#{request.path}?order=#{param}\"\n\t else\n link_to label, \"#{request.path}?order=#{param}\"\n end\n end",
"def sorter_link(name, param, url)\n opts = {}\n route_opts = { :order => param , :order_type => \"asc\" }\n if param == params[:order] || (!params[:order] && param == 'date-added')\n opts[:class] = \"current #{route_opts[:order_type]}\"\n #reverse\n route_opts[:order_type] = (params[:order_type] == \"asc\" ? \"desc\" : \"asc\" )\n end\n link_to(name, url + \"?\" + route_opts.to_param , opts)\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, url_for(params.merge(:sort => column, :direction => direction)) , {:class => css_class}\n end",
"def sortable(column, title = nil) \n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n # In the link to below we added the :product and :versino aprameters\n # these parameters are added to urls by the search function. For example, see the Execute and Versions page\n # We preserve them for use when a search and then order is selected\n link_to title, {:sort => column, :direction => direction, :product => params[:product], :version => params[:version]}, {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column) && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sortable(column, title = nil, direction)\n title ||= column.titleize\n link_to title, {sort: column, sort_type: direction}, {\"data-remote\" => \"true\"}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n direction = (column == params[:sort] && params[:direction] == \"asc\") ? \"desc\" : \"asc\"\n if column == params[:sort]\n link_to title, { sort: column, direction: direction }, class: params[:direction]\n else\n link_to title, sort: column, direction: direction\n end\n end",
"def sortable(column, title = nil)\n \ttitle ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n \tdirection = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n \tlink_to title, params.merge(:sort => column, :direction => direction, :page => nil),\n \t\t\t\t {:title => \"Sort by #{title}\", :class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : \"current\"\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n #link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n #link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n #link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def sort_link(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'\n icon = sort_direction == 'asc' ? 'fas fa-caret-up' : 'fas fa-caret-down'\n icon = column == sort_column ? icon : ''\n\n parameter = params.permit(:id, :q, :classes, :byquery, :column, :direction)\n .merge(column: column, direction: direction)\n link_to \"#{title} <i class='#{icon}'></i>\".html_safe, parameter\n end",
"def sort_link_helper(text, param)\n params.delete(:action)\n key = param\n key += \"_reverse\" if params[:sort] == param\n options = {\n :url => {:action => 'list', :params => params.merge({:id=> current_user.id,:sort => key, :page => nil, :folder_name => @folder_name})},\n :update => 'pms_tabs_contents',\n }\n html_options = {\n :title => \"Sort by this field\",\n }\n link_to_remote(text, options, html_options)\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n direction_icon = (direction.eql? \"desc\") ? :sort_desc : :sort_asc\n html = link_to(title, users_url(sort: column, direction: direction, page: nil, id: \"\"), { class: css_class })\n html << icon_tag(direction_icon) if column == sort_column\n return html\n end",
"def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end",
"def column_sort_link(title, column, paramval, width, align, options = {},stage=nil,column_name=nil,assigned_to=nil,dropdown=nil)\n params.merge!(:paramval=>paramval)\n options.merge!({:letter => params[:letter]}) unless (params[:letter].nil? || params[:letter].empty?) \n if assigned_to && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n elsif stage && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n else\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'><input type='text' style=#{options[:search_items] ? \"width:60px;\" : \"width:60px;display:none;\"} size='5' value='#{params[:search] ? params[:search][column.sub(\".\",\"--\")] || params[:search][column] : \"\"}' name='search[#{column.sub(\".\",\"--\")}]' id= 'search_#{column.sub(\".\",\"--\")}' /></div></div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n end\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n sorted_column = params.fetch(:sorted, {})[:column]\n sorted_direction = params.fetch(:sorted, {})[:direction]\n\n css_class = (column == sorted_column) ? \"current #{sorted_direction}\" : nil\n direction = (column == sorted_column && sorted_direction == \"asc\") ? \"desc\" : \"asc\"\n\n link_to title, params.merge(sorted: { column: column, direction: direction}), class: css_class\n end",
"def get_sort_href( column_name, current_sort_column, current_sort_dir )\r\n new_sort=column_name.to_s\r\n\r\n if new_sort==current_sort_column.to_s && current_sort_dir=='asc'\r\n new_sort = '-' + new_sort\r\n end \r\n '?' + @query_hash.merge('sort'=>new_sort).to_query\r\n end",
"def sortable_title(field, options={})\n klass = options[:class]\n title = h(options[:title] || (klass || @_sort_klass).human_attribute_name(field))\n\n direction = :asc\n if sort_column == field\n if sort_direction == :asc\n title += \" ↓\".html_safe\n direction = :desc\n else\n title += \" ↑\".html_safe\n end\n end\n\n link_to title, params.merge(sort: field, sort_direction: direction)\n end",
"def sort(table_name, list, sort_by, order, per_page, default)\r\n\r\n if table_name.has_attribute?(sort_by) && (order == \"asc\" || order == \"desc\")\r\n list = list.sort_by{|item| item[sort_by].to_s.downcase}\r\n if order == \"desc\"\r\n list = list.reverse\r\n end\r\n list \r\n else\r\n # default case\r\n list.sort_by{|item| item[default].downcase}\r\n end\r\n\r\n end",
"def orderable_link(contents, field)\n return contents if @object_name.empty?\n field = field.to_s\n\n order_params = (template.params['order'] || {})[@table_name]\n fields = Hash[*order_params.to_a.collect { |field_and_dir| field_and_dir.split(':') }.flatten]\n if @object && @object.default_order[:field].to_s == field\n # TODO: this should technically be fields.empty? && @object.default_order[:options][:stable],\n # but it lends itself to a little bit of an odd behavior unless you're expecting the additive ordering\n fields[field] = fields[field] || @object.default_order[:direction].to_s if fields.empty?\n end\n\n order_params = (template.params['order'] || {}).clone.\n merge({@table_name => [\"#{field}:#{\"#{fields[field] == 'asc' ? 'desc' : 'asc'}\"}\"]})\n\n query = template.params.reject{ |param, value| ['action', 'controller'].include?(param) }\n query.merge!('order' => order_params)\n\n template.content_tag(:a, contents,\n :href => \"?#{query.to_query}\",\n :class => \"#{fields[field] ? fields[field] == 'asc' ? 'ascending' : 'descending' : ''}\")\n end",
"def sortable_header(field, options={})\n dir = 'ASC'\n dir = 'DESC' if options[:descend]\n klass = options[:class_name].constantize if options[:class_name]\n field = field.to_s\n\n cur = if params[:sort].present?\n params[:sort]\n elsif options[:default] && params[:sort].blank?\n \"#{field} #{dir}\"\n end\n if cur\n cur_field, cur_dir = cur.split(/\\s*,\\s*/).first.split /\\s+/\n dir = cur_dir == 'ASC' ? 'DESC' : 'ASC' if cur_field == field\n end\n\n label = if options[:label]\n options[:label]\n elsif klass\n klass.human_attribute_name field\n else\n field.titleize\n end\n\n img = if cur && cur_field == field\n if dir == 'ASC'\n SortableListHelper.asc_img\n else\n SortableListHelper.desc_img\n end\n else\n SortableListHelper.neutral_img\n end\n img = image_tag img, alt: '', border: 0 if img\n\n label = if SortableListHelper.position == :after\n \"#{label} #{img}\"\n else\n \"#{img} #{label}\"\n end if img\n\n # field should in general equal to klass.columns_hash[field].name.\n # But doing the lookup provides a hook allowing for a seperation\n # between the attribute name and the column name. The class could\n # return a hash not indexed by the column name but instead a\n # distinct attribute name.\n if klass && (column = klass.columns_hash[field])\n field = \"#{klass.quoted_table_name}.#{klass.connection.quote_column_name column.name}\"\n end\n\n args = params.merge sort: \"#{field} #{dir}\"\n link_to label.html_safe, args\n end",
"def sort_link(attribute, *args)\n @template.sort_link @object, attribute, *args\n end",
"def smart_table_sortable(text, attribute)\n raise 'smart_table_params must be called on the controller, before using smart_table_sortable helper' unless get_cached_smart_table_params\n\n current_sort_state = get_cached_smart_table_params.sort\n attribute = attribute.to_s\n\n current_sort_attribute, current_sort_order = if current_sort_state.present?\n current_sort_state.downcase.split\n else\n nil\n end\n\n next_sort_order = if current_sort_attribute == attribute\n SORT_ORDERS[(SORT_ORDERS.index(current_sort_order) + 1) % SORT_ORDERS.size]\n else\n SORT_ORDERS.first\n end\n\n link_url = current_request_url_with_merged_query_params(SORT_PARAM => \"#{attribute} #{next_sort_order}\")\n link_class = \"smart-table-link smart-table-sort-link smart-table-sort-link-#{attribute}\"\n link_to link_url, class: link_class, data: {smart_table_remote_link: (true if get_cached_smart_table_params.remote)} do\n text.html_safe + ' ' + (\n if current_sort_attribute == attribute && current_sort_order == 'asc'\n \"<span class='fa fa-sort-down smart-link-sort-arrow-asc'></span>\".html_safe\n elsif current_sort_attribute == attribute && current_sort_order == 'desc'\n \"<span class='fa fa-sort-up smart-link-sort-arrow-desc'></span>\".html_safe\n else\n \"<span class='fa fa-sort smart-link-sort-arrow-unsorted'></span>\".html_safe\n end\n )\n end\n end",
"def sort_link_url(sort_field)\n @args = @args.with_indifferent_access\n query_params = {}\n query_params[:page] = @args[:page] == 'ALL' ? 'ALL' : 1\n query_params[:sort_field] = sort_field\n query_params[:sort_direction] = if @args[:sort_field] == sort_field\n sort_direction.opposite\n else\n sort_direction\n end\n base_url = paginable_base_url(query_params[:page])\n sort_url = URI(base_url)\n sort_url.query = stringify_query_params(**query_params)\n sort_url.to_s\n \"#{sort_url}&#{stringify_nonpagination_query_params}\"\n end",
"def issue_sortable(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column(Issue.column_names, \"title\") && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, { sort: column, direction: direction,\n search: params[:search],\n status: params[:status],\n assigned_user_id: params[:assigned_user_id],\n creator_user_id: params[:creator_user_id] }\n end",
"def manageable_sortable(column, title = nil, options = {})\n title ||= column.titleize\n\n if respond_to?(:sort_column) && respond_to?(:sort_direction)\n css_class = column && sort_column && column.to_sym == sort_column.to_sym ? \"sort_#{sort_direction}\" : nil\n direction = column && sort_column && column.to_sym == sort_column.to_sym && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n options[:class] = [options[:class], css_class].compact.join(\" \")\n\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), options\n else\n title\n end\n end",
"def sortable_heading(heading, column, id)\n link_to(heading,\n { :controller => :movies,\n :sort_order => column,\n :ratings => @selected_ratings\n },\n :id => id)\n end",
"def sort_link_name(sort_field)\n @args = @args.with_indifferent_access\n class_name = 'fas fa-sort'\n dir = 'up'\n dir = 'down' if sort_direction.to_s == 'DESC'\n class_name = \"fas fa-sort-#{dir}\" if @args[:sort_field] == sort_field\n <<~HTML.html_safe\n <i class=\"#{class_name}\"\n aria-hidden=\"true\"\n style=\"float: right; font-size: 1.2em;\">\n\n <span class=\"screen-reader-text\">\n #{format(_('Sort by %{sort_field}'), sort_field: sort_field.split('.').first)}\n </span>\n </i>\n HTML\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == 'asc') ? 'desc' : 'asc'\n icon_name = column == sort_column ? sort_direction == 'asc' ? 'chevron-up' : 'chevron-down' : nil\n link_to \"#{title}#{icon(icon_name)}\".html_safe,\n # when we reorder an list it goes back to the first page\n params.merge(sort: column, direction: direction, page: 1),\n data: { column: column },\n remote: true,\n class: \"sortable #{css_class}\"\n end",
"def sort_link_name(sort_field)\n className = 'fa-sort'\n if @paginable_params[:sort_field] == sort_field\n className = upcasing_sort_direction == 'ASC'? 'fa-sort-asc' : 'fa-sort-desc'\n end\n return raw(\"<i class=\\\"fa #{className}\\\" aria-hidden=\\\"true\\\" style=\\\"float: right; font-size: 1.2em;\\\"></i>\")\n end",
"def sortable_sort\n @sortable_sort\n end",
"def table_header\n print '<table class=\"colors sortable\">', \"\\n\"\n print '<col width=\"15%\"><col width=\"20%\"><col width=\"15%\"><col width=\"50%\">'\n\n print '<tr>'\n print '<th class=\"sorttable_nosort\">Swatch</th>', \"\\n\"\n print '<th class=\"clickable\">Color name</th>', \"\\n\"\n print '<th id=\"hex\" class=\"hidden\">' # fake column for colors\n\n print '<th class=\"sorttable_nosort clickable\">', \"\\n\"\n print \"<span title='Sort by triplet' onclick='sortcol(\\\"hex\\\")'>Hex Triplet</span>\", \"\\n\"\n print \"<img id=\\\"arrow\\\" src='css/images/arrow-both.png'/>\", \"\\n\"\n %w[R G B].each do |letter|\n print \"<span title='Sort by #{letter} value' onclick='sortcol(\\\"#{letter}\\\")'>#{letter}</span>\", \"\\n\"\n end\n print '</th>', \"\\n\"\n\n print '<th class=\"sorttable_nosort\"><span class=\"latex\">L<sup>a</sup>T<sub>e</sub>X</span></th>', \"\\n\"\n print '<th id=\"R\" class=\"hidden\"></th>'\n print '<th id=\"G\" class=\"hidden\"></th>'\n print '<th id=\"B\" class=\"hidden\"></th>'\n print '</tr>'\nend",
"def data_grid_header(data_grid, column)\n if column.sortable\n col_index = data_grid.columns.index(column)\n link_to(raw(column.title), data_grid.params.merge(\n \"sort_#{data_grid.name}\" => slug(column.title) + '_' + col_index.to_s,\n \"sort_direction_#{data_grid.name}\" => ((data_grid.sort == col_index) and (data_grid.sort_direction == 'ASC')) ? 'DESC' : 'ASC'), :class => 'underline sorting ' + ((data_grid.sort == col_index) ? ((data_grid.sort_direction == 'ASC') ? 'up' : 'down') : '')) \n else\n raw column.title\n end\n end",
"def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\n\n (attr, path) = rel.nested_attribute(attrname)\n\n rel = rel.joins { path[1..-1].inject(self.__send__(path[0]).outer) { |a,x| a.__send__(x).outer } } if path.any?\n\n # Call .asc explicitly to overcome a bug in pgsql adapter leading to undefined method to_sql\n attr = desc ? attr.desc : attr.asc\n\n rel = rel.order(attr)\n end\n end\n\n rel\n end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend",
"def sort_param_with_url(sortable_name, *args)\n params.delete(:sortasc)\n params.delete(:sortdesc)\n params.merge(sort_param_without_url(sortable_name, *args))\n end",
"def order_link query_params, field\n value = query_params.order_value(field)\n order_opts = query_params.orders[field] || {}\n default_dir = order_opts[:dir] || \"asc\"\n\n icon = {\n \"desc\" => \"<i class='icon-sort-up gray'></i>\",\n \"asc\" => \"<i class='icon-sort-down gray'></i>\",\n \"none\" => \"<i class='icon-sort gray'></i>\"\n }[value || \"none\"]\n yield(\"#{field_name(field)} #{icon}\".html_safe, query_params.order(field, value, default_dir.to_s).url, value.present?)\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def s_idsort; det.link(:text, 'ID'); end",
"def add_sort_order_to_title\n return unless params[:by]\n\n self.title_tag = :query_title_all_by\n title_args[:order] = :\"sort_by_#{params[:by].sub(/^reverse_/, \"\")}\"\n end",
"def sort_column(column, title, options = {})\n if params[:sort_order]\n c = params[:sort_order][:c]\n d = params[:sort_order][:d]\n else\n c = controller.default_sort_column\n d = controller.default_sort_direction\n end\n condition = options[:unless] if options.has_key?(:unless)\n sort_dir = d == 'up' ? 'down' : 'up'\n link_class = (d == 'up' ? 'headerSortDown' : 'headerSortUp') if c == column.to_s\n html = []\n html << \"<th class=\\\"header #{link_class}\\\">\"\n html << link_to_unless(condition, title, request.parameters.merge( :sort_order => {:c => column, :d => sort_dir}))\n html << \"</th>\"\n html.join('').html_safe\n end",
"def sorting_info(s_item, s_direction)\n\n file_link_dir = mtime_link_dir = sortby_link_dir = \"ascending\"\n s_item_display = s_direction_display = \"\"\n \n case s_item\n when \"file\"\n s_item_display = \"alphabetically\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"\"\n file_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"reversed\"\n file_link_dir = \"ascending\"\n end\n when \"mtime\"\n s_item_display = \"by modification date\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"oldest to newest\"\n mtime_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"newest to oldest\"\n mtime_link_dir = \"ascending\"\n end\n when \"size\"\n s_item_display = \"by size\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"smallest to largest\"\n sortby_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"largest to smallest\"\n sortby_link_dir = \"ascending\"\n end\n end\n \n return \"?sortby=file&direction=#{file_link_dir}\",\n \"?sortby=mtime&direction=#{mtime_link_dir}\",\n \"?sortby=size&direction=#{sortby_link_dir}\",\n s_item_display,\n s_direction_display\n \n end",
"def sort_delay ;det.link(:text, 'Receptacle Sequence');end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def admin_table_heading(name, order_name, html_options = {})\n class_names = []\n if order_name == params[:order]\n class_names << 'sorted'\n class_names << (params[:direction].downcase == 'desc' ? 'descending' : 'ascending')\n\n new_order = (params[:direction].downcase == 'desc' ? 'asc' : 'desc')\n else\n new_order = 'asc'\n end\n class_names << html_options[:class]\n class_names.compact!\n html_options[:class] = class_names.length > 0 ? class_names.join(' ') : nil\n\n return content_tag(:th, content_tag(:a, name, :href => url_for(params.merge(:order => order_name, :direction => new_order))), html_options)\n end",
"def sort_methods\n [\n 'score desc',\n 'authors_sort asc',\n 'authors_sort desc',\n 'title_sort asc',\n 'title_sort desc',\n 'journal_sort asc',\n 'journal_sort desc',\n 'year_sort asc',\n 'year_sort desc'\n ]\n end",
"def swap_sort_direction(direction = @paginable_params[:sort_direction])\n direction_upcased = upcasing_sort_direction(direction)\n return 'DESC' if direction_upcased == 'ASC'\n return 'ASC' if direction_upcased == 'DESC'\n end",
"def add_sort_by(field, dir = \"desc\")\n @sort_fields << {field => dir}\n end",
"def order_string\n \"#{params[:sort]} #{params[:direction]}\"\n end",
"def sort_with!(field, direction)\n return self if 'usefulness' == field && 'desc' == direction\n return self.reverse! if 'usefulness' == field && 'asc' == direction\n if 'asc' == direction\n self.sort! { |review1, review2| review1[field] <=> review2[field]}\n elsif 'desc' == direction\n self.sort! { |review1, review2| review2[field] <=> review1[field]}\n end\n end",
"def display_sort_column_headers(search)\n user_column_headers.reduce(String.new) do |string, field|\n string << (tag.th sort_link(search, field, {}, method: action))\n end +\n post_title_header_labels.reduce(String.new) do |str, i|\n str << (tag.th \"Post #{i} title\")\n end\n end",
"def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n us1[@sortfield] <=> us2[@sortfield]\n elsif us1[@sortfield]\n 1\n elsif us2[@sortfield]\n -1\n else\n 0\n end\n comp * reverse\n }\n end",
"def sort_direction\n params[:dir] == \"asc\" ? \"asc\" : \"desc\"\n end",
"def add_pagination_and_sorting( query )\n\n query.paginate( page: params[:page] ).order( \"#{sort_column} #{( sort_order == 'a' ) ? 'ASC' : 'DESC' }\" )\n\n end",
"def sort_header_tag(fsp, spec, options = {})\n content_tag('th', sort_link(fsp, spec, options))\n end",
"def sort_header_tag(fsp, spec, options = {})\n content_tag('th', sort_link(fsp, spec, options))\n end",
"def get_list_order(sort, dir)\n\t\t\tif sort\n\t\t\t\tcolumn_order_mapping = get_sext_constant('SEXT_COLUMN_ORDER_MAPPING')\n\n\t\t\t\t# Lookup and use the designated ordering if defined in the model.\n\t\t \t\tif column_order_mapping && column_order_mapping.has_key?(sort.to_sym)\n\t\t \t\t\tsort = column_order_mapping[sort.to_sym]\n\n\t\t \t\t# Use the passed in value if it looks complete with table name.\n \t\t\t\telsif !sort.include?('.')\n\t\t\t\t\tsort = [self.table_name, sort].join('.')\n\t\t \t\tend\n\n\t\t\t\tdir ||= \"ASC\"\n\t\t \t\torder = sort + \" \" + dir\n\t\t \telse\n\t\t \t\torder = get_sext_constant('SEXT_DEFAULT_SORT')\n\t\t \tend\n\t\t \t\n\t\t\treturn order\t\n\t\tend",
"def add_sort_field(*) super end",
"def change_sort(column_name)\n if sorter.any? && sorter.first.match?(column_name)\n sorter.toggle_order\n else\n sorter.push(column_name)\n end\n self.page = 1\n self\n end",
"def list_entries_with_sort\n if params[:sort].present? && sortable?(params[:sort])\n list_entries_without_sort.except(:order).order(sort_expression)\n else\n list_entries_without_sort\n end\n end",
"def sortable(default_order: {})\n # get the parameter\n sort_by = params[:sort] || params[:sort_by]\n\n if sort_by.is_a?(String)\n # split it\n sort_by_attrs = sort_by.gsub(/[^a-zA-Z0-9\\-_,]/, '').split(',')\n\n # save it\n @sortable_sort = {}\n sort_by_attrs.each do |attrb|\n if attrb.match(/^-/)\n @sortable_sort[attrb.gsub(/^-/, '')] = :desc\n else\n @sortable_sort[attrb] = :asc\n end\n end\n else\n @sortable_sort = default_order\n end\n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_entries; end",
"def sort_order(default)\n\n \"#{(params[:c] || default.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:d] == 'down' ? 'DESC' : 'ASC'}\"\n\n end",
"def sort_expression\n col = sort_mappings[params[:sort].to_sym] || \n \"#{model_class.table_name}.#{params[:sort]}\"\n \"#{col} #{sort_dir}\"\n end",
"def calls_sort_option\n column = case params[:iSortCol_0].to_s\n when '1'\n 'number'\n when '2'\n 'caller_id'\n when '3'\n 'providers.name'\n when '4'\n 'answered'\n when '5'\n 'busy'\n when '6'\n 'audio_length'\n when '7'\n 'ring_length'\n end\n column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column\n end",
"def sort_order\n 0\n end",
"def sort_link_url(sort_field)\n page = @paginable_params[:page] == 'ALL' ? 'ALL' : 1\n if @paginable_params[:sort_field] == sort_field\n sort_url = paginable_base_url_with_query_params(\n page: page,\n sort_field: sort_field,\n sort_direction: swap_sort_direction)\n else\n sort_url = paginable_base_url_with_query_params(\n page: page,\n sort_field: sort_field)\n end\n return \"#{sort_url}#{stringify_nonpagination_query_params}\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def column_header_label(vc, page_info, options)\n _label = label(vc)\n dir = 'asc'\n\n if page_info.order_by == sort_key\n # toggle direction\n if page_info.dir == 'asc' || page_info.dir.blank?\n _label += '▲'\n dir = 'desc'\n else\n _label += '▼'\n end\n end\n vc.link_to(_label,\n {\n :action => 'page_info_save',\n :id => page_info.id,\n 'edgarj_page_info[order_by]' => sort_key,\n 'edgarj_page_info[dir]' => dir\n }.merge(options),\n :remote => true,\n :method => :put)\n end",
"def sort_by(tree, col, direction)\n tree.children(nil).map!{|row| [tree.get(row, col), row.id]} .\n sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) .\n each_with_index{|info, idx| tree.move(info[1], nil, idx)}\n\n tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)})\nend",
"def content_sorter_path(type)\n \"//table[contains(@class, 'sticky-enabled')]/thead/tr/th/a[@title = 'sort by #{type}']\"\n end"
] | [
"0.7743998",
"0.7577518",
"0.7532365",
"0.7433285",
"0.74016017",
"0.73959976",
"0.7323607",
"0.73093885",
"0.7263241",
"0.7242758",
"0.7191382",
"0.71602434",
"0.7129251",
"0.71129787",
"0.7095197",
"0.7078148",
"0.70740676",
"0.70455366",
"0.7044673",
"0.69676214",
"0.6967547",
"0.6965564",
"0.69401187",
"0.6934693",
"0.691945",
"0.691029",
"0.691029",
"0.691029",
"0.69028485",
"0.6895553",
"0.68870175",
"0.6876244",
"0.6820409",
"0.6814764",
"0.6802445",
"0.6747332",
"0.6741581",
"0.6670579",
"0.6669988",
"0.6638097",
"0.6617469",
"0.6566129",
"0.6550135",
"0.6527159",
"0.65061176",
"0.6476748",
"0.6472792",
"0.6449004",
"0.6438145",
"0.642568",
"0.6387957",
"0.6377655",
"0.6350142",
"0.63241357",
"0.63203716",
"0.63042283",
"0.62368995",
"0.62277406",
"0.6193645",
"0.6168186",
"0.615098",
"0.61494803",
"0.6097467",
"0.6095753",
"0.6090482",
"0.6069007",
"0.6068538",
"0.6057043",
"0.60425264",
"0.6034091",
"0.60195184",
"0.6009021",
"0.5986744",
"0.59794635",
"0.59780574",
"0.59776044",
"0.59768707",
"0.5951216",
"0.5951216",
"0.5942375",
"0.5929068",
"0.5927547",
"0.5913258",
"0.59097695",
"0.5903106",
"0.5903106",
"0.5903106",
"0.5903106",
"0.5903106",
"0.5903106",
"0.5899065",
"0.58818865",
"0.58799857",
"0.58524907",
"0.5840444",
"0.5838831",
"0.583409",
"0.58296245",
"0.58155924",
"0.5812806"
] | 0.71461636 | 12 |
Returns the AC test method library | def ac_tml
@ac_tml ||= AcTml.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lib\n TyrantLib\n end",
"def lib\n TyrantLib\n end",
"def library; end",
"def library; end",
"def test_frameworks; end",
"def test_library\n\tputs \"Library Loaded!\"\nend",
"def lib\n @obj['lib']\n end",
"def library\n @library ||= Boson.library(@lib)\n end",
"def test_get_class\n assert_equal Test::Unit::TestCase,\n OneLiner.get_class(\"Test::Unit::TestCase\")\n end",
"def testmethods\n @test_methods ||= []\n end",
"def test_driver_getDriver\n\t\td = Driver::new(\"Driver test\",0)\n\t\tassert_equal d.getDriver, \"Driver test\"\n\tend",
"def library_name\n self.class.library_name\n end",
"def library\n @library ||= Library.new(self)\n end",
"def library\n @library ||= Library.new(self)\n end",
"def lib\n @data['lib']\n end",
"def test_case; end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def final_test_methods\n return []\n end",
"def test_get_class\n assert_equal Test::Unit::TestCase,\n OneLiner.get_class(\"Test::Unit::TestCase\")\n end",
"def libs; end",
"def klass\n Autotest::Phpdoctest::Base\n end",
"def wrap_adept_library(name)\n \n #Store the prefix for the library name, which\n #\n @prefix = name.capitalize\n #Make the adept_library function local, so it can only be used in class defintions.\n #private :wrap_adept_library\n\n #And attach the relevant dynamic library (DLL / SO).\n ffi_lib \"lib#{name}\"\n\n #Attach the function which queries the device runtime's version.\n attach_adept_function :GetVersion, [:pointer]\n\n end",
"def test_method\n end",
"def tests; end",
"def tests; end",
"def test_dependencies\n []\n end",
"def test_dependencies\n []\n end",
"def testing\n # ...\n end",
"def library_for(uri); end",
"def test_longest_single_flight\n lib = CSAirLib.new\n assert_equal(lib.longest_single_flight,'Sydney-Los Angeles')\n end",
"def game_library_menu_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"library\")), __method__)\n end",
"def library\n @library ||= {}\n end",
"def getLibraryName()\n return @libraryName\n end",
"def suite\n @suite ||= $TEST_SUITE\n end",
"def library\n @library ||= Plex::Library.new(self)\n end",
"def lib\n File.join(@root, 'lib')\n end",
"def lib\n File.join root, 'lib'\n end",
"def catalog\n puts \"library.catalog\"\n ap self.inspect\n end",
"def test_a\n end",
"def test_shortest_single_flight\n lib = CSAirLib.new\n assert_equal(lib.shortest_single_flight,'Washington-New York')\n end",
"def mod\n\t\treturn driver.active_module\n\tend",
"def library\n @library ||= if options[:library]\n Library.new options[:library]\n else\n Library.default\n end\n end",
"def test_biggest_population_city\n lib = CSAirLib.new\n assert_equal(lib.biggest_population_city,'Tokyo')\n end",
"def current_library\n @current_library\n end",
"def get_test_fns\n fns = {}\n basename = File.basename(@parts[:fn], @parts[:ext]) + Cpp::get_source_ext(@parts[:ext])\n ['src', 'inc'].each do |type|\n fns[type] = File.join(@parts[:base_dir],\n @parts[:module],\n 'test',\n type,\n @parts[:namespaces],\n basename)\n end\n fns\n end",
"def type\n 'Test Case'\n end",
"def rq(lib)\n require lib.to_s\n end",
"def active_module\n\t\tdriver.active_module\n\tend",
"def tst_suite_name\n self.class.name\n end",
"def test_can_easily_build_arrays_when_accessing_by_default\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.library_path << 'lib/bin'\n s.library_path << 'lib/swc'\n assert_equal( [ 'lib/bin', 'lib/swc' ], s.library_path )\n end\n end",
"def int_test_name\n name = test_method.test_name if test_method.respond_to?(:test_name)\n name || 'Functional'\n end",
"def base_dir\n AYTests.base_dir\n end",
"def get_helpers\n @helpers\n end",
"def library_description\n LIBRARY_DESCRIPTION\n end",
"def libraryCredits \n \"libraryCredits\" \n end",
"def test_get_book()\n assert_nil(@this_library.get_book(\"not_in_library\"))\n end",
"def load_test_chamber\n # load shared examples\n Dir[\"./spec/support/**/*.rb\"].sort.each {|f| require f}\n\n #load the app\n require 'test_chamber'\n\n # Target server\n TestChamber.target_url = TestChamber::Config[:target_url]\n\n TestChamber.dashboard_asset_string = TestChamber::Config[:dashboard_asset_version]\n\n # Enable logging\n TestChamber.logger = Logger.new('logs/dev.log') if ENV['ENABLE_LOCAL_LOGGING'] == 'true'\n\n #initializing default values\n\n TestChamber.default_wait_for_timeout = TestChamber::Config[:default_wait_timeout]\n TestChamber.default_wait_for_interval = TestChamber::Config[:default_wait_interval]\n\n TestChamber.created_partners ||= Set.new\n TestChamber.current_device = TestChamber::Device.android_10_point_1\n\n TestChamber.user_cookies = USER_SESSION[:cookies]\n if TestChamber::Config[:test_username]\n TestChamber.default_partner_id = get_default_partner(TestChamber::Config[:test_username])\n end\n\n # Check Appium dependencies\n TestChamber::AppiumClient.setup\nend",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def purcc_tandc_link\n # unit_test_no_generate: purcc_tandc_link, a.className(create_ats_regex_string(\"ats-purcctandclnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-purcctandclnk\")), __method__)\n end",
"def running_test_case; end",
"def get_testrail_connection()\n @tr_con = nil\n @tr_case_types = nil\n @tr_case_fields = nil\n\n print \"Connecting to TestRail system at:\\n\"\n print \"\\tURL : #{$my_testrail_url}\\n\"\n print \"\\tUser : #{$my_testrail_user}\\n\"\n\n # ------------------------------------------------------------------\n # Set up a TestRail connection packet.\n #\n @tr_con = TestRail::APIClient.new($my_testrail_url)\n @tr_con.user = $my_testrail_user\n @tr_con.password = $my_testrail_password\n\n print \"\\nValidated by TestRail system:\\n\"\n print \"\\tUser : #{@tr_con.user}\\n\"\nend",
"def check_for_libraries; end",
"def default_test\n end",
"def lib_path=(_arg0); end",
"def lib_path=(_arg0); end",
"def lib_path=(_arg0); end",
"def testing_engine\n puts \"engine method\"\n end",
"def default_test; end",
"def test_methods()\n tests = []\n stack = [@contexts.first]\n until stack.empty? do\n item = stack.pop\n stack += item.tests_and_subcontexts.reverse if item.is_a?(Context)\n tests << item if item.is_a?(String)\n end\n tests\n end",
"def apis; end",
"def get_ab_tests(opts = {})\n @transporter.read(:GET, '/2/abtests', {}, opts)\n end",
"def load_libs; end",
"def lib\n File.join root, 'lib'\n end",
"def lib\n File.join root, 'lib'\n end",
"def file_name\n library_name\n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def test_average_flight_length\n lib = CSAirLib.new\n assert_equal(lib.average_flight_length,2300)\n end",
"def libraries\n modules = YARD::Registry.all(:module)\n classes = YARD::Registry.all(:class)\n root_definitions = YARD::Registry.all(:method).select { |m| m.path =~ /^root#/ }\n\n classes + modules + root_definitions\n end",
"def default_test\n end",
"def test_Enviroment_004_SortMethods\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_004_SortMethods\")\r\n puts2(\"#######################\")\r\n puts2(\" Sorted list of Methods in use:\")\r\n puts2(Object.new.methods.sort)\r\n puts2(\"######################\")\r\n\r\n end",
"def test_service\n @options[:method] = 'testservice'\n response = ta_response(base_params)\n return response\n end",
"def integration_test()\n return [\"all\"]\n end",
"def turbot_api\n @turbot_api ||= begin\n require 'turbot_api'\n\n Turbot::API\n end\n end",
"def test_can_add_paths_to_library_path\n Crd::Spec.new 'Testing' do |s|\n s.library_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.library_path )\n end\n end",
"def algorithms\n get_info :algorithms\n end",
"def self_test; end",
"def self_test; end",
"def api\n return @api\n end",
"def default_test\r\n end",
"def require_test_helper\n record_api_supportability_metric(:require_test_helper)\n require File.expand_path('../../../test/agent_helper', __FILE__)\n end",
"def test_acknowledgement\n\n end",
"def test_acknowledgement\n\n end",
"def test_acknowledgement\n\n end",
"def test_acknowledgement\n\n end",
"def test\n @test_facade = test_facade\n end",
"def lib(lib)\n send(lib)\n end",
"def library_code\n service_point&.library&.code || (@code if Settings.libraries[@code].present?)\n end"
] | [
"0.624025",
"0.62261623",
"0.60597837",
"0.60597837",
"0.59456414",
"0.5942837",
"0.58562034",
"0.5766432",
"0.565484",
"0.5615493",
"0.55677295",
"0.5529691",
"0.549908",
"0.549908",
"0.5498513",
"0.5491706",
"0.5485096",
"0.5485096",
"0.5485096",
"0.54760295",
"0.5473333",
"0.5443962",
"0.5438091",
"0.5407997",
"0.5263645",
"0.52591944",
"0.52591944",
"0.52583724",
"0.52583724",
"0.52489984",
"0.5247356",
"0.5240661",
"0.5223999",
"0.5223034",
"0.52218485",
"0.5220351",
"0.5215127",
"0.5212192",
"0.51765656",
"0.517138",
"0.5164766",
"0.51554155",
"0.5145678",
"0.5140911",
"0.5139131",
"0.51189524",
"0.5112936",
"0.51085514",
"0.50907683",
"0.50806206",
"0.50756466",
"0.5068138",
"0.5067836",
"0.5060839",
"0.50568247",
"0.50459903",
"0.50397867",
"0.5038474",
"0.5036956",
"0.50357425",
"0.50214964",
"0.5013361",
"0.50039065",
"0.50019604",
"0.49907994",
"0.49890426",
"0.49890426",
"0.49890426",
"0.49878123",
"0.49823347",
"0.4980933",
"0.4972179",
"0.49691233",
"0.49685535",
"0.4965509",
"0.4965509",
"0.49622244",
"0.49603897",
"0.49603897",
"0.49603897",
"0.49491993",
"0.4946725",
"0.494663",
"0.49456108",
"0.494293",
"0.49424013",
"0.4940161",
"0.49306363",
"0.4926137",
"0.4924236",
"0.4924236",
"0.49163818",
"0.49140528",
"0.49131405",
"0.49121922",
"0.49121922",
"0.49121922",
"0.49121922",
"0.49074176",
"0.49029598",
"0.48983613"
] | 0.0 | -1 |
Returns the DC test method library | def dc_tml
@dc_tml ||= DcTml.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_frameworks; end",
"def lib\n @data['lib']\n end",
"def lib\n @obj['lib']\n end",
"def library_name\n self.class.library_name\n end",
"def library; end",
"def library; end",
"def library\n @library ||= Boson.library(@lib)\n end",
"def getLibraryName()\n return @libraryName\n end",
"def lib\n TyrantLib\n end",
"def test_driver_getDriver\n\t\td = Driver::new(\"Driver test\",0)\n\t\tassert_equal d.getDriver, \"Driver test\"\n\tend",
"def lib\n TyrantLib\n end",
"def library\n @library ||= Library.new(self)\n end",
"def library\n @library ||= Library.new(self)\n end",
"def framework\n\t\treturn driver.framework\n\tend",
"def test_library\n\tputs \"Library Loaded!\"\nend",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def library\n @library ||= if options[:library]\n Library.new options[:library]\n else\n Library.default\n end\n end",
"def libs; end",
"def library\n @library ||= {}\n end",
"def current_library\n @current_library\n end",
"def library_description\n LIBRARY_DESCRIPTION\n end",
"def getDriver\n @driver\n end",
"def getDriver\n @driver\n end",
"def library_for(uri); end",
"def klass\n Autotest::Phpdoctest::Base\n end",
"def library_path\n datastore['DLL']\n end",
"def library\n @library ||= Plex::Library.new(self)\n end",
"def library_code\n service_point&.library&.code || (@code if Settings.libraries[@code].present?)\n end",
"def file_name\n library_name\n end",
"def lib\n File.join(@root, 'lib')\n end",
"def app\n Cyclid::API::App\nend",
"def mod\n\t\treturn driver.active_module\n\tend",
"def test_biggest_population_city\n lib = CSAirLib.new\n assert_equal(lib.biggest_population_city,'Tokyo')\n end",
"def lib\n File.join root, 'lib'\n end",
"def library(domain, name=nil, opts={})\n\n path, key = split(domain, name)\n\n libs = entries('libraries', path)\n if opts[:subflows] # used by \"graft\"/\"import\"\n libs += entries('sublibraries', path)\n libs = libs.sort_by { |pa, _, _| pa.count('.') }\n end\n\n libs\n .each { |pa, ke, va|\n next unless ke == key\n return [ [ pa, ke ].join('.'), va ] }\n\n nil\n end",
"def test_dependencies\n []\n end",
"def test_dependencies\n []\n end",
"def suite\n @suite ||= $TEST_SUITE\n end",
"def location\n opts = get_options\n opts['lib']\n end",
"def test_longest_single_flight\n lib = CSAirLib.new\n assert_equal(lib.longest_single_flight,'Sydney-Los Angeles')\n end",
"def tst_suite_name\n self.class.name\n end",
"def test_get_class\n assert_equal Test::Unit::TestCase,\n OneLiner.get_class(\"Test::Unit::TestCase\")\n end",
"def load_libs; end",
"def framework\n\t\treturn self.class.framework\n\tend",
"def library(lib)\n Dissident::LIBRARIES[self] = lib\n end",
"def test_can_add_paths_to_library_path\n Crd::Spec.new 'Testing' do |s|\n s.library_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.library_path )\n end\n end",
"def test_can_easily_build_arrays_when_accessing_by_default\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.library_path << 'lib/bin'\n s.library_path << 'lib/swc'\n assert_equal( [ 'lib/bin', 'lib/swc' ], s.library_path )\n end\n end",
"def catalog\n puts \"library.catalog\"\n ap self.inspect\n end",
"def testmethods\n @test_methods ||= []\n end",
"def library_name\n Library === library ? library.name : nil\n end",
"def request_libraries\n raise StandardError, 'Unsupported, fix this'\n end",
"def get_drivers\n drivers\n end",
"def test_get_class\n assert_equal Test::Unit::TestCase,\n OneLiner.get_class(\"Test::Unit::TestCase\")\n end",
"def api\n return @api\n end",
"def libdir()\n LIBDIR\n end",
"def getc()\n #This is a stub, used for indexing\n end",
"def get_definition(cls, bld)\r\n bld.add(\"///\")\r\n bld.add(\"/// Constructor\")\r\n bld.add(\"///\")\r\n\r\n bld.add(\"[TestMethod]\")\r\n bld.startFunction(\"public void \" + Utils.instance.getStyledFunctionName(\"test \" + cls.getUName() + \" engine\") + \"()\")\r\n get_body(cls, bld)\r\n\r\n bld.endFunction\r\n end",
"def library_name\n\t\tRex::Text::rand_text_alpha(8) + \".dll\"\n\tend",
"def test\n @test_facade = test_facade\n end",
"def lib\n File.join root, 'lib'\n end",
"def lib\n File.join root, 'lib'\n end",
"def lib_dir\n LIB_DIR\n end",
"def library(domain, name=nil)\n\n domain, name = split_dn(domain, name)\n\n path =\n (Dir[File.join(root, '**/*.{flo,flor}')])\n .sort\n .sort_by(&:length)\n .select { |f| f.index('/lib/') }\n .select { |f| path_name_matches?(domain, name, f) }\n .first\n\n path ? [ Flor.relativize_path(path), File.read(path) ] : nil\n end",
"def test_driver_getDriver_invalid\n\t\td = Driver::new(\"Driver test\",0)\n\t\tdef d.getDriver; \"garbage output\"; end\n\t\tassert_equal d.getDriver, \"garbage output\"\n\tend",
"def final_test_methods\n return []\n end",
"def driver; end",
"def kefed_library\n @project = Yogo::Project.get(params[:id])\n @experimental_designs = repository(:yogo_persevere){ Crux::YogoModel.all }\n end",
"def user_api\n $SDK_API\nend",
"def driver\n # DATPages::Driver.instance\n @driver ||= DATPages::DriverConnection.initialize_driver\n end",
"def class\n @cx.class\n end",
"def get_model\n self.class.name.gsub(/Test/, \"\").constantize\n end",
"def libraries\n modules = YARD::Registry.all(:module)\n classes = YARD::Registry.all(:class)\n root_definitions = YARD::Registry.all(:method).select { |m| m.path =~ /^root#/ }\n\n classes + modules + root_definitions\n end",
"def query_library(libname)\n init_doc({:format_doc=>:tex})\n parse(CqlsDoc.input_from_file(libname))\n p @calls.keys.sort\n p @meths.sort\n end",
"def library?\n sort == ::LIBRARY\n end",
"def framework\n @framework\n end",
"def test_shortest_single_flight\n lib = CSAirLib.new\n assert_equal(lib.shortest_single_flight,'Washington-New York')\n end",
"def library_path\n @library_path ||= nil\n end",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def test_get_departmentdetail_kind\n data = post_departmentdetail('id' => 1)\n assert_equal('department_courses', data[0]['kind'])\n end",
"def driver\n Fc3Service\n end",
"def test_library_path_is_empty_array\n Crd::Spec.new 'Testing' do |s|\n assert_equal( [ ], s.library_path )\n end\n end",
"def get_helpers\n @helpers\n end",
"def test_case; end",
"def test_drivers_get_classes\n\t\tloc = Location::new(\"Location\", [\"Place\"])\n\t\tdriv = Driver::new(1, loc)\n\t\tassert_equal 0, driv.get_classes\n\tend",
"def int_test_name\n name = test_method.test_name if test_method.respond_to?(:test_name)\n name || 'Functional'\n end",
"def driver_path; end",
"def driver_path; end",
"def active_module\n\t\tdriver.active_module\n\tend",
"def libraryDisclaimers \n \"libraryDisclaimers\" \n end",
"def libraryCredits \n \"libraryCredits\" \n end",
"def get_testrail_connection()\n @tr_con = nil\n @tr_case_types = nil\n @tr_case_fields = nil\n\n print \"Connecting to TestRail system at:\\n\"\n print \"\\tURL : #{$my_testrail_url}\\n\"\n print \"\\tUser : #{$my_testrail_user}\\n\"\n\n # ------------------------------------------------------------------\n # Set up a TestRail connection packet.\n #\n @tr_con = TestRail::APIClient.new($my_testrail_url)\n @tr_con.user = $my_testrail_user\n @tr_con.password = $my_testrail_password\n\n print \"\\nValidated by TestRail system:\\n\"\n print \"\\tUser : #{@tr_con.user}\\n\"\nend",
"def test_framework_runtimes\n find_duplicates :frameworks\n end",
"def wrap_adept_library(name)\n \n #Store the prefix for the library name, which\n #\n @prefix = name.capitalize\n #Make the adept_library function local, so it can only be used in class defintions.\n #private :wrap_adept_library\n\n #And attach the relevant dynamic library (DLL / SO).\n ffi_lib \"lib#{name}\"\n\n #Attach the function which queries the device runtime's version.\n attach_adept_function :GetVersion, [:pointer]\n\n end",
"def type\n 'Test Case'\n end",
"def algorithms\n get_info :algorithms\n end",
"def test_framework\n @test_framework ||= :rspec\n end",
"def domain_class\n self.class.const_get(:DSL)\n end"
] | [
"0.608045",
"0.6078954",
"0.60627854",
"0.6025612",
"0.60234493",
"0.60234493",
"0.58579874",
"0.57958966",
"0.5788853",
"0.57757235",
"0.5756501",
"0.57033247",
"0.57033247",
"0.5688265",
"0.5645807",
"0.5547105",
"0.5547105",
"0.5547105",
"0.5506872",
"0.5497956",
"0.5453126",
"0.5423838",
"0.541179",
"0.5406396",
"0.5406396",
"0.5396881",
"0.5388909",
"0.5357627",
"0.5290244",
"0.5277092",
"0.526088",
"0.52423143",
"0.52382886",
"0.51776",
"0.5166573",
"0.5159157",
"0.5155427",
"0.51410234",
"0.51410234",
"0.5139677",
"0.5125055",
"0.50972724",
"0.5086429",
"0.5083897",
"0.5056095",
"0.5055906",
"0.50543034",
"0.504452",
"0.5027507",
"0.5026975",
"0.5014104",
"0.50107145",
"0.49929938",
"0.49927908",
"0.49906966",
"0.4989604",
"0.49790996",
"0.49781877",
"0.49650922",
"0.49597025",
"0.4957014",
"0.49470165",
"0.49470165",
"0.49431372",
"0.49301362",
"0.49254817",
"0.491207",
"0.4907371",
"0.48915088",
"0.48880464",
"0.48864087",
"0.4883302",
"0.48739138",
"0.48716897",
"0.48690116",
"0.48452502",
"0.4842801",
"0.48391688",
"0.48374388",
"0.4830558",
"0.4830558",
"0.4830558",
"0.48300532",
"0.48298246",
"0.48276478",
"0.4827352",
"0.4826949",
"0.48257393",
"0.48086718",
"0.48084855",
"0.48084855",
"0.48037127",
"0.4801867",
"0.4795817",
"0.4791992",
"0.47788355",
"0.4777003",
"0.47697273",
"0.4767789",
"0.47658542",
"0.47619113"
] | 0.0 | -1 |
Creates an accessor for custom test method libraries the first time they are called | def method_missing(method, *args, &block)
custom_tmls = Origen.interface.send(:custom_tmls)
if custom_tmls[method]
tml = CustomTml.new(self, custom_tmls[method])
instance_variable_set "@#{method}", tml
define_singleton_method method do
instance_variable_get("@#{method}")
end
send(method)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end",
"def testmethods\n @test_methods ||= []\n end",
"def initialize(test_method_name)\n @method_name = test_method_name\n @internal_data = InternalData.new\n end",
"def setup!\n setup_instance_methods!\n self\n end",
"def test\n @test_facade = test_facade\n end",
"def create_getters\n self.class::ATTRS.each do |method_name|\n self.class.class_eval do\n define_method(method_name) do\n get_webpage\n eval(\"scrape_#{method_name}\")\n eval(\"@#{method_name}\")\n end\n end\n end\n end",
"def test_set_method_types\n end",
"def final_test_methods\n return []\n end",
"def test_frameworks; end",
"def instance_call(method_name)\n Scenario::Orchestrator.new(self, @mock_instance_double, :instance, method_name)\n end",
"def test_method\n end",
"def test() @test ||= Flickr::Test.new(self) end",
"def __dummy_test__\n end",
"def setup\n flexmock(Woofer).new_instances.should_receive(:woof => :grrr)\n end",
"def self_test; end",
"def self_test; end",
"def test_generate_accessor_should_add_methods\n assert !defined?(foo)\n generate_accessor(:foo, \"bar\")\n assert_equal \"bar\", foo\n assert !defined?(boo)\n generate_accessor('boo', 'foo')\n assert_equal 'foo', boo\n end",
"def test_setup\r\n \r\n end",
"def before_test(test); end",
"def before_test(test); end",
"def make_independent\n self.method = method.dup\n end",
"def stub_implementation; end",
"def initialize stub_method\n @stub_method = stub_method\n end",
"def default_test; end",
"def test_magic_column_should_add_read_method\n @bob.magic_columns << MagicColumn.create(:name => \"first_name\")\n @bob.first_name #method gets generated the first time it is called :S\n assert @bob.respond_to?(:first_name)\n end",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end",
"def method_missing( method, *args, &block )\n if method.to_s =~ /^setup_(.*)$/ && args.empty?\n add( $1.to_sym, caller.first, &block )\n else\n super\n end\n end",
"def before_setup; end",
"def initialize_defaults(method_name)\n end",
"def init\n if RSpec::Mocks::Version::STRING >= '3.0'\n require 'rspec/mocks/standalone'\n else\n RSpec::Mocks.setup(self) unless self.respond_to? :allow\n end\n end",
"def my_tests\n end",
"def default_test\n end",
"def before_methods\n @@before_methods\n end",
"def default_test\n end",
"def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :minitest\n self.test_prelude ||= nil\n self.test_task = nil\n end",
"def default_test\r\n end",
"def before _type = nil, &block\n define_method :setup do\n super()\n self.instance_eval(&block)\n end\n end",
"def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend",
"def setup\n super\n @append_a = Module.new\n @append_a.define_singleton_method(:call) do |thing|\n thing << 'a'\n thing\n end\n\n @append_b = Class.new\n @append_b.define_singleton_method(:call) do |thing|\n thing << 'b'\n thing\n end\n\n @append_c = lambda do |thing|\n thing << 'c'\n thing\n end\n end",
"def testing\n # ...\n end",
"def initialize\n @awesome_methods = {}\n \n # Check if we're bootstraping. During this process\n # the runtime is not fully initialized and core classes\n # do not yet exists, so we defer setting the object class\n # once this is all done.\n # This solves the chiken and egg problem with the Class class.\n # We can initialize Class then set Class.class = Class.\n if defined?(Runtime)\n awesome_class = Runtime[\"Class\"]\n else\n awesome_class = nil\n end\n \n super(awesome_class)\n end",
"def setup\n #implement in subclass;\n end",
"def patched_methods\n @patched_methods ||= {}.with_indifferent_access\n end",
"def setup(klass, *methods)\n \n end",
"def create_getters\n instance_variables.each do |v|\n define_singleton_method(v.to_s.tr('@','')) do\n instance_variable_get(v)\n end\n end\n end",
"def test_added_methods\r\n assert_respond_to @default_user, :roles\r\n assert_respond_to @default_user, :has_role?\r\n \r\n assert_respond_to @default_user, :permissions\r\n assert_respond_to @default_user, :has_static_permission?\r\n end",
"def expected_method; end",
"def setup\n # override and do something appropriate\n end",
"def setup_expectation(obj, method)\n # If we want to know whether the method was called successfully, we need\n # to raise an error that will tell us when we failed to call the method.\n # To do that we also need to store whether we expected the method to be called\n $expectations << [obj, method]\n # This code add a method `hello` to ONLY this particular instance\n obj.singleton_class.send(:define_method, method) do\n # Let's records in a GLOBAL HASH $calls, that a `define_method` was called.\n $calls[obj] << method\n end\nend",
"def __mock_reset; end",
"def initialize( test_method_name )\n if !respond_to?( test_method_name )\n\t\t\tthrow :invalid_test\n end\n @method_name = test_method_name\n @test_passed = true\n\n\t\tLinguistics::use( :en )\n\tend",
"def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :testunit\n self.rspec_dirs ||= %w(spec lib)\n self.rspec_options ||= []\n end",
"def record_expected_return_values_on(method_name)\n (@original_methods ||= []) << method_name\n \n class_eval do\n alias_method \"intercepted_#{method_name}\", method_name\n \n define_method(method_name) do |*values|\n mock_expectation = send(\"intercepted_#{method_name}\", *values)\n synthesis_expectation.add_return_values(*values) if synthesis_expectation\n mock_expectation\n end\n end\n end",
"def delegated_instance_methods\n FlickrMocks::Models::Helpers.array_accessor_methods\n end",
"def setup\n raise NotImplementedError\n end",
"def internal_create_override(method_name, mode=:instance, &block)\n builder = ExpectationBuilder.new method_name\n block.call builder unless block.nil?\n exp = builder.build\n exp.events = events[mode] \n expectations.add_expectation exp, mode\n exp\n end",
"def create_rgithook_instance\n # This is not really a rgithook_instance ;-P\n ::RGitHook::RGitHook.stubs(:parse_path).with(@repo).returns(@repo)\n ::RGitHook::Runner.stubs(:new).with(@repo).returns(@runner)\n @runner.stubs(:load).with('hooks_file')\n ::RGitHook::RGitHook.any_instance.stubs(:hooks_file).returns('hooks_file')\n ::RGitHook::RGitHook.new(@repo)\n end",
"def define_helpers; end",
"def test_library\n\tputs \"Library Loaded!\"\nend",
"def test_case; end",
"def tests; end",
"def tests; end",
"def flexmock_get\n @mock\n end",
"def flexmock_get\n @mock\n end",
"def test_defaults\n end",
"def test3\r\n\t\t\"public method\" #a method can be public if we want to access it from outside the class\r\n\tend",
"def create_getter(name, meth)\n define_method(meth) do\n read_attribute(name)\n end\n end",
"def method_missing(method, *arguments, &block)\n if known_fixture?(method)\n arguments = arguments.map { |a| a.inspect }\n ::Peck::Rails::Controller::LazyValue.new(\"#{method}(#{arguments.join(', ')})\")\n else\n super\n end\n end",
"def test_add_resource_cathedral\n driver = Minitest::Mock.new(\"Driver\")\n location = Minitest::Mock.new(\"Location\")\n def location.name; \"Cathedral\"; end\n driver.expect :add_class, nil\n @c.add_resource(driver, location)\n assert_mock driver\n end",
"def define_getter\n name = @name\n klass.send :define_method, \"#{name}\" do\n return unless send(\"#{name}?\")\n Unitwise(send(\"#{name}_value\"), send(\"#{name}_unit\"))\n end\n end",
"def initialize(*args) # :nodoc:\n super\n add_machined_helpers\n end",
"def use_as_method\n @method = true\n end",
"def register_capabilities(methods); end",
"def initialize(test_method_name)\n unless(respond_to?(test_method_name) and\n (method(test_method_name).arity == 0 ||\n method(test_method_name).arity == -1))\n throw :invalid_test\n end\n @method_name = test_method_name\n @test_passed = true\n end",
"def pre_mock_generate(arg_hash); execute_plugins(:pre_mock_generate, arg_hash); end",
"def test_Method_InstanceMethods_meth\n\t\t# Define a method\n\t\tdef fred()\n\t\t\tputs \"Hello\"\n\t\tend\n\t\talias bert fred\n\t\t\n\t\tm1 = method(:fred)\n\t\tm2 = method(:bert)\n\t\tassert_equal(m1, m2)\n\tend",
"def enable_test_interface\n extend Dry::Configurable::TestInterface\n end",
"def stubs; end",
"def create_configurable_methods!\n return if self.class.methods_configured == true\n \n self.class.send(:alias_method, klass_name.demodulize.underscore.to_sym, :record)\n self.class.send(:attr_writer, login_field) if !respond_to?(\"#{login_field}=\")\n self.class.send(:attr_reader, login_field) if !respond_to?(login_field)\n self.class.send(:attr_writer, password_field) if !respond_to?(\"#{password_field}=\")\n self.class.send(:define_method, password_field) {} if !respond_to?(password_field)\n \n self.class.class_eval <<-\"end_eval\", __FILE__, __LINE__\n def #{login_field}_with_authentication_flag=(value)\n self.authenticating_with = :password\n self.#{login_field}_without_authentication_flag = value\n end\n alias_method_chain :#{login_field}=, :authentication_flag\n \n def #{password_field}_with_authentication_flag=(value)\n self.authenticating_with = :password\n self.#{password_field}_without_authentication_flag = value\n end\n alias_method_chain :#{password_field}=, :authentication_flag\n \n private\n # The password should not be accessible publicly. This way forms using form_for don't fill the password with the attempted password. The prevent this we just create this method that is private.\n def protected_#{password_field}\n @#{password_field}\n end\n end_eval\n \n self.class.methods_configured = true\n end",
"def before_load(test_files); end",
"def default_test\n info \"self: #{self}\"\n end",
"def stest_method_1(test); end",
"def on_init\n grader = Grader.new(@graderConfig, @storageConfig)\n \n add_method(grader, 'test', 'problem_id', 'submit_id', 'test_id', 'checker_id', 'module_id');\n end",
"def before_method(method)\n @liquor[method.to_s]\n end",
"def methods() end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end"
] | [
"0.60914785",
"0.6080619",
"0.60542107",
"0.5938238",
"0.58953416",
"0.5871357",
"0.58641917",
"0.5822107",
"0.5773011",
"0.57308537",
"0.5684956",
"0.5676139",
"0.5669252",
"0.5635569",
"0.56068116",
"0.56068116",
"0.5605318",
"0.5591912",
"0.55851215",
"0.55851215",
"0.5584262",
"0.555138",
"0.55317247",
"0.55278254",
"0.55239606",
"0.55237293",
"0.55075896",
"0.55009955",
"0.54840964",
"0.5468964",
"0.5456882",
"0.5451324",
"0.54417586",
"0.5422449",
"0.54169667",
"0.5411045",
"0.54059273",
"0.540309",
"0.53983814",
"0.5397298",
"0.5395376",
"0.538232",
"0.5381218",
"0.53782344",
"0.536522",
"0.53570837",
"0.5338921",
"0.53241575",
"0.53153783",
"0.5315063",
"0.5284181",
"0.5282437",
"0.5272495",
"0.52675784",
"0.5258604",
"0.525739",
"0.5249208",
"0.52465826",
"0.52454317",
"0.52437806",
"0.52331185",
"0.52328694",
"0.52328694",
"0.5230146",
"0.5230146",
"0.5222883",
"0.5220726",
"0.5219694",
"0.52129257",
"0.5208145",
"0.5202202",
"0.52006435",
"0.5192074",
"0.51916265",
"0.5191366",
"0.5186822",
"0.51859874",
"0.51723987",
"0.5166316",
"0.5165755",
"0.5161819",
"0.5160882",
"0.5159839",
"0.5152379",
"0.5151428",
"0.51454526",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577",
"0.5144577"
] | 0.0 | -1 |
GET /article_comments/1 GET /article_comments/1.xml | def show
@article_comment = ArticleComment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @article_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.find(params[:id])\n @article_comment = @article.article_comments.new(params[:article_comment])\n @article_comments = @article.article_comments.page(params[:page]||1).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html { render_404 }\n format.rss { render :rss => @comments }\n end\n end",
"def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @article = Article.find(params[:id])\n @comment = @article.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @comments.to_xml }\n end\n end",
"def index\n @comments = @article.comments\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @comment.to_xml }\n end\n end",
"def index\n \n @comments = @network.comments.find(:all, :order => 'created_at DESC')\n @comment_pages = @comments.paginate :page => params[:page], :per_page => 15\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = @entry.comments.order('created_at DESC').page(params[:page]).per(40)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = CommentsArticle.all\n end",
"def show\n puts \"show comments\"\n @Comment = Comment.find(params[:id], :order => \"updated_at desc\")\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @Comment }\n end\n end",
"def show\n @comments = @post.comments.paginate(:page => @path, :order => 'created_at DESC', :per_page => @per_page)\n respond_to do |format|\n format.html { render }\n format.xml { render :xml => @post }\n end\n end",
"def index\n @comments = Comment.find(:all, :include => :post, :order => 'comments.created_at DESC')\n @meta[:title] = 'Comments'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n @comments = Comment.order(\"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @article_comment = ArticleComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_comment }\n end\n end",
"def index\n @comments = @computer.comments.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def index\n @article_comments = Article::Comment.all\n end",
"def show\n @comment = Comment.where(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @article = Article.find(params[:id])\n @comment = @article.comments.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @comment =@post.comments.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def index\n @article_comments = ArticleComment.all\n end",
"def index\n @article_comments = ArticleComment.all\n end",
"def show\n @comment = @computer.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def index\n @comments = @task.comments.find(:all, :order => 'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n @meta[:title] = \"Comment from #{@comment.author}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n layout = get_application_layout\n \n @comment = Comment.find(params[:id])\n \n respond_to do |format|\n format.html { render :layout => layout}\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @comment = Comment.find(params[:id], :include => [:post, :user])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @comment }\n end\n end",
"def index\n @comments = Comment.paginate(:page => params[:page], :include => [:post],:per_page => 8, :order => 'id desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\n puts \"AM I CALLING COMMENT.INDEX?\"\n @comments = Comment.all\n @article = Article.find(params[:article_id])\n #redirect_to :controller => \"articles\", :action => \"show\"\n render \"articles/show\"\n \n end",
"def index\n @comments = Comment.all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @comments }\n end\n end",
"def show\n @comment2 = Comment2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment2 }\n end\n end",
"def index\n @point_of_interest_comments = @point_of_interest.point_of_interest_comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @point_of_interest_comments }\n end\n end",
"def index\n\t @articlecomments = Articlecomment.all\n end",
"def show\n @comments = @article.comments\n @comment = Comment.new\n end",
"def comments\n Comment.where(:article => @id)\n end",
"def comment(article_id, id, params = {})\n get \"articles/#{article_id}/comments/#{id}\", {query: params}\n end",
"def index\n @comments = @parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end",
"def show\n @post = Post.find_by_slug(params[:id])\n @comment = Comment.new\n logger.debug \"No. of comments for post #{@post.title} is #{@post.comments.size}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def index\n begin\n load_path\n @comments = @commentable.comments.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n rescue => e\n respond_to do |format|\n format.html { redirect_to root_path, :alert => e.message.to_s.html_safe }\n format.xml { render :xml => e.message, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n\n @comment = Comment.find params[:id]\n @article = @comment.article\n\n end",
"def comments; rest_query(:comment); end",
"def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n\t\t@comment = Comment.find( params[:id] )\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @comment.commentable_path + '#' + 'comment_' + @comment.id.to_s }\n\t\t\tformat.xml { render :xml => @comment.to_xml }\n\t\tend\n\tend",
"def show\n @comment = @parent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n \n if params[:permalink]\n @article = Article.find_permalink(params[:permalink])\n end\n \n if params[:id] \n @article = Article.find(params[:id])\n end\n \n @comments = @article.approved_comments\n @comment = Comment.new\n @comment.commentable_id = @article.id\n @comment.commentable_type = @article.class\n if logged_in?\n @comment.name = current_user.first_name\n @comment.email = current_user.email\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @comic = Comic.find_by_alias_or_id(params[:comic_id])\n @comments = @comic.comments.find(:all, :group => \"page_id\", :order => \"created_on DESC\")\n @comments_by_page = @comments.group_by {|comment| comment.page }\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @comments.to_xml }\n format.rss { render :action => \"comments_for_comic.rxml\", :layout => false }\n end\n end",
"def index\n @comments = Comment.find(:all).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @comments=@post.comments.paginate(:per_page=>25,:page => params[:page], :order => 'created_at DESC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def show\n @topic_comment = TopicComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_comment }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n @comments = @entry.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show\n @article = Article.find_by_sysname(params[:id])\n redirect_to(:root) && return unless @article\n\n @pictures_only = params[:pictures]\n @article.increase_views_count!\n\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @comment_show = CommentShow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment_show }\n end\n end",
"def show\n @comment_show = CommentShow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment_show }\n end\n end",
"def index\n number_of_days = params[:days] ? params[:days].to_i : 2\n date = Time.now - number_of_days.days\n @comments = @comic.comments.find(:all, :order => \"created_on DESC\", :conditions => [\"created_on >= ?\", date])\n @comments_by_page = @comments.group_by {|comment| comment.page }\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @comments.to_xml }\n format.rss { render :action => \"comments_for_comic.rxml\", :layout => false }\n end\n end",
"def show\n\t\t@article = Article.find(params[:id])\n\t\t@comment = Comment.new\n\t\t@comment.article_id = @article.id\n\tend",
"def show\n\t\t@article = Article.find(params[:id])\n\n\t\t@comment = Comment.new\n\t\t@comment.article_id = @article.id\n\tend",
"def show\n @reply = Reply.find(params[:id])\n @article = Article.find(params[:article_id])\n # @blog = params[:blog_id]\n # @comments = @reply.comments.paginate(:per_page => 10, :page => params[:page])\n # @comments = Comment.find(:all, :conditions => ['article_id = ?', @reply.id] ).concat( Reply.find(:all, :conditions => ['parent_id = ?', @reply.id]))\n # @comments.sort! do |x, y|\n # x.created_at <=> y.created_at\n # end\n respond_to do |format|\n format.html\n format.xml { render :xml => @reply }\n end\n end",
"def show\n\t\tPost.update_counters(params[:id], :views => 1)\n @post = Post.find(params[:id])\n\t\t@comments = Comment.find(:all, :conditions => { :post_id => params[:id] })\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @comments = @tourism_article.comments.published.recent.page(params[:page]).per(10)\n @comment = Comment.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tourism_article }\n end\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def index\n @comments = @entry.comments\n respond_with(@comments)\n end",
"def show\n @article = Article.find(params[:id])\n\n # seznam komentaru pro clanek\n @comments = Comment.where(:article_id => @article.id)\n\n # entita na pridani noveho komentare\n @comment = Comment.new\n @comment.user = current_user\n @comment.article = @article\n end",
"def show\n @comment_node = CommentNode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @comment_node }\n end\n end",
"def create\n @article_comment = ArticleComment.new(params[:article_comment])\n \n\n respond_to do |format|\n @article_comment.user_id = session[:user_id]\n if @article_comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to news_path(@article_comment.article_id) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n @article = Article.find(@article_comment.article_id)\n @article_comments = @article.article_comments.paginate(:page => params[:page] , :per_page => 20)\n format.html { render :action => :show }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @texto = Texto.find(params[:id])\n @comments = @texto.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @texto }\n end\n end",
"def create\n #@comment = Comment.new(params[:article_id])\n @comment = Article.find(params[:article_id]).comments.create(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @new_comment, :status => :created, :location => @new_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @new_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @crawler_article = CrawlerArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def create\n @article = Article.find(params[:article_id])\n @article_comment = @article.article_comments.build()\n @article_comment.content = params[:replyContent]\n\n respond_to do |format|\n if @article_comment.save\n #format.html { redirect_to @article, :anchor => 'comment' }\n format.html { redirect_to(article_path(@article, :anchor => \"comment\", :page=>1)) }\n\n format.xml { render :xml => @article_comment, :status => :created, :location => @article_comment }\n else\n format.html { redirect_to(@article) }\n format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end",
"def index\n if params[:comment_id].nil?\n @respuesta = Respuestum.all\n else\n @respuesta = Respuestum.where(:comment_id => params[:comment_id])\n \nend\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @respuesta }\n end\n end",
"def show\n return false unless authorize(permissions = [\"view_comment\"])\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def rss\n forum = Forum.find(params[:id])\n comments = forum.comments_by_topic.find_all{|c| !c.private and forum.can_see? current_user}\n render_rss_feed_for comments, {\n :feed => {\n :title => \"New OpenMind Comments for Forum \\\"#{forum.name}\\\"\",\n :link => forum_url(forum.id),\n :pub_date => :created_at\n },\n :item => {\n :title => :rss_headline,\n :description => :rss_body,\n :link => Proc.new{|comment| \"#{topic_url(comment.topic.id, :anchor => comment.id)}\" }\n }\n }\n end"
] | [
"0.7138699",
"0.69637847",
"0.68539035",
"0.6730535",
"0.6730535",
"0.6726112",
"0.67232865",
"0.6709886",
"0.6683312",
"0.6682627",
"0.66215074",
"0.66215074",
"0.66215074",
"0.6614249",
"0.6601951",
"0.6593226",
"0.6580574",
"0.6566607",
"0.6563338",
"0.6559287",
"0.6543599",
"0.6514735",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6510313",
"0.6494801",
"0.64918214",
"0.6482452",
"0.6482452",
"0.6474149",
"0.6472099",
"0.6445973",
"0.6437348",
"0.63834256",
"0.63834256",
"0.63806844",
"0.6372836",
"0.63708353",
"0.63305396",
"0.6321362",
"0.62990695",
"0.62964845",
"0.6288056",
"0.627944",
"0.6272313",
"0.6271953",
"0.6270092",
"0.62678576",
"0.6266133",
"0.6259568",
"0.6255909",
"0.62531406",
"0.6247079",
"0.6235596",
"0.6227154",
"0.6223689",
"0.6214478",
"0.6189829",
"0.6185369",
"0.61849976",
"0.6184009",
"0.6180729",
"0.6180729",
"0.6180729",
"0.61689687",
"0.6159033",
"0.6154914",
"0.61502075",
"0.6134074",
"0.6134074",
"0.6123449",
"0.6120411",
"0.6119712",
"0.61079776",
"0.60999805",
"0.60989976",
"0.60848594",
"0.60812235",
"0.605246",
"0.60522926",
"0.6044902",
"0.6035607",
"0.601431",
"0.60017055",
"0.5988327",
"0.5968255",
"0.5965634",
"0.59633464",
"0.59626454"
] | 0.7225215 | 0 |
GET /article_comments/new GET /article_comments/new.xml | def new
@article_comment = ArticleComment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @article_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n @meta[:title] = 'New comment'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment_node = CommentNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment_node }\n end\n end",
"def new\n @comment = @parent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @topic_comment = TopicComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic_comment }\n end\n end",
"def new\n @comment = @network.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def create\n #@comment = Comment.new(params[:article_id])\n @comment = Article.find(params[:article_id]).comments.create(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @new_comment, :status => :created, :location => @new_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @new_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @news_article = NewsArticle.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_article }\n end\n end",
"def new\n return false unless authorize(permissions = [\"create_comment\"])\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n respond_to do |wants|\n wants.html { redirect_to pretty_post_url(@post) + '#comments' }\n wants.xml { render :xml => @comment }\n end\n end",
"def new\n @comment_show = CommentShow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment_show }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @reply = Reply.new(:parent_id => params[:article_id],:attitude => params[:attitude])\n @article = Article.find(params[:article_id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reply }\n end\n end",
"def new\n @comment2 = Comment2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment2 }\n end\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @submission_comment = SubmissionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end",
"def new\n @crawler_article = CrawlerArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @comment = @parent.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @article = Thumbwebs::Article.new(:title =>'', :synopsis => '',:body =>'', :published =>'',\n :rights =>'', :channel_id => '')\n\n respond_to do |format|\n format.html {render :template => \"new\"}# new.html.erb\n format.xml { render :xml => @article, :root => 'thumbwebs:articles' }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @point_of_interest_comment = PointOfInterestComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_of_interest_comment }\n end\n end",
"def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @post305 = Post305.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post305 }\n end\n end",
"def new\n load_data\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @subcomment = Subcomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subcomment }\n end\n end",
"def new\n @news = News.new\n @title = \"New news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @catalogs_comment_type = Catalogs::CommentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_comment_type }\n end\n end",
"def new\n @news_link = NewsLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_link }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def new\n @comment = @computer.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n @post290 = Post290.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post290 }\n end\n end",
"def new\n @comment = Comment.new\n @text = Text.find(params[:text])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = @posting.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @page_comment = PageComment.new\n @page_comment.notify_me = true if current_user\n @types = PageCommentType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_comment }\n end\n end",
"def new\n @post215 = Post215.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post215 }\n end\n end",
"def new\n @news_category = NewsCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_category }\n end\n end",
"def new\n @article_category = ArticleCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_category }\n end\n end",
"def new\n @post342 = Post342.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post342 }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end",
"def new\n use_tinymce(:simple)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @post321 = Post321.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post321 }\n end\n end",
"def new\n @article = Article.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @post_note = PostNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post_note }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @post110 = Post110.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post110 }\n end\n end",
"def new\n @related_content = RelatedContent.new\n\t\t@related_content.node_id = params[:node_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @related_content }\n end\n end",
"def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def new\n @post21 = Post21.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post21 }\n end\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n @post217 = Post217.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post217 }\n end\n end",
"def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end"
] | [
"0.7833341",
"0.76509726",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.763149",
"0.749347",
"0.72768426",
"0.72593415",
"0.7248823",
"0.7105374",
"0.70423734",
"0.70423734",
"0.70423734",
"0.70423734",
"0.70423734",
"0.70423734",
"0.70423734",
"0.70423734",
"0.7025227",
"0.7009142",
"0.69892955",
"0.6981181",
"0.6895676",
"0.68872535",
"0.6883686",
"0.68822926",
"0.68361586",
"0.68238753",
"0.68238753",
"0.68238753",
"0.68189734",
"0.6816334",
"0.6816334",
"0.6812659",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68125",
"0.68102056",
"0.68102056",
"0.6809669",
"0.6798656",
"0.67936707",
"0.67832613",
"0.67785305",
"0.67764044",
"0.67648864",
"0.67648417",
"0.67341906",
"0.67336214",
"0.6716469",
"0.67149067",
"0.67097193",
"0.6706055",
"0.66891575",
"0.66869235",
"0.6677051",
"0.66737664",
"0.6672693",
"0.66709554",
"0.6667251",
"0.66554296",
"0.6653653",
"0.66449153",
"0.66278887",
"0.6625146",
"0.6625146",
"0.6625146",
"0.6621913",
"0.66151786",
"0.66045904",
"0.66045904",
"0.6604237",
"0.6603558",
"0.65925455",
"0.65893686",
"0.65809524",
"0.65792835",
"0.6578039",
"0.65770054",
"0.6572948",
"0.65624225"
] | 0.7926563 | 0 |
POST /article_comments POST /article_comments.xml | def create
@article = Article.find(params[:article_id])
@article_comment = @article.article_comments.build()
@article_comment.content = params[:replyContent]
respond_to do |format|
if @article_comment.save
#format.html { redirect_to @article, :anchor => 'comment' }
format.html { redirect_to(article_path(@article, :anchor => "comment", :page=>1)) }
format.xml { render :xml => @article_comment, :status => :created, :location => @article_comment }
else
format.html { redirect_to(@article) }
format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@comment = Comment.new(params[:article_id])\n @comment = Article.find(params[:article_id]).comments.create(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @new_comment, :status => :created, :location => @new_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @new_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.find(params[:article_id])\n @comment = @article.comments.create(comment_params)\n redirect_to article_path(@article)\n end",
"def create\n comment = Comment.new(params[:comment])\n @articles_comments_service.create_comment(comment)\n end",
"def create\n @article = Article.find(params[:article_id])\n @comment = @article.comments.create(comment_params)\n redirect_to article_path(@article)\n end",
"def create\n\t\t@article = Article.find(params[:article_id])\n\t\t@comment = @article.comments.create(comment_params)\n\t\tredirect_to article_path(@article)\n\tend",
"def create\n @article.comments << Comment.new(comment_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to article_show_path(@article), notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.find(params[:article_id]) #randam straipsni\n @comment = @article.comments.create(comment_params) #straipsniui priskiriam komentara\n redirect_to article_path(@article) #nukreipiam vartotoja i straipsni\n end",
"def create\n @article_comment = Article::Comment.new(article_comment_params)\n\n respond_to do |format|\n if @article_comment.save\n format.html { redirect_to @article_comment, notice: 'Comment was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @articlecomment = Articlecomment.new(articlecomment_params)\n\n respond_to do |format|\n if @articlecomment.save\n format.html do\n redirect_to @articlecomment,\n notice: 'Comment was successfully created.'\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @articlecomment.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @article_comment = ArticleComment.new(params[:article_comment])\n \n\n respond_to do |format|\n @article_comment.user_id = session[:user_id]\n if @article_comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to news_path(@article_comment.article_id) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n @article = Article.find(@article_comment.article_id)\n @article_comments = @article.article_comments.paginate(:page => params[:page] , :per_page => 20)\n format.html { render :action => :show }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.find(params[:article_id]) #@article will association between article and\n # comment through artitcle_id\n @comment = @article.comments.create(comment_params) #We use the create method on @article.comments\n # to create and save comment.\n\n redirect_to article_path(@article)# call show action on article\n\n end",
"def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n post_comment(@comment)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comment }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment_node = CommentNode.new(params[:comment_node])\n\n respond_to do |format|\n if @comment_node.save\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully created.' }\n format.json { render :json => @comment_node, :status => :created, :location => @comment_node }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to article_path(@comment.article_id), notice: \"Dziękujemy za komentarz.\" }\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 create\n\t\t@comment = Comment.new(comment_params)\n\t\t@comment.article_id = params[:article_id]\n\t\t@comment.save\n\n\t\t#the alternative from Rails tutorial is usign FIND\n\t\t#@article = Article.find(params[:article_id])\n\t\t#@comment = @article.comments.create(comments_params)\t\t\n\n\t\tredirect_to article_path(@comment.article)\t\t#we need to show the whole article page, not just the comment\n\tend",
"def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.article, notice: 'Comment was successfully 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 create\n \n @article = Article.find(params[:article_id])\n @comment = @article.comments.create(comment_params)\n @comment.user = current_user\n respond_to do |format|\n if @comment.save\n format.html { redirect_to article_path(@article), notice: 'Comment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comment }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\nend",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def create\n @comment = @post.comments.build(params[:comment])\n \n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(posts_url) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @article_comment = ArticleComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_comment }\n end\n end",
"def create\n @article_comment = ArticleComment.new(article_comment_params)\n @article_comment.user = current_user\n\n respond_to do |format|\n if @article_comment.save\n format.html { redirect_to @article_comment, notice: 'Article comment was successfully created.' }\n format.json { render :show, status: :created, location: @article_comment }\n else\n format.html { render :new }\n format.json { render json: @article_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = @article.comments.create(\n body: comment_params[:body],\n user_id: current_user.id\n )\n redirect_to article_path @article\n end",
"def create\n @article = Article.find(params[:article_id])\n @comment = @article.comments.new(comment_params)\n @comment.user_id = current_user.id\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to root_path , notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { redirect_to root_path, notice: 'Comment should not be empty.' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"def create\n article = Article.find(params[:id])\n comment = Comment.new(comment_params)\n\n if is_valid?(comment) && comment.save\n flash[:success] = I18n.t 'comment.create.success'\n article.comments << comment\n article.save!\n else\n flash[:danger] = I18n.t 'comment.create.error' unless flash[:danger]\n end\n redirect_to :back\n end",
"def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment])\n @comment.researcher = logged_in_researcher\n\n if @comment.save\n respond_to do |format|\n format.html { redirect_to post_path(@post), :notice => \"Comment was successfully added.\" }\n format.xml { render :xml => @comment, :status => :created, :location => @comment}\n format.json { render :json=> @comment, :status => :created, :location => @comment}\n end\n else\n respond_to do |format|\n format.html { redirect_to post_path(@post), :alert => \"Failed to add comment: #{@comment.errors.full_messages.join(', ')}\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json=> @comment.errors, :status => :unprocessable_entity }\n end \n end\n end",
"def create_comment\n @article.create_random_comment\n redirect_to article_path(@article)\n end",
"def create\n @comment = Post.find(params[:post_id]).comments.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to post_comments_url(@comment.post) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.save\n respond_with(@post, @comment)\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to(@comment, :notice => 'Comment was successfully created.') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(@comment) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(@comment) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@article = Article.find(params[:article_id])\n\t\t@comment = @article.comments.new(params[:comment])\n\t\t@comment.account = current_account\n\n\t\trespond_to do |format|\n\t\t\tif @comment.save\n\t\t\t\tformat.html { redirect_to @article, notice: 'Comment was successfully created.' }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.js { }\n\t\t\tend\n\t\tend\n\tend",
"def post_comment(comment, poi=\"4f4f4c27d4374e800100001d\")\n uri = URI.parse(\"http://mashweb.fokus.fraunhofer.de:3008/api/comment\")\n response = Net::HTTP.post_form(uri, {\n :title => 'Autocomment',\n :body => comment\n })\n end",
"def create\n \tnew_comment = params.require(:comment).permit(:body)\n \tpost = Post.find(params[:post_id])\n \tcomment = post.comments.create(new_comment)\n\n \tredirect_to post_comment_path(post, comment)\n end",
"def create\n @article = Article.find(params[:article_id])\n @comment = @article.comments.build(params[:comment])\n @comment.user = current_user\n\n respond_to do |format|\n if @article.state > 2\n if @comment.save\n format.html { redirect_to(@article, :notice => 'Comment was successfully created.') }\n else\n format.html { redirect_to(@article, :notice => 'There was an error saving your comment (empty comment or comment way to long).') }\n end\n else\n format.html { redirect_to(@article, :notice => 'Comments are limited to published articles.') }\n end \n end\n end",
"def article_params\n params.require(:article).permit(:title, :text, comments_attributes: [:name, :email, :body])\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create_comments\n end",
"def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def create\n comment = Comment.new(params[:comment])\n @entry.comments << comment if comment.valid?\n respond_with(comment, location: redirect_to_index)\n end",
"def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @comment = current_user.comments.new(comment_params)\n @comment.article = @article\n respond_to do |format|\n if @comment.save\n set_params_save(format, @comment.article, 'Comment was successfully created.', :show)\n else\n set_params_not_save(format, @comment.errors, 'Comment was successfully created.')\n end\n end\n end",
"def create\n @comment = @question.comments.create(comment_params)\n redirect_to question_path(@question)\n end",
"def comment_params\n params.require(:comment).permit(:article_id, :name, :content)\n end",
"def create\n @comment = @network.comments.build(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to([:admin, @network, :comments]) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comments = @story.comments\n @comment = @story.comments.new(params[:comment])\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(@story) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render 'stories/show' }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.create(:content => params[:article_content])\n @graph = Graph.find(params[:graph_id], :select => \"id\", :readonly => true)\n @note = Note.new(params[:note])\n @note.article = @article\n @note.graph = @graph\n\n respond_to do |format|\n if @note.save\n SyncLog.note_create_new(@note.graph.id, @note, params[:clientId])\n format.xml { render :xml => @note.to_xml(:only => [:id]), :status => :created }\n else\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = @article.comments.new(comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to magazine_article_path(@magazine, @article), notice: 'Comment was successfully 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 create\n @comment = current_user.comments.new(comment_params)\n @comment.article_id = params[:article_id]\n @load_content = preload_content\n authorize @comment\n if @comment.save\n ArticleRankingWorker.perform_async(params[:article_id])\n render 'api/v1/comments/show', status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def article_comment_params\n params.require(:article_comment).permit(:content, :user_id, :article_id)\n end",
"def article_comment_params\n params.require(:article_comment).permit(:content, :user_id, :article_id)\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'comment was successfully created.'\n format.html { redirect_to(:action=> 'index', :notice_id=> @comment.notice_id) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n puts params.to_json\n @post = Post.find(params[:comment][:post_id])\n @comment = @post.comments.build(comment_params)\n if @comment.save\n redirect_to root_path\n end\n end",
"def create\n @object = Comment.new(params[:comment])\n Comment.transaction do\n @object.save!\n create_change_log_entry\n end\n respond_to do |format|\n flash[:notice] = 'Thanks for your comments.'\n format.html { redirect_to(@object.post) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n end\n end",
"def article_comment_params\n params.require(:article_comment).permit(:user_id, :article_id, :body)\n end",
"def show\n @article = Article.find(params[:id])\n @comment = @article.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def comment_params\n params.require(:comment).permit(:article_id, :author, :email, :content)\n end",
"def create\n @comment = Comment.new(params[:comment])\n rel = Neo4j::Rails::Relationship.new(:commentsOn, @comment, @position)\n\n respond_to do |format|\n if @comment.save and rel.save\n format.html { redirect_to @position, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { redirect_to @position, error: 'Failed to create comment.' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if verify_recaptcha(:mode => @comment, :message => \"Recaptcha error\") && @comment.save\n Notify.comment(@comment).deliver\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.created\") }\n format.xml { render :xml => @comment.post, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new :body => params[:comment][:body],\n :issue => false\n @comment.polycomment_type = params[:polycomment_type]\n @comment.polycomment_id = params[:polycomment_id]\n @comment.user_id = current_user.id \n if @comment.save\n #flash[:notice] = 'Your comment was posted!'\n redirect_to :back\n else\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end",
"def create\n @comment = @post.comments.build(params[:comment])\n\n respond_to do |wants|\n if @comment.save\n\t\t\t\tuser_session.add_comment(@comment)\n flash[:notice] = 'Comment was successfully created.'\n\t\t\t\tflash[:comment_saved] = true\n wants.html { redirect_to pretty_post_url(@post) + \"#comment_#{@comment.id}\" }\n wants.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n\t\t\t\t# @new_comment = true\n\t\t\t\tflash[:comment_params] = params[:comment]\n\t\t\t\tflash[:comment_error] = @comment.errors.full_messages.join('<br />')\n wants.html { redirect_to pretty_post_url(@post) + '#add_comment' } # { render :template => 'posts/show', :section => 'comments' }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.find(params[:article_id])\n @article_comment = @article.article_comments.create(article_comment_params)\n @article_comment.user_id = current_user.id #or whatever is you session name\n if @article_comment.save\n redirect_to @article\n else\n flash.now[:danger] = \"error\"\n end\nend",
"def comment_params\n params.permit(:content, :article_id)\n end",
"def comment_params\n params.require(:comment).permit(:content,\n :text,\n :article_id,\n :published_at)\n end",
"def create\n \t# collects nested attributes, for post & comment, from params\n new_post = params.require(:post).permit(:body, :link, comments_attributes: [:body])\n\n \tpost = Post.create(new_post)\n \tredirect_to post_path(post.id)\n end",
"def create\n @blogpost = Blogpost.find(params[:blogpost_id])\n\n @comment = @blogpost.comments.create(comment_params)\n render json: @comment\n end",
"def create\n @action_idea_comment = ActionIdeaComment.new(action_idea_comment_params)\n\n respond_to do |format|\n if @action_idea_comment.save\n format.html { redirect_to @action_idea_comment, notice: 'Action idea comment was successfully created.' }\n format.json { render :show, status: :created, location: @action_idea_comment }\n else\n format.html { render :new }\n format.json { render json: @action_idea_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commente = Commente.new(commente_params)\n\n respond_to do |format|\n if @commente.save\n format.html { redirect_to @commente, notice: \"Commente was successfully created.\" }\n format.json { render :show, status: :created, location: @commente }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @commente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
"def create\n @comment = Comment.new({user_id: params[:user_id], announcement_id: params[:announcement_id], description: params[:description]})\n @comment.save\n render json:@comment\n end",
"def create\n @comment = @event.comments.new(comment_params)\n if @comment.save\n redirect_to @event, notice: 'Thanks for your comment'\n else\n redirect_to @event, alert: 'Comment failse'\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def comment_params\n params.require(:comment).permit(:name, :article_id)\n end",
"def comment_aux(action, opts)\n\n unless action == \"destroy\"\n\n data = LibXML::XML::Parser.string(request.raw_post).parse\n\n comment = parse_element(data, :text, '/comment/comment')\n subject = parse_element(data, :resource, '/comment/subject')\n end\n\n # Obtain object\n\n case action\n when 'create';\n return rest_response(401, :reason => \"Not authorised to create a comment\") unless Authorization.check('create', Comment, opts[:user], subject)\n\n ob = Comment.new(:user => opts[:user])\n when 'view', 'edit', 'destroy';\n ob, error = obtain_rest_resource('Comment', opts[:query]['id'], opts[:query]['version'], opts[:user], action)\n else\n raise \"Invalid action '#{action}'\"\n end\n\n return error if ob.nil? # appropriate rest response already given\n\n if action == \"destroy\"\n\n ob.destroy\n\n else\n\n ob.comment = comment if comment\n\n if subject\n return rest_response(400, :reason => \"Specified resource does not support comments\") unless [Blob, Network, Pack, Workflow].include?(subject.class)\n return rest_response(401, :reason => \"Not authorised to add a comment to the specified resource\") unless Authorization.check(action, Comment, opts[:user], subject)\n ob.commentable = subject\n end\n\n # Start of curation hack\n\n def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end\n\n if comment[0..1].downcase == 'c:' && opts[:user] && subject &&\n Conf.curators.include?(opts[:user].username)\n\n comment = comment[2..-1].strip\n\n lines = comment.split(\"\\n\")\n events = []\n failed = false\n\n lines.each do |line|\n\n line.strip!\n\n bits = line.split(\";\")\n\n if bits.length > 1\n details = bits[1..-1].join(\";\")\n else\n details = nil\n end\n\n if bits.length > 0\n bits[0].split(\",\").each do |bit|\n\n bit.downcase!\n bit.strip!\n\n curation_type = match_tag_name(bit)\n\n if curation_type\n events.push(CurationEvent.new(:category => curation_type,\n :object => subject, :user => opts[:user], :details => details))\n else\n failed = true\n end\n end\n end\n end\n\n if failed\n return rest_response(400, :reason => 'Unrecognised curation term')\n end\n\n events.each do |event|\n event.save\n end\n\n subject.solr_index\n\n return rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\n end\n\n # End of curation hack\n\n success = ob.save\n\n if success\n case action\n when \"create\"; Activity.create(:subject => opts[:user], :action => 'create', :objekt => ob)\n when \"edit\"; Activity.create(:subject => opts[:user], :action => 'edit', :objekt => ob)\n end\n end\n\n return rest_response(400, :object => ob) unless success\n end\n\n rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\nend",
"def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(comment_params)\n redirect_to post_path(@post)\n end",
"def create\r\n\t\t#create new comment\r\n\t\t@comment = Comment.new(comment_params)\r\n\t\tif @comment.save\r\n\t\t\t#if save success send js handles the rest\r\n\t\t\t@post = @comment.post\r\n\t\t\trespond_to :js\r\n\t\telse\r\n\t\t\t# if fails alert user\r\n\t\t\tflash[:alert] = \"Something went wrong\"\r\n\t\tend\r\n\tend",
"def create\n @comment = create_comment\n\n respond_to do |format|\n if @comment.save!\n @post.touch && @comment.ancestors.each(&:touch)\n\n broadcast_new_post @comment\n dom_id = \"/#H#{@comment.id}\"\n\n format.html { redirect_to post_path(@post.root)+dom_id, notice: 'Post was successfully created.' }\n # format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to post_path(@post.root), notice: 'Error: Comment was not made.' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::RecordInvalid => e\n redirect_to post_path(@post.root), notice: e.message\n end",
"def create\n @comment = @parent.comments.new(params[:comment])\n @comment.user_id = session[:user_id]\n\n respond_to do |format|\n if @comment.save\n @comment.update_post\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.entry = @entry\n @comment.ip_address = request.remote_ip\n @comment.referrer = params[:referrer] if params[:referrer]\n @comment.user_agent = request.env['HTTP_USER_AGENT']\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to(@entry.url) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_comment(action, name, message)\n summary = :\"name_#{action}_comment_summary\".l\n comment = Comment.create!(\n :target => name,\n :summary => summary,\n :comment => message\n )\n Transaction.post_comment(\n :id => comment,\n :target => name,\n :summary => summary,\n :comment => message\n )\n end",
"def comment\n @comment = Comment.new(comment_params)\n @comment.article_id = params[:id]\n @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n @article = Article.find(@comment.article_id)\n @article.view -= 1\n Article.update(params[:id], view: @article.view)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to action: 'details' }\n format.json { render :details, status: :ok, location: @article }\n else\n format.html { redirect_to action: 'details' }\n format.json { render json: @comment.errors, status: :unprocessable_entity, location: @article }\n end\n end\n end",
"def create\n comment = Comment.new(create_params)\n comment.post = @post\n if comment.save\n render json: comment, status: 200\n else\n render json: comment.errors, status: 403\n end\n\n end",
"def new\n @comment_node = CommentNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment_node }\n end\n end",
"def comment_params\n params.permit([:article_id, :content, :name, :email, :website])\n end",
"def postComment\n @comment = Comment.new\n @comment.content = params[\"content\"]\n @comment.new_id = params[\"newId\"]\n @comment.user_id = session[:user_id]\n if @comment.save\n flash[:success] = 'Comment added successfully'\n else\n flash[:warning] = 'Fail to add comment'\n end\n redirect_to :controller => 'news', :action => 'item', :id => params[\"newId\"]\n end",
"def test02_post_open_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 create\n @new_comment = post.comments.new(comment_params)\n @new_comment.user = current_user\n\n respond_to do |format|\n if @new_comment.save\n format.html { redirect_to post, notice: I18n.t('controllers.comments.created') }\n format.json { render :show, status: :created, location: post }\n else\n format.html { redirect_to post, alert: I18n.t('controllers.comments.error') }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Used in notifications.rb Kind of an ugly hack, but it's fast and\n # direct.\n $SITE_DOMAIN = request.domain\n\n @comment = Comment.new(params[:comment])\n @page = Page.find(params[:page])\n @comment.page = @page\n @comment.user = current_user\n @comment.parent_id = params[:parent]\n @parent_id = @comment.parent_id\n @comment_indent = params[:indent].to_i\n if @comment.save\n flash[:notice] = \"Comment added\"\n else\n flash[:notice] = \"Error creating new comment\"\n end\n end",
"def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create!(comment_params)\n\n redirect_to post_path(@post)\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 create\n @comment = Comment.new(params[:comment])\n \n params[:comments_page] = 1 if params[:comments_page] == ''\n\n respond_to do |format|\n if @comment.save\n domid = dom_id(@comment.commentable)\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(@comment) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n format.js {\n flash[:notice] = nil\n render :update do |page|\n page.replace \"comments_area_#{domid}\", :partial => \"comments\", :locals => {\n :comments => @comment.commentable.comments.paginate(:page => params[:comments_page], \n :order => \"created_at ASC\", :per_page => 10), \n :new_comment => @comment.commentable.comments.new }\n page.replace_html \"add_comment_#{domid}\", :text => \"Thank you for your comment.\"\n page << \"$(\\\"#add_comment_#{domid}\\\").fadeOut(5000, function() { $(this).remove(); })\"\n page.replace_html \"comments_#{dom_id(@comment.commentable)}\", :text => (@comment.commentable.comments_count + 1).to_s\n end\n }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.json { render :show, status: :created, location: @comment }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_comment(post_id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/create_comment\", :comment => comment.merge(:post_id => post_id),\n :attachments => attachments\n end",
"def new\n @comment = @network.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def create\n # store that comment for later mailer delivery and channel broadcasting\n comment = @post.comments.create! comments_params\n\n # mailer deliver later\n CommentsMailer.submitted(comment).deliver_later\n\n # render to page in real time using websocket channels\n CommentsChannel.broadcast(comment)\n\n redirect_to @post\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n \n format.html { redirect_to article_url(@article) }\n format.xml do\n headers[\"Location\"] = article_url(@article)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def create\n @topic_comment = TopicComment.new(params[:topic_comment])\n\n respond_to do |format|\n if @topic_comment.save\n flash[:notice] = 'TopicComment was successfully created.'\n format.html { redirect_to(@topic_comment) }\n format.xml { render :xml => @topic_comment, :status => :created, :location => @topic_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @article_comment = ArticleComment.find(params[:id])\n @article_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_comments_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.6973863",
"0.67758304",
"0.67474",
"0.6717696",
"0.6668092",
"0.66457486",
"0.6593195",
"0.647",
"0.6407714",
"0.6404982",
"0.6362379",
"0.6350214",
"0.63283217",
"0.62911814",
"0.6280884",
"0.627409",
"0.62559813",
"0.62031823",
"0.6188769",
"0.61598265",
"0.611159",
"0.6098631",
"0.60904235",
"0.6081767",
"0.608042",
"0.60800844",
"0.6075775",
"0.6069218",
"0.60415566",
"0.60208184",
"0.5972796",
"0.5972796",
"0.59594655",
"0.594163",
"0.59338087",
"0.5929792",
"0.5928798",
"0.5926481",
"0.5926481",
"0.5926481",
"0.591536",
"0.5913835",
"0.5909754",
"0.58918226",
"0.58521533",
"0.5848006",
"0.5847892",
"0.5845592",
"0.58303416",
"0.5826989",
"0.582561",
"0.5825047",
"0.5825047",
"0.578502",
"0.57842827",
"0.5748811",
"0.57486653",
"0.57460415",
"0.5734045",
"0.5703324",
"0.56987816",
"0.5694015",
"0.569104",
"0.5688467",
"0.56880796",
"0.5676337",
"0.5672159",
"0.5671695",
"0.56714684",
"0.56505793",
"0.56485164",
"0.56320417",
"0.56310385",
"0.56240463",
"0.5621226",
"0.5620748",
"0.56199276",
"0.56197774",
"0.5616112",
"0.56116664",
"0.56057274",
"0.56050056",
"0.56032485",
"0.5589363",
"0.5587943",
"0.5587214",
"0.55858195",
"0.5584628",
"0.5577562",
"0.5575363",
"0.55712926",
"0.5564744",
"0.55609524",
"0.5560017",
"0.55507743",
"0.5546121",
"0.5546119",
"0.5541108",
"0.55410105",
"0.5540382"
] | 0.7053149 | 0 |
PUT /article_comments/1 PUT /article_comments/1.xml | def update
@article_comment = ArticleComment.find(params[:id])
respond_to do |format|
if @article_comment.update_attributes(params[:article_comment])
format.html { redirect_to(@article_comment, :notice => 'Article comment was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n @article = Article.find(params[:article_id])\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to article_path(@article), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n \n \n end",
"def update\n @comment_node = CommentNode.find(params[:id])\n\n respond_to do |format|\n if @comment_node.update_attributes(params[:comment_node])\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.updated\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article_comment.update(article_comment_params)\n format.html { redirect_to @article_comment, notice: 'Article comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_comment }\n else\n format.html { render :edit }\n format.json { render json: @article_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article_comment.update(article_comment_params)\n format.html { redirect_to @article_comment, notice: 'Article comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_comment }\n else\n format.html { render :edit }\n format.json { render json: @article_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @articlecomment.update(articlecomment_params)\n format.html do\n redirect_to @articlecomment,\n notice: 'Comment was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @articlecomment }\n else\n format.html { render :edit }\n format.json do\n render json: @articlecomment.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @comment = @item.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to article_url(@article) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors.to_xml } \n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n @meta[:title] = \"Comment from #{@comment.author}\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.article, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @comment = Comment.find params[:id]\n\n if @comment.update_attributes params.require(:comment).permit(:name, :email, :website, :comment)\n @article = @comment.article;\n render :show\n else\n render :edit\n end\n\n end",
"def update\n respond_to do |format|\n if @article_comment.update(article_comment_params)\n format.html { redirect_to @article_comment, notice: 'Comment was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def set_articlecomment\n @article = Article.find(params[:id])\n @articlecomment = Articlecomment.find(params[:id])\n end",
"def update\n=begin @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n=end\n create\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(location_comments_path(@comment.location)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |wants|\n if @comment.update_attributes(params[:comment])\n wants.html { redirect_to(@comment) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Sitio actualizado correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = @network.comments.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to([:admin, @network, :comments]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.get(params[:id])\n\n respond_to do |format|\n if @article.update(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(@article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(@article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end",
"def update\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(sprint_task_comments_path(@sprint,@task)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to comment_url(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors.to_xml }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n # increase edit by 1\n if @article.edit_count\n @article.edit_count = @article.edit_count + 1\n else\n @article.edit_count = 0\n end\n # save\n respond_to do |format|\n if @article.update_attributes(params[:article])\n #format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.html { redirect_to session[:edit_redirect], notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to comment_url(@entry,@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_comment\n @comment = @article.comments.find(params[:id]);\n end",
"def update_comment\n @artifact_answer = ArtifactAnswer.find(params[:artifact_answer][:id])\n @artifact_answer.update_attributes(comment_params)\n end",
"def update\n @comment.update_attributes(params[:comment])\n respond_with(@comment, location: redirect_to_index)\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def update_comment(id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/update_comment\", :comment_id => id,\n :comment => comment, :attachments => attachments\n end",
"def update\n # @comment = Comment.find(params[:id])\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article ||= Article.find(params[:id])\n @article.user_id = current_user.id\n @title = t('label.article.creating')\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(article_path(:id=>@article.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def comment\n @comment = Comment.new(comment_params)\n @comment.article_id = params[:id]\n @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n @article = Article.find(@comment.article_id)\n @article.view -= 1\n Article.update(params[:id], view: @article.view)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to action: 'details' }\n format.json { render :details, status: :ok, location: @article }\n else\n format.html { redirect_to action: 'details' }\n format.json { render json: @comment.errors, status: :unprocessable_entity, location: @article }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: t(\"actions.updated\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to magazine_article_path(@magazine, @article), notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(edit_admin_post_comment_path(@post, @comment)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(board_article_path(@board, @article), :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.find(params[:article_id])\n @article_comment = @article.article_comments.build()\n @article_comment.content = params[:replyContent]\n\n respond_to do |format|\n if @article_comment.save\n #format.html { redirect_to @article, :anchor => 'comment' }\n format.html { redirect_to(article_path(@article, :anchor => \"comment\", :page=>1)) }\n\n format.xml { render :xml => @article_comment, :status => :created, :location => @article_comment }\n else\n format.html { redirect_to(@article) }\n format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |wants|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n wants.html { redirect_to pretty_post_url(@comment.post) + \"#comment_#{@comment.id}\" }\n wants.xml { head :ok }\n else\n wants.html { render :action => 'edit' }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n use_tinymce(:simple) # in case of errors\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to_commentable(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.blog}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @eventcomment = Eventcomment.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @eventcomment.update_attributes(params[:eventcomment])\r\n format.html { redirect_to event_path(params[:id]), notice: 'Eventcomment was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @eventcomment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def set_article_comment\n @article_comment = ArticleComment.find(params[:id])\n end",
"def set_article_comment\n @article_comment = ArticleComment.find(params[:id])\n end",
"def set_article_comment\n @article_comment = Article::Comment.find(params[:id])\n end",
"def update\n expire_one(params[:id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to([:admin, @article], :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(comment_params)\n format.html { render :partial => 'show' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update\n @comment = @computer.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@computer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(:controller => \"posts\", :action => \"show\", :id => @comment.post_id, :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_comment\n @comment = Comment.find(params[:id])\n @comment.update(params[:comment])\n redirect \"/comments/#{@comment.id}\"\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment.update(comment_params)\n end",
"def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def update\n @crawler_article = CrawlerArticle.find(params[:id])\n\n respond_to do |format|\n if @crawler_article.update_attributes(params[:crawler_article])\n flash[:notice] = 'CrawlerArticle was successfully updated.'\n format.html { redirect_to(@crawler_article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crawler_article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def comments_put(resource, comment)\n merged_options = options.merge({ resource: resource, comment: comment })\n response = RestClient.post endpoint(\"/comments/put\"), merged_options\n parse_response(response)\n end",
"def update\n respond_to do |format|\n if @action_idea_comment.update(action_idea_comment_params)\n format.html { redirect_to @action_idea_comment, notice: 'Action idea comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_idea_comment }\n else\n format.html { render :edit }\n format.json { render json: @action_idea_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic_comment = TopicComment.find(params[:id])\n\n respond_to do |format|\n if @topic_comment.update_attributes(params[:topic_comment])\n flash[:notice] = 'TopicComment was successfully updated.'\n format.html { redirect_to(@topic_comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic_comment.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.67775",
"0.66272867",
"0.6463805",
"0.6380269",
"0.63516814",
"0.63516814",
"0.6330247",
"0.6270228",
"0.62661874",
"0.6241298",
"0.62362623",
"0.6210142",
"0.6210142",
"0.620209",
"0.6201098",
"0.6194806",
"0.6194537",
"0.619005",
"0.6178299",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6148663",
"0.6136589",
"0.6136589",
"0.6136589",
"0.6136589",
"0.6136589",
"0.612323",
"0.61222655",
"0.6114001",
"0.6092793",
"0.6091626",
"0.606387",
"0.6051541",
"0.60495156",
"0.60492027",
"0.6036992",
"0.6036992",
"0.6036992",
"0.6033268",
"0.6026114",
"0.60175437",
"0.60003644",
"0.5993756",
"0.59905255",
"0.5978869",
"0.59770995",
"0.5970952",
"0.5970096",
"0.59598815",
"0.5950902",
"0.5939628",
"0.592824",
"0.5918173",
"0.59148353",
"0.59006244",
"0.5900425",
"0.5889764",
"0.5887012",
"0.58843064",
"0.5880688",
"0.58795756",
"0.58795756",
"0.58783865",
"0.5875216",
"0.58721954",
"0.58668095",
"0.58665645",
"0.58665645",
"0.5863235",
"0.5862471",
"0.5841265",
"0.5839142",
"0.5833877",
"0.58301234",
"0.58301234",
"0.5828354",
"0.58223134",
"0.58204544",
"0.58196294",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58145297",
"0.58093065",
"0.58072233",
"0.5803265",
"0.5801359",
"0.5794352"
] | 0.69861263 | 0 |
DELETE /article_comments/1 DELETE /article_comments/1.xml | def destroy
@article_comment = ArticleComment.find(params[:id])
@article_comment.destroy
respond_to do |format|
format.html { redirect_to(article_comments_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n puts \">>>> Destroying a comment <<<<\"\n @comment = Comment.find(params[:id])\n puts \"found comment>>> #{@comment}\"\n @article = @comment.article\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_path(@article)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = @article.comments.find(params[:id])\n @comment.destroy\n redirect_to article_path @article\n end",
"def destroy\n @article = Article.find(params[:article_id])\n @comment = @article.comments.find(params[:id])\n @comment.destroy\n redirect_to article_path(@article)\n end",
"def destroy\n @article = Article.find(params[:article_id])\n @comment = @article.comments.find(params[:id])\n @comment.destroy\n redirect_to \"/articles/#{@article.id}\"\n end",
"def destroy\n @article = Article.find(params[:article_id])\n @comment = @article.comments.find(params[:id])\n @comment.destroy\n redirect_to article_path(@article)\n end",
"def destroy\n @article.comments.delete_all\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_comments\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n article = @comment.article\n @comment.destroy\n\n\tredirect_to article\n end",
"def destroy\n\t\t@article = Article.find(params[:article_id])\n\t\t@comment = @article.comments.find(params[:id])\n\t\t@comment.destroy\n\t\tredirect_to article_path(@article)\n\tend",
"def destroy\n\t\t@article = Article.find(params[:article_id])\n\t\t@comment = @article.comments.find(params[:id])\n\t\t@comment.destroy\n\t\tredirect_to article_path(@article)\n\tend",
"def test_delete_comment\n\n comments = Comment.getAll()\n\n for comment in comments\n\n result = Comment.deleteComment(comment.commentId)\n\n assert_equal true, result\n \n end\n\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(backdrafts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:article_id])\n @comment.destroy\n redirect_to article_path(@article), notice: \"Comment was successfully destroyed.\" \n \n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment_url) }\n format.xml { head :ok }\n end\n end",
"def delete_comment(article_id, id)\n delete \"articles/#{article_id}/comments/#{id}\"\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy!\n head :no_content\n end",
"def destroy\n @article_comment.destroy\n respond_to do |format|\n format.html { redirect_to article_comments_url, notice: 'Comment was successfully destroyed.' }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to_commentable(@comment, false) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end",
"def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end",
"def destroy\n @comment = @network.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n flash[:notice] = 'Comment destroyed.'\n format.html { redirect_to([:admin, @network,:comments]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end",
"def destroy\n @crawler_article = CrawlerArticle.find(params[:id])\n @crawler_article.destroy\n\n respond_to do |format|\n format.html { redirect_to(crawler_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(comments_url) }\n wants.xml { head :ok }\n end\n end",
"def destroy\n @subcomment = Subcomment.find(params[:id])\n @subcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to(subcomments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blog_post_comments_url(@comment.post.blog, @comment.post)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @topic_comment = TopicComment.find(params[:id])\n @topic_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(topic_comments_url) }\n format.xml { head :ok }\n end\n end",
"def delete_article(article_id)\n return get_db().execute(\"DELETE FROM article WHERE article_id = ?\", article_id) \n end",
"def destroy\n @article_comment.destroy\n respond_to do |format|\n format.html { redirect_to article_comments_url, notice: 'Article comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article_comment.destroy\n respond_to do |format|\n format.html { redirect_to article_comments_url, notice: 'Article comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @comment = @post.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html {redirect_to comments_and_forum_path }\n format.xml { head :ok }\n end\n end",
"def delete_comment\n @comment=Comment.find(params[:comment_id])\n @comment.destroy\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @article = Article.find_by_sysname(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @comment = Comment.find(params[:id])\n bid = @comment.blog_id\n\n @comment.deleted_parent = true\n @comment.save\n @comment = Comment.find(params[:id])\n @comment.content = '<-deleted->'\n @comment.save\n c1 = @comment\n while !c1.nil? and c1.leaf? do\n cp = c1.parent if !c1.parent.nil?\n cp = cp.nil? ? nil : cp.deleted_parent ? cp : nil\n c1.destroy\n c1 = (cp.nil?)? nil : Comment.find_by_id(cp.id)\n end\n #end while @com_par.deleted_parent == false and @com_par.leaf?\n\n respond_to do |format|\n format.html { redirect_to(Blog.find_by_id(bid)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n end",
"def destroy\n @article ||= Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n blog = @comment.blog\n @comment.destroy\n flash[:notice] = \"Comment was successfully deleted.\"\n\n respond_to do |format|\n format.html { redirect_to(blog, :method => :get) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n\t\tpost = @comment.post\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to pretty_post_url(post) + '#comments' }\n wants.xml { head :ok }\n end\n end",
"def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end",
"def destroy\n @comment = Comment.find(params[:id])\n \n \n if @comment.has_children?\n @comment.children.each do |child|\n child.destroy\n end\n end\n @comment.destroy\n\n respond_with do |format|\n flash.now[:notice] = 'Comment was successfully deleted.'\n end\n end",
"def test05_post_open_blog_DeleteArticleOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_post_open_article)\n\t\t\n\t\tsleep 2\n\t\tcommentPopSubmit \"Blog Article Comment for delete #{random}\"\n\t\tsleep 2\n\t\tcommentDelete\n\tend",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"posts\", :action => \"show\", :id => @comment.post_id, :notice => 'Comment deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @articlecomment.destroy\n respond_to do |format|\n format.html do\n redirect_to articlecomments_url,\n notice: 'Comment was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.destroy(params[:id])\n end",
"def destroy\n @comment = Comment.destroy(params[:id])\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n flash[:notice] = \"Comment destroyed\"\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_article = NewsArticle.find(params[:id])\n @news_article.destroy\n \n respond_to do |format|\n format.html { redirect_to(news_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_comments_path(@comment.site_id)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n end",
"def destroy_comment\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n flash[:notice] = 'Comment was successfully deleted.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doi.updates.each do |update|\n update.destroy\n end\n @doi.comments.each do |comment|\n comment.destroy\n end\n @doi.destroy\n respond_to do |format|\n format.html { redirect_to dois_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end",
"def deleteComments(delete_ids, cookies)\n delete_ids.each do |delete_id|\n hmac = getHMACFromDeleteConfirmationPage(delete_id, cookies)\n payloadString = \"id=\" + delete_id + \"&hmac=\" + hmac + \"&d=Yes&goto=\"\n response = RestClient::Request.new({\n method: :post,\n url: 'https://news.ycombinator.com/xdelete',\n cookies: cookies,\n payload: payloadString,\n }).execute do |response, request, result|\n case response.code\n when 401..500\n raise \"UNABLE TO DELETE COMMENTS\"\n else\n puts \"Deleting comment: \" + delete_id\n end\n end\n end\nend",
"def test03_post_open_news_CancelDeleteArticleOneComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_article)\n\t\tsleep 2\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 destroy\r\n @comment = Comment.find(params[:id])\r\n @comment.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(@comment.wall) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @fbcomment.destroy\n\n head :no_content\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_url(@post), :notice => \"Comment was removed\") }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n end",
"def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Comment.transaction do\n post = @object.post\n id = @object.id\n @object.destroy\n create_change_log_entry(id)\n respond_to do |format|\n format.html { redirect_to post }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @comment = @task.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(sprint_task_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to @article, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if super_user?\n @comment = Comment.find(params[:id])\n @comment.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment2 = Comment2.find(params[:id])\n @comment2.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment2s_url) }\n format.xml { head :ok }\n end\n end",
"def test03_post_closed_news_CancelDeleteArticleOneComment\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\tcommentCancelDelete\n\t\t \n\t\tassert $comment_delete_link.exists?\n\tend",
"def delete_comment\n comment = Comment.find_by_id(params[:id])\n if !comment.nil?\n comment.destroy\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.destroy\n ArticleRankingWorker.perform_async(params[:article_id])\n end\n\n head :no_content\n end",
"def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end"
] | [
"0.72589505",
"0.7096152",
"0.7067763",
"0.703446",
"0.6966151",
"0.68770635",
"0.6868609",
"0.68683994",
"0.6865256",
"0.68386793",
"0.68386793",
"0.6834373",
"0.6748496",
"0.67301726",
"0.6726204",
"0.67233056",
"0.67233056",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.67141426",
"0.6711294",
"0.6709625",
"0.67022717",
"0.66900384",
"0.66892487",
"0.6675635",
"0.6656226",
"0.6643689",
"0.661511",
"0.6612549",
"0.65818626",
"0.6580824",
"0.65802246",
"0.6557316",
"0.6553406",
"0.6547224",
"0.65063494",
"0.64965785",
"0.6491656",
"0.6482653",
"0.6482653",
"0.64773405",
"0.6476187",
"0.64593357",
"0.64463997",
"0.6445446",
"0.6445446",
"0.6445446",
"0.6445446",
"0.6445446",
"0.6440536",
"0.64311373",
"0.6420629",
"0.641115",
"0.64058393",
"0.63958377",
"0.6392163",
"0.6388778",
"0.6387303",
"0.6387303",
"0.63856953",
"0.63700676",
"0.63652575",
"0.6359997",
"0.6359042",
"0.63572866",
"0.63572866",
"0.63502496",
"0.6349666",
"0.6346291",
"0.63363564",
"0.6331122",
"0.63291246",
"0.63274914",
"0.63269246",
"0.6321833",
"0.6319471",
"0.631045",
"0.6302196",
"0.6298233",
"0.62974083",
"0.62861925",
"0.6283427",
"0.6272238",
"0.62693185",
"0.6265744",
"0.62629753",
"0.62489474",
"0.62480843",
"0.62474996"
] | 0.73909175 | 0 |
GET /photos GET /photos.json | def index
@photos = Photo.where(ip: request.remote_ip).all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end",
"def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end",
"def index()\n @photos = all_photos()\n end",
"def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end",
"def photos\n response = photo_search\n photos_response = response['photos']\n @photos = photos_response['photo'].each{|p| p.extend Flickr::PhotoHelper }\n @per_page = photos_response['perpage']\n @total = photos_response['total']\n @pages = photos_response['pages']\n @page = photos_response['page']\n end",
"def photo(photo, options = {})\n get(\"photos/#{photo}\", options).pop\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @model = Model.find(params[:id])\n @photos = @model.photos.paginate(:page => params[:page], :per_page => 10)\n @photo = Photo.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end",
"def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end",
"def index\n render json: Picture.all\n end",
"def photos(page = 1, per_page = 10)\n params = {\n page: page,\n per_page: per_page\n }\n\n list = JSON.parse(connection.get(\"/collections/#{id}/photos\", params).body)\n list.map { |photo| Unsplash::Photo.new photo }\n end",
"def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def photos(id, group = 'checkin', options = {})\n get(\"venues/#{id}/photos\", {:group => group }.merge(options)).photos\n end",
"def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end",
"def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def show\n\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def index\n @photos = @room.photos\n end",
"def show\n @look_book = LookBook.find(params[:id])\n\n @photos = @look_book.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @look_book }\n end\n end",
"def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def photos( options = {} )\n Photo.api_query( 'photosets.getPhotos', @client, options.merge(:photoset_id => id) )\n end",
"def index\n if params[:all] == 'true'\n @photos = Photo.all\n else\n @photos = Photo.paginate(:page => params[:page], :per_page => 50)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def photos\n return all_photos if @json[\"photos\"].blank?\n @json[\"photos\"][\"groups\"].select { |g| g[\"type\"] == \"venue\" }.first[\"items\"].map do |item|\n Foursquare::Photo.new(@foursquare, item)\n end\n end",
"def photos\n return all_photos if @json[\"photos\"].blank?\n @json[\"photos\"][\"groups\"].select { |g| g[\"type\"] == \"venue\" }.first[\"items\"].map do |item|\n Foursquare::Photo.new(@foursquare, item)\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n @comments = @photo.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def photos(criteria = {})\n original_photos = service.photos(criteria)\n original_photos.map { |original_photo| Picture.from_flickr(original_photo) }\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\r\n @photo = Photo.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end",
"def index\n\t@photos = Photo.all\n\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end",
"def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end",
"def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def photos\n @photos ||= begin\n (doc/'photos'/'photo').collect do |photo|\n MiniFlickr::Photo.new( photo.attributes['id'], flickr_api_data[:api_key] )\n end\n end\n end",
"def photos( params={} )\n photos = get_connections(\"photos\", params)\n return map_connections photos, :to => Facebook::Graph::Photo\n end",
"def show\n @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n # @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @rock_photos = RockPhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rock_photos\n end",
"def index\n @sample_photos = SamplePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @sample_photos\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end",
"def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def show\n render(\n status: :ok,\n json: @photo.as_json(\n only: [:photo_id, :country, :state, :city, :landmark, :latitude, :longitude, :perspective, :user_id, :photo_url],\n )\n )\n end",
"def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end",
"def venue_photos venue_id, options={}\n response = get(\"/venues/#{venue_id}/photos\", options)[\"response\"][\"photos\"]\n response[\"items\"].map!{|item| Foursquared::Response::Photo.new(self, item)}\n response\n end",
"def user_photos(id = 'self', options = {})\n get(\"/users/#{id}/photos\", options).photos\n end",
"def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def getJson\n if params[:id].present?\n render json: (TraditionalRoutePhoto.where(traditional_route_id: params[:id]))\n else\n render json: (TraditionalRoutePhoto.all)\n end\n end",
"def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end",
"def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end",
"def index\n @photos = @contest.photos.for_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def index\n @photos = @allbum.photos\n end",
"def get_image_from_photo_info(photos)\n photos.map do |photo|\n \"https://live.staticflickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}.jpg\"\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end"
] | [
"0.8192671",
"0.8084962",
"0.7820687",
"0.7662806",
"0.76157993",
"0.7597941",
"0.7566764",
"0.75608486",
"0.7540451",
"0.75032324",
"0.7496815",
"0.7360214",
"0.7275886",
"0.7223893",
"0.72033954",
"0.713234",
"0.7127612",
"0.7124163",
"0.7120244",
"0.7060392",
"0.7055266",
"0.7051116",
"0.7031017",
"0.7021036",
"0.701806",
"0.70086336",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.69950444",
"0.6992289",
"0.6988422",
"0.6986566",
"0.6974588",
"0.69573516",
"0.6945844",
"0.6943156",
"0.6938484",
"0.69256556",
"0.69237626",
"0.6922093",
"0.6916646",
"0.6914051",
"0.6911041",
"0.69091153",
"0.6886856",
"0.6882846",
"0.6882846",
"0.6860959",
"0.6855018",
"0.6834397",
"0.68230236",
"0.6822413",
"0.681321",
"0.6811154",
"0.6802519",
"0.6802461",
"0.6797551",
"0.6796466",
"0.67847115",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.6784411",
"0.67794764",
"0.6778444",
"0.6774658",
"0.6769481",
"0.67688924",
"0.6761604",
"0.6759226",
"0.6759042",
"0.6741299",
"0.6741043",
"0.673282",
"0.67323124",
"0.67188376",
"0.67182714",
"0.67174745",
"0.6716973",
"0.6716629",
"0.6714281",
"0.6710932",
"0.6697637",
"0.6671498",
"0.6662286",
"0.6662116"
] | 0.0 | -1 |
GET /photos/1 GET /photos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end",
"def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def photo(photo, options = {})\n get(\"photos/#{photo}\", options).pop\n end",
"def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end",
"def show\n\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def show\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo1 }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end",
"def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end",
"def show\r\n @photo = Photo.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end",
"def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end",
"def index()\n @photos = all_photos()\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @model = Model.find(params[:id])\n @photos = @model.photos.paginate(:page => params[:page], :per_page => 10)\n @photo = Photo.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def index\n render json: Picture.all\n end",
"def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\n end",
"def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end",
"def show\n @look_book = LookBook.find(params[:id])\n\n @photos = @look_book.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @look_book }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n @comments = @photo.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n # @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end",
"def index\n @photos = @allbum.photos\n end",
"def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end",
"def index\n @photos = @room.photos\n end",
"def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end",
"def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n\t@photos = Photo.all\n\tend",
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def index\n @photos = Photo.all\n end",
"def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end",
"def show\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_photo }\n end\n end",
"def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @user_photo = UserPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_photo }\n end\n end",
"def photos(page = 1, per_page = 10)\n params = {\n page: page,\n per_page: per_page\n }\n\n list = JSON.parse(connection.get(\"/collections/#{id}/photos\", params).body)\n list.map { |photo| Unsplash::Photo.new photo }\n end",
"def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end",
"def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end",
"def show\n render json: @picture\n end",
"def show\n render json: @sample_photo\n end",
"def index\n if params[:all] == 'true'\n @photos = Photo.all\n else\n @photos = Photo.paginate(:page => params[:page], :per_page => 50)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def show\n @photo_library = PhotoLibrary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo_library }\n end\n end",
"def index\n @photos = Photo.all\n end",
"def show\n render json: @picture, status: :ok\n end",
"def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def show\n @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def show1\r\n @photo = Photo.find(params[:id])\r\n @user = @photo.user\r\n data = {\r\n :photo=> @photo,\r\n :user => @user\r\n }\r\n render json: data\r\n \r\n end",
"def get_image_from_photo_info(photos)\n photos.map do |photo|\n \"https://live.staticflickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}.jpg\"\n end\n end",
"def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n render(\n status: :ok,\n json: @photo.as_json(\n only: [:photo_id, :country, :state, :city, :landmark, :latitude, :longitude, :perspective, :user_id, :photo_url],\n )\n )\n end"
] | [
"0.84863234",
"0.7777037",
"0.7566973",
"0.7507857",
"0.7482775",
"0.742858",
"0.73779064",
"0.73423064",
"0.73400605",
"0.73322564",
"0.73005956",
"0.7280408",
"0.725952",
"0.7259299",
"0.7214884",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.719664",
"0.716885",
"0.7144676",
"0.7141739",
"0.7124926",
"0.7102725",
"0.7090629",
"0.7062727",
"0.70574594",
"0.70421803",
"0.7023767",
"0.70209706",
"0.69843286",
"0.69703317",
"0.6908883",
"0.6908387",
"0.6908126",
"0.69060826",
"0.68886083",
"0.6884222",
"0.68801636",
"0.68718433",
"0.687059",
"0.68662274",
"0.68611664",
"0.6839732",
"0.6831596",
"0.6818606",
"0.6808661",
"0.6808471",
"0.6794642",
"0.6792588",
"0.67864853",
"0.67824656",
"0.6775689",
"0.67655355",
"0.6747661",
"0.6741997",
"0.67419416",
"0.6739223",
"0.67379624",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6733143",
"0.6725657",
"0.6722098",
"0.67190707",
"0.6717003",
"0.67159677",
"0.67140144",
"0.6707969",
"0.6706987",
"0.6703676",
"0.6689443",
"0.66894037",
"0.6688249",
"0.6688056",
"0.6687846",
"0.6684102",
"0.6680888",
"0.66704667",
"0.66568273",
"0.66512996",
"0.6624271",
"0.6615505",
"0.66136277",
"0.66136277",
"0.66052043"
] | 0.0 | -1 |
POST /photos POST /photos.json | def create
@photo = Photo.new(photo_params)
params[:pictures].each do |s, i|
#@photo[ip] = params[:ip]
#@photo[avatar] = s
@photo= Photo.new(ip: params[:photo][:ip],avatar: s)
@photo.save
end
respond_to do |format|
format.html { redirect_to photos_url, notice: 'Pictures was successfully added.' }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n if @photo.save\n render json: @photo, status: :created\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def create_photos\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user = @current_user\n if @photo.save\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n save_to_json \n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n\n params[:pet][:photos][:photo].each {|photo| @pet.photos.build(photo: photo)} if params[:pet][:photos].present?\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_property_photos(photos)\n post_photos_for_property_id(photos.first.propertyID, photos)\n end",
"def create\n p params\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status=> :created, :location=> @photo }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json => @photo.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.vote =0\n respond_to do |format|\n if @photo.save\n current_user.photos.push @photo\n format.html { redirect_to photos_path, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = Photo.new\n\n render json: @photo\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n p_attr = params[:photo]\n p_attr.permit!\n @photo = Photo.new(p_attr)\n\n respond_to do |format|\n if @photo.save\n #save new link between photo and post\n if (params[:post_id].length)\n\n countInPost = PostPhoto.where(post_id: params[:post_id]).count\n @photo.sort = (countInPost+1)*100\n @photo.save\n\n #check post\n post = Post.find(params[:post_id])\n if (!post.present?)\n raise 'Post is not found'\n end\n\n if (post.main_photo.to_i < 1)\n post.main_photo = @photo.id\n post.save\n end\n\n post_photo = PostPhoto.find_or_initialize_by(post_id: params[:post_id], photo_id: @photo.id)\n post_photo.save\n\n end\n\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Uploaded successfully.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n photo.attributes = photo_params\n\n respond_to do |format|\n if photo.save\n format.html { redirect_to admin_photos_path, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: photo }\n else\n format.html { render :new }\n format.json { render json: photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n format.html { redirect_to @car, notice: 'Car was successfully added.' }\n format.json { render :show, status: :created, location: @car }\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gadget = Gadget.find(params[:photo][:gadget_id])\n @photos = @gadget.photos.new(params[:photo])\n respond_to do |format|\n if @photos.save\n format.html { redirect_to @gadget, notice: 'Photo was successfully uploaded.' }\n format.json { render json: @gadget, status: :created, location: @gadget }\n else\n format.html { redirect_to gadget_path(params[:gadget_id]) }\n format.json { render json: @gadget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo added!' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_path(@photo.album), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { redirect_to album_path(@photo.album), notice: @photo.errors.full_messages.join(', ') }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n @photo.person_id = session[:person_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @photo = Photo.new(params[:photo])\r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def create\n @photo = @allbum.photos.new(params[:photo])\n respond_to do |format|\n if @photo.save\n format.html { redirect_to new_allbum_photo_path, notice:\"Saved,You can add more images...\" }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.create(params[:photo])\n end",
"def create\n parameters = photo_params\n parameters[:photo_id] = next_photo_id\n # parameters[:photo_id] = parameters[:photo_id].to_i\n parameters[:user_id] = parameters[:user_id].to_i\n parameters[:latitude] = parameters[:latitude].to_f\n parameters[:longitude] = parameters[:longitude].to_f\n\n @photo = Photo.new(parameters)\n\n # respond_to do |format|\n if @photo.save\n # format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n # format.json { render :show, status: :created, location: @photo }\n render json: @photo\n # else\n # format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n # end\n end",
"def add_to_campaign\n photo = current_user.photos.find params[:id]\n campaign = Campaign.find params[:campaign_id]\n\n @photo_tags = photo.add_to_campaign campaign\n\n respond_to do |format|\n format.json do\n if @photo_tags\n render json: @photo_tags\n else\n render :status => 422, text: photo.errors.full_messages.to_sentence\n end\n end\n end\n \n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.creat_success\") }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:photo_files].blank?\n render json: [ 'ファイルを選択してください' ], status: :unprocessable_entity\n return\n end\n\n album = Album.find(params['album_id'])\n # TODO: Transactionかけるとかエラーハンドリングしたい\n params[:photo_files].each do |file|\n photo = Photo.new(image: file, title: '[無題]', album_id: album.id, user_id: current_user.id, exif_at: Photo::set_exif_at(file.path))\n photo.save\n end\n\n # memo Ajaxでのpostはsaveのエラーが画面には表示されないので、自分で出力してあげる\n # あと、pメソッドでログに出力されないため、loggerを使用する\n # logger.debug @photo.errors.full_messages.inspect\n # logger.debug @photo.errors.full_messages.to_sentence\n\n UpdateHistory.create_or_update(album, UpdateHistory::ALBUMPHOTO_CREATE, current_user.id)\n render json: {}, status: :created\n end",
"def create\n @photo = current_user.photos.new\n @greeting = [\"got something beautiful you'd like to share with the world?\", \"feeling good today? Spread the happiness one photo at a time!\", \"show the world some lovin'.\" ]\n\n\n # @photo.photo_images = photo_params[:photo_images].map do |img|\n # byebug\n # PhotoImage.new(image: img)\n # end\n # @photo = Photo.new(photo_params)\n # @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n # params[:photo]['images'].each do |img|\n @photo_image = PhotoImage.create(image: params[:photo][:photo_images], photo_id: @photo.id)\n # @photo_image = @photo.photo_images.create()\n \n format.html { redirect_to edit_photo_path(@photo), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n set_tags\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = @camera.photos.build photo_params\n @photo.image = {data: params[:photo][:image]}\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render status: :accepted }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end",
"def create\n @photo = current_user.photos.build(photo_params)\n @photo.image_url = upload_photo_and_return_name\n respond_to do |format|\n if @photo.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@post = Post.new\n\t\t# respond_to do |format|\n\t\t# \tformat.html\n\t\t# \tformat.json {render json: @post}\n\t\t# end\n\n\t\t3.times do\n\t\t\tphoto = @post.photos.build\n\t\tend\n\tend",
"def create\n @photo = Photo.new(photo_params)\n @photo.pet = @pet\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.build(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_image].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@photo.to_jq_image].to_json\n }\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end\n end",
"def create\n #@rental = Rental.new(params[:rental])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n @rental = Rental.new(rental_data)\n\n respond_to do |format|\n if @rental.save\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully created.' }\n format.json { render json: @rental, status: :created, location: @rental }\n else\n @object_new = Photo.new\n format.html { render action: \"new\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_new_collection_if_needed\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n authorize! :create, @photo\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_photo = SamplePhoto.new(sample_photo_params)\n\n\n if @sample_photo.save\n render json: @sample_photo, status: :created\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n paths = create_with_thumbnail(params['content'])\n @photo = Photo.create(:name => params['photo']['name'], :mimetype => params['content'].content_type, :path => paths[0], :thumbnail => paths[1])\n @photo.save()\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to(@photo, :notice => 'Photo was successfully created.') }\n format.xml { render :xml => @photo, :status => :created, :location => @photo }\n format.json { render :json => {'p_url' => \"#{PUZZUULE_URL_BASE}id=#{@photo.id}\"} }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Photo.new(photo_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spot = Spot.new(spot_params)\n\n respond_to do |format|\n if @spot.save\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @spot = Spot.new(spot_params)\n\n respond_to do |format|\n if @spot.save\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def new\n @photo = current_user.photos.build(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def create\r\n @photo = Photo.new(params[:photo]) \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Fotka úspěšně vytvořena.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @place = Place.new(place_params)\n\n if @place.save\n if params[:images]\n params[:images].each do |image|\n @place.photos.create(image: image)\n end\n end\n end\n\n respond_to do |format|\n if @place.save\n format.html do\n redirect_to new_place_photo_path(@place),\n notice: 'Place was successfully created.'\n end\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def create\n @photogallery = Photogallery.new(photogallery_params)\n\n respond_to do |format|\n if @photogallery.save\n format.html { redirect_to @photogallery, notice: 'Photogallery was successfully created.' }\n format.json { render :show, status: :created, location: @photogallery }\n else\n format.html { render :new }\n format.json { render json: @photogallery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user_id = session[:user_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to '/home', notice: 'You have uploaded a new photo'}\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Attempt creation\n @photo = Photo.new(photo_params)\n\n # Respond\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n # In case of errors make sure they go into flash\n if @photo.errors.full_messages.length.positive?\n flash[:error] = @photo.errors.full_messages.join(\", \")\n end\n # Redirect\n format.html { redirect_to new_photo_path(tour_id: @photo.tour.id) }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @photo = Photo.new(params[:photo])\n\t\t@photo.user_id = @logged_in_user.id\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was uploaded successfully.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.find(params[:location_photo][:location_id])\n @location_photo = @location.photos.create(location_photo_params)\n\n respond_to do |format|\n if @location_photo.save\n format.html {\n render json: [@location_photo.to_jq_upload].to_json,\n content_type: 'text/html',\n layout: false\n }\n format.json { render json: {files: [@location_photo.to_jq_upload]}, status: :created, location: @location_photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_photo = RecipePhoto.new(recipe_photo_params)\n\n respond_to do |format|\n if @recipe_photo.save\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_photo }\n else\n format.html { render :new }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # photo = photo.create! params.require(:photo)\n @photo = Photo.new(photo_params)\n @photo.album_id = params[:album_id]\n @photo.user_id = current_user.id\n # @photo.pictures.attach(params[:photo][:picture])\n respond_to do |format|\n if @photo.save(validate: false)\n format.html { redirect_to album_photos_path , notice: \"Photo was successfully created.\" }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_photo\n if !params[:photo]\n @show_form = true;\n else\n @show_form = false;\n # set the particulars\n flickr_id = params[:photo][:flickrid];\n flickr_url = 'http://api.flickr.com/services/rest/'\n flickr_method = 'flickr.photos.getInfo'\n secret = 'xxxxx' # :NOTE: replace with your API secret\n api_key = 'xxxxx' # :NOTE: replace with your API key\n auth_token = 'xxxxx' # :NOTE: replace with your auth token\n \n # get information about this photo from flickr\n # generate the api signature\n sig_raw = secret + 'api_key' + api_key + 'auth_token' + auth_token + 'method' + flickr_method + 'photo_id' + flickr_id\n api_sig = MD5.hexdigest(sig_raw)\n page_url = flickr_url + '?method=' + flickr_method +\n '&api_key=' + api_key + '&auth_token=' + auth_token +\n '&api_sig=' + api_sig + '&photo_id=' + flickr_id\n # get the data and parse it\n page_xml = Net::HTTP.get_response(URI.parse(page_url)).body\n full_flickr_page = XmlSimple.xml_in(page_xml)\n # if we didn't get an error from flickr...\n if full_flickr_page['stat'] == 'ok'\n flickr_page = full_flickr_page['photo'][0]\n # create the new photo object and fill it up\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.farm = flickr_page['farm']\n photo.secret = flickr_page['secret']\n photo.server = flickr_page['server']\n photo.dateadded = Time.at(flickr_page['dateuploaded'].to_i)\n photo.lastupdate = Time.at(flickr_page['dates'][0]['lastupdate'].to_i)\n photo.seen_at = Time.now\n photo.flickr_status = \"not in pool\"\n photo.mapped = (!flickr_page['location']) ? 'false' : 'true'\n \n # now try and get a record for the owner of this photo\n owner = Person.find_by_flickrid(flickr_page['owner'][0]['nsid'])\n # if the owner doesn't exist, create it\n if !owner\n owner = Person.new\n end\n # set the details\n owner.flickrid = flickr_page['owner'][0]['nsid']\n owner.username = flickr_page['owner'][0]['username']\n owner.flickr_status = \"active\"\n \n # save the owner\n owner.save\n # attach the owner to the photo\n photo.person = owner\n \n # we got an error from flickr\n else\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.dateadded = Time.at(0)\n photo.lastupdate = Time.at(0)\n photo.seen_at = Time.now\n photo.flickr_status = \"missing\"\n end\n\n # save the photo\n photo.save\n \n # redirect to the photo's show page\n redirect_to :action => 'show', :id => photo\n end\n end",
"def create\n params[:photo][:user_id] = session[:current_user_id]\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n @photo.file = params[:file]\n\n respond_to do |format|\n if @photo.save\n format.html { render :text => \"FILEID:\" + @photo.file.album.url }\n format.json { render :nothing => true }\n else\n format.html { render :text => \"ERRORS:\" + @photo.errors.full_messages.join(\" \"), :status => 500 }\n format.json { render json => @photo.errors, :status => 500 }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n respond_to do |format|\n if @photo.save\n @current_user.upload_photo(@photo)\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id), notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment_photo = CommentPhoto.new(comment_photo_params)\n\n respond_to do |format|\n if @comment_photo.save\n @id = @comment_photo.photo.id.to_s\n @ruta = \"/photos/\"+@id\n format.html { redirect_to @ruta, notice: 'Commentphoto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comment_photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n \n create_photo_args = {}\n create_photo_args[:uploaded_file] = params[:photo_url]\n \n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n thumbnail_width_sym = \"thumbnail_width_#{thumbnail_size}\"\n if params.key?(thumbnail_width_sym)\n create_photo_args[thumbnail_width_sym] = params[thumbnail_width_sym]\n end\n \n thumbnail_height_sym = \"thumbnail_height_#{thumbnail_size}\"\n if params.key?(thumbnail_height_sym)\n create_photo_args[thumbnail_height_sym] = params[thumbnail_height_sym]\n end\n end\n @photo.create_photo(create_photo_args)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to new_photo_path, notice: 'Фото было успешно создано! Добавим еще?' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = Photo.new \n \n #@photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def create\n @album = Album.new(album_params)\n\n not_blank_photos = @album.photos.select do |photo|\n ! photo.title.blank?\n end\n @album.photos = not_blank_photos\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def create\n @eventphoto = EventPhoto.new(eventphoto_params)\n event = Event.find_by_id(params[:event_id])\n respond_to do |format|\n if @eventphoto.save\n event.event_photos << @eventphoto\n format.html { redirect_to event_path(event), notice: 'Event Photo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @eventphoto }\n else\n format.html { render action: 'new' }\n format.json { render json: @eventphoto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end",
"def make_primary\n photo = Photo.find(params[:photo_id])\n @venue.set_primary_photo(photo.id)\n render json: { images: gallery_images(@venue) }\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.slug = (photo_params[:start].to_s.mb_chars.downcase+photo_params[:text].to_s.mb_chars.downcase).gsub(/[^a-z0-9äöåÄÖÅ\\s]/i, '')\n @photo.views = 0\n @photo.secret_id = Time.now.to_i.to_s + '_' + SecureRandom.hex.to_s\n @photo.url = '/images/'+@photo.secret_id.to_s+'.jpg'\n\n @photo.addtext(@photo.url.to_s)\n @photo.add_to_view_count(5)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.73626924",
"0.71853614",
"0.6947308",
"0.69228035",
"0.68975127",
"0.68508923",
"0.6683941",
"0.66752636",
"0.6614366",
"0.660908",
"0.660323",
"0.6562045",
"0.6548483",
"0.6548483",
"0.6548483",
"0.6548483",
"0.6548483",
"0.6543545",
"0.6476572",
"0.6464061",
"0.6464061",
"0.6464061",
"0.6464061",
"0.6464061",
"0.64629084",
"0.64549303",
"0.64463353",
"0.64404285",
"0.6437479",
"0.64319646",
"0.6429726",
"0.64235103",
"0.6415187",
"0.6404227",
"0.63918006",
"0.63633376",
"0.6361484",
"0.6358215",
"0.63545465",
"0.6346826",
"0.63361657",
"0.63135505",
"0.631339",
"0.6306881",
"0.62951094",
"0.6290381",
"0.6284904",
"0.6273305",
"0.62682885",
"0.6260618",
"0.6257389",
"0.6257127",
"0.6251925",
"0.62374526",
"0.6236884",
"0.6234433",
"0.6234216",
"0.6231155",
"0.622423",
"0.622423",
"0.621408",
"0.62004054",
"0.619674",
"0.61892205",
"0.6187642",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186621",
"0.6186111",
"0.6180769",
"0.61786294",
"0.61756593",
"0.6175562",
"0.6173774",
"0.6166473",
"0.6165405",
"0.61591417",
"0.61585766",
"0.6155725",
"0.6153365",
"0.6151176",
"0.61507374",
"0.6145284",
"0.6135247",
"0.612397",
"0.61183476",
"0.61183476",
"0.61180675",
"0.61096627",
"0.6108552",
"0.60891724",
"0.6088819"
] | 0.0 | -1 |
PATCH/PUT /photos/1 PATCH/PUT /photos/1.json | def update
respond_to do |format|
if @photo.update(photo_params)
format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }
format.json { render :show, status: :ok, location: @photo }
else
format.html { render :edit }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json => @photo.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.photoable, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"forms\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.update_success\") }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n if @photo1.update_attributes(params[:photo1])\n format.html { redirect_to @photo1, notice: 'Photo1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @photo = @allbum.photos.find(params[:id])\n#\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n authorize! :update, @photo\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @photo.update(photo_params)\n return render json: {info: 'Photo successfully updated'}\n else\n return render json: {exception: 'PhotoException', message: @photo.errors.full_messages}, status: 400\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_tags\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to gallery_photos_url(@gallery) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n # TODO: check if photo belongs to current user!\n if @photo.update_attributes(photo_params)\n render :show\n else\n render json: @photo.errors.full_messages, status:422\n end\n end",
"def update\n photo_params = params[:photo].clone\n if photo_params[:retakeable]\n photo_params[:retakeable] = %(yes true 1).include?(photo_params[:retakeable].to_s.downcase)\n photo_params[:retakeable] = nil if params[:photo][:retakeable] == 'unknown'\n end\n if photo_params[:accessibility]\n photo_params[:accessibility] = nil if params[:photo][:accessibility] == 'unknown'\n end\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @photo.update(photo_params)\r\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @photo }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n binding.pry\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find params[:person_id]\n @photo = Photo.find params[:id]\n \n respond_to do |format|\n # make sure the preferred bit is cleared\n @person.photos.each do |p|\n p.preferred = false\n p.save!\n end\n \n # set preferred photo\n @photo.preferred = true\n \n if @photo.save\n flash[:notice] = 'Default photo was successfully saved.'\n format.html { redirect_to(person_photos_path(@person)) }\n format.xml { head :created,\n :location => person_photo_path(:person_id => @person_id, :id => @photo.id)}\n else\n format.html { \n @section = 'photos'\n render :action => 'index' }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n rescue ActiveRecord::RecordInvalid\n render :action => 'index'\n end",
"def update\n respond_to do |format|\n if photo.update(photo_params)\n format.html { redirect_to admin_photo_path(photo), notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: photo }\n else\n format.html { render :edit }\n format.json { render json: photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n if @photo.update(photos_params)\n if @photo.save\n redirect_to photos_path, notice: \"The photo has been updated\"\n else\n render \"edit\"\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html {redirect_to photos_url}\n \n #if URI(request.referrer).path == \"/photos/#{@photo.id}/edit\" \n # format.html { redirect_to photos_url, notice: 'Photo was successfully updated.' }\n #else\n # format.html { redirect_to request.referrer, notice: 'Photo was successfully updated.' }\n #end\n \n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(@photo, :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(@photo, :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = current_user.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(contest_photos_path(@photo.contest), :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def update\n @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_photo(album_id, photo_id, file, filename)\n \n end",
"def update\n @photo = Photo.find( params[:id])\n if @photo.update_attributes(params[:photo])\n flash[:notice] = \"Photo updated!\"\n if params[:bucket_id]\n redirect_to bucket_album_photo_path( params[:bucket_id], params[:album_id], @photo )\n elsif params[:album_id]\n redirect_to album_photo_path( params[:album_id], @photo )\n else\n redirect_to @photo\n end\n else\n render :action => :edit\n end\n end",
"def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Fotka byla úspěšně upravena.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @property = Property.find(params[:id])\n unless params[:property][:photos_attributes].nil?\n params[:property][:photos_attributes].each_key { |key|\n if params[:property][:photos_attributes][key.to_sym][:remove_file] == \"1\"\n @photo = Photo.find(params[:property][:photos_attributes][key.to_sym][:id])\n @photo.remove_file!\n @photo.destroy\n params[:property][:photos_attributes].delete(key.to_sym)\n end\n }\n end\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to [:admin, @property], notice: 'Inmueble actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @photo = Photo.find(params[:id])\n @photo.accepted = !@photo.accepted \n respond_to do |format|\n if @photo.save\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to admin_photos_url , alert: @photo.errors.full_messages}\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.album, @photo], notice: '写真情報を変更しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n photo = Photo.find(params[:id])\n\n needRecreate = false\n\n if params[:crop_x]\n if photo.crop_x != params[:crop_x] or photo.crop_y != params[:crop_y] or photo.crop_h != params[:crop_h] or photo.crop_w != params[:crop_w]\n needRecreate = true\n end\n end\n\n created = photo.update_attributes({ :caption => params[:caption], :crop_h => params[:crop_h], :crop_y => params[:crop_y], :crop_x => params[:crop_x], :crop_w => params[:crop_w], :position => params[:position], :useAsArticlePhoto => params[:useAsArticlePhoto], :useAsFrontpagePhoto => params[:useAsFrontpagePhoto], :widescreenCaption => params[:widescreenCaption]})\n\n Rails.logger.debug \"Update photo #{created}\"\n p \"Update photo #{created}\"\n\n photo.photo.recreate_versions! if needRecreate\n\n respond_with photo\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.room], notice_galery: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to trip_folder_photos_path(:trip_id => @trip.name,:folder_id => @folder.name ), notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: trip_folder_photos_path(:trip_id => @trip.name,:folder_id => @folder.name ) }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to photo_url(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_photo.update(recipe_photo_params)\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_photo }\n else\n format.html { render :edit }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to user_customer_album_photos_url(@user, @customer, @album), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(upload_params)\n format.html { redirect_to @photo, notice: 'Upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.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!(**args)\n @photo = args[:photo] if args.key?(:photo)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n respond_to do |format|\n if @photogallery.update(photogallery_params)\n format.html { redirect_to @photogallery, notice: 'Photogallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @photogallery }\n else\n format.html { render :edit }\n format.json { render json: @photogallery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n if @users_photo.update_attributes(params[:users_photo])\n format.html { redirect_to @users_photo, notice: 'Users photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @photo_ids = args[:photo_ids] if args.key?(:photo_ids)\n end",
"def update\n if @photo.user == current_user\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @photo = @surrounding.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to '/surroundings/1/', notice: 'Picture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @car.update(car_params)\n unless params[:photos].blank?\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n end\n format.html { redirect_to @car, notice: 'Car was successfully updated.' }\n format.json { render :show, status: :ok, location: @car }\n else\n format.html { render :edit }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if !user_is_owner?(@photo)\n format.html { redirect_to @photo.contest, alert: 'Vous ne pouvez pas modifier cette photo.' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n elsif @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.contest, notice: 'Votre photo a été mise à jour.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(photo_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end"
] | [
"0.7049965",
"0.6752749",
"0.6740446",
"0.67135185",
"0.671254",
"0.66867554",
"0.66847605",
"0.66847605",
"0.66847605",
"0.66847605",
"0.66843224",
"0.66707134",
"0.66707134",
"0.66707134",
"0.66707134",
"0.66707134",
"0.66707134",
"0.6667143",
"0.6663248",
"0.6657235",
"0.664729",
"0.659457",
"0.65934014",
"0.65759456",
"0.65382665",
"0.65300393",
"0.6520107",
"0.6510243",
"0.6476488",
"0.64690536",
"0.64232457",
"0.634897",
"0.6347826",
"0.6336337",
"0.6322429",
"0.63028836",
"0.6302882",
"0.6298161",
"0.627644",
"0.62705815",
"0.62644583",
"0.62586254",
"0.62436473",
"0.6239533",
"0.6238869",
"0.62385213",
"0.62385213",
"0.62309927",
"0.6218568",
"0.62066346",
"0.6206464",
"0.620645",
"0.6205731",
"0.62018436",
"0.61975276",
"0.61942697",
"0.61743826",
"0.6172363",
"0.6170155",
"0.6165911",
"0.61621493",
"0.6141919",
"0.6140789",
"0.6138989",
"0.61367005",
"0.6128227",
"0.61259174",
"0.61163276",
"0.61163276",
"0.6114447",
"0.6099198",
"0.60985833",
"0.6097628",
"0.60902554",
"0.60894555",
"0.60851395",
"0.6082647",
"0.60818297",
"0.60807776",
"0.6071858",
"0.60712093",
"0.60577816",
"0.6056164",
"0.6036034"
] | 0.6384656 | 45 |
DELETE /photos/1 DELETE /photos/1.json | def destroy
@photo.destroy
respond_to do |format|
format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.photo.destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def delete photo_id\n @flickr.photos.delete(photo_id: photo_id)\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to @photo.photoable }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end",
"def delete(photo)\n photo = photo.id if photo.class == Flickr::Photo\n res = @flickr.call_method('flickr.photos.delete',\n 'photo_id'=>photo)\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @photos.id\n if !@photos.nil? && @photos.destroy\n result = { message: 'Deleted successfully', status: true, id: id }\n else\n result = { message: 'Please try again later', status: false }\n end\n render json: result\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.xml { head :ok }\n end\n end",
"def delete\n photo_id = params[:photoId]\n photo = Photo.find(photo_id)\n\n if (photo.nil?)\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n elsif (photo.owner_user_id != session[:user_id])\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n else\n photo.destroy\n end\n\n # TODO(samstern): Figure out why this method works but the Android client\n # reports failure\n render json: 'Photo successfully deleted'\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo removed!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id) }\n format.json { render :json => true }\n end\n end",
"def destroy\n @uploadphoto.destroy\n respond_to do |format|\n format.html { redirect_to uploadphotos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @photo.nill?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n @photo.destroy\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_photo = Photo.find(params[:id])\n @admin_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n end\n end",
"def destroy\n photo.destroy\n respond_to do |format|\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n authorize! :destroy, @photo\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @photo.destroy\r\n respond_to do |format|\r\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home', notice: 'You have deleted the picture' }\n format.json { head :no_content }\n end\n end",
"def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album_id\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@users_photo = UsersPhoto.find(params[:id])\n #@users_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to users_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto = Foto.find(params[:id])\n @foto.destroy\n\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user_photo = UserPhoto.find(params[:id])\n @user_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @album2photo = Album2photo.find(params[:id])\n @album2photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album2photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_photo.destroy\n respond_to do |format|\n format.html { redirect_to user_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_photo.destroy\n respond_to do |format|\n format.html { redirect_to flat_photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n if photo_authorize(@photo)\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @user = User.find(params[:user_id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to @user, notice: 'The photo was successfully deleted.'}\n format.json { head :no_content }\n end\n end",
"def delete(photo_id)\r\n Net::Flickr.instance().request('flickr.photos.delete',\r\n 'photo_id' => photo_id)\r\n true\r\n end",
"def destroy\n @recipe_photo.destroy\n respond_to do |format|\n format.html { redirect_to recipe_photos_url, notice: 'Recipe photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_photo.destroy\n respond_to do |format|\n format.html { redirect_to post_photos_url, notice: 'Post photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo_detail.destroy\n respond_to do |format|\n format.html { redirect_to photo_details_url, notice: 'Photo detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n render root_path\n end",
"def destroy\n @plate_photo = PlatePhoto.find(params[:id])\n @plate_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_photos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7743858",
"0.7743858",
"0.7743858",
"0.7743858",
"0.7743858",
"0.7743858",
"0.77150726",
"0.77150726",
"0.77150726",
"0.77150726",
"0.77150726",
"0.77036476",
"0.7683938",
"0.7666516",
"0.7664305",
"0.7664305",
"0.7651935",
"0.7651935",
"0.76373297",
"0.75912905",
"0.7588815",
"0.7573956",
"0.7510149",
"0.75098765",
"0.7508465",
"0.74969757",
"0.7485202",
"0.7472551",
"0.7448762",
"0.7447212",
"0.7447212",
"0.7447212",
"0.7447212",
"0.74431735",
"0.7436718",
"0.74309784",
"0.74167436",
"0.74085724",
"0.7404596",
"0.7390455",
"0.7387256",
"0.7360629",
"0.7352633",
"0.7351095",
"0.7321412",
"0.7313925",
"0.7301978",
"0.7299056",
"0.7294209",
"0.7270533",
"0.72694343",
"0.725674",
"0.7251619",
"0.72354573",
"0.72329557",
"0.7228159",
"0.72263706",
"0.72237927",
"0.7219977",
"0.72138685",
"0.71869296",
"0.7184955",
"0.71813214",
"0.7164884",
"0.7161013",
"0.7149285",
"0.71444273",
"0.71434486",
"0.71340466",
"0.71264046",
"0.7125808",
"0.71251655",
"0.7119211",
"0.70945436",
"0.7080217",
"0.7073863",
"0.7060387",
"0.7060283",
"0.7060283",
"0.70598054",
"0.7055438",
"0.70531577",
"0.70447695"
] | 0.7369001 | 55 |
Use callbacks to share common setup or constraints between actions. | def set_photo
@photo = Photo.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 photo_params
params.require(:photo).permit(:ip, :avatar)
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 valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"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 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 active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] | 0.0 | -1 |
def define_index( name, unique = false ) | def install( connection )
unless present?(connection)
connection.execute(render_sql_create())
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(name, options = { :unique => false })\n collection.create_index(name, options[:unique])\n end",
"def has_unique_index(name, *fields)\n indexes[name] = fields\n end",
"def index(name, options = { :unique => false })\n collection.create_index(name, options)\n end",
"def definition(table_name)\n\n if unique?\n \" add_index :#{table_name}, #{index_columns}, :unique => true\"\n else\n \" add_index :#{table_name}, #{index_columns}\"\n end\n end",
"def require_index(name); end",
"def require_index(name); end",
"def add_index(table_name,column_name,options = {})\n index_name = options[:name] || index_name(table_name,:column => Array(column_name))\n \n if options[:spatial]\n execute \"CREATE SPATIAL INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(\", \")})\"\n else\n super\n end\n end",
"def index(name, type = :find)\n @defined_indexes ||= {}\n @defined_indexes[name.to_sym] = type\n end",
"def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!( opts.merge!(:name => field) )\n unless indexes.include?( field )\n indexes << field.to_sym \n indexes << field.to_s \n end \n self \n end",
"def add_index(table_name, column_name, options = {})\n column_names = Array(column_name)\n index_name = index_name(table_name, :column => column_names)\n\n if Hash === options # legacy support, since this param was a string\n index_type = options[:unique] ? \"UNIQUE\" : \"\"\n index_name = options[:name] || index_name\n index_method = options[:spatial] ? 'USING GIST' : \"\"\n else\n index_type = options\n end\n quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(\", \")\n execute \"CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} #{index_method} (#{quoted_column_names})\"\n end",
"def add_index(table_name, column_name, options = {})\n column_names = Array(column_name)\n index_name = index_name(table_name, :column => column_names)\n\n if Hash === options # legacy support, since this param was a string\n index_type = options[:unique] ? \"UNIQUE\" : \"\"\n index_name = options[:name] || index_name\n index_method = options[:spatial] ? 'USING GIST' : \"\"\n else\n index_type = options\n end\n quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(\", \")\n execute \"CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} #{index_method} (#{quoted_column_names})\"\n end",
"def add_index(table_name, column_name, options = {})\n index_name = options[:name] || index_name(table_name,:column => Array(column_name))\n if options[:spatial]\n execute \"CREATE INDEX #{index_name} ON #{table_name} USING GIST (#{Array(column_name).join(\", \")} GIST_GEOMETRY_OPS)\"\n else\n super\n end\n end",
"def create_unique_index(table_name, index_name, column)\n spec = IndexSpecification.for_unique_index(index_name, column.to_java_bytes)\n create_index(table_name, spec)\nend",
"def unique_index\n @unique_index\n end",
"def add_indexes\n if hereditary? && !index_options[{ _type: 1 }]\n index({ _type: 1 }, { unique: false, background: true })\n end\n true\n end",
"def create_index(word)\n create_index1(word)\n end",
"def add_composite_index(index_columns = [], unique = false)\n @composite_indexes ||= []\n @composite_indexes << [index_columns, unique] # add paired tuple with the index\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{index_name} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def indexes(table_name, name = nil) #:nodoc:\r\n sql = \"SELECT name, INDEX_OPTIONS & 1 AS [unique], index_expression FROM SYSTEM.INDEXES WHERE parent = '#{table_name}'\"\r\n select(sql, name).map do |row|\r\n index = IndexDefinition.new(table_name, row['name'])\r\n index.unique = row['unique'] == 1\r\n index.columns = row['index_expression']\r\n index\r\n end\r\n end",
"def add_index_field(*) super end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def create_index(table_name, index_spec)\n @iadmin ||= IndexedTableAdmin.new(@configuration)\n @iadmin.addIndex(table_name.to_java_bytes, index_spec)\nend",
"def create_index\n self[:create_index]\n end",
"def indexed_name(name = nil)\n @indexed_name = name.to_sym if name\n @indexed_name\n end",
"def construct_index\n end",
"def create_explicit_index( index_name, permits_duplicates, sort_by_proc = nil, sort_duplicates_by_proc = nil )\n \n ensure_index_does_not_exist( index_name, permits_duplicates )\n \n index_instance = ::Persistence::Object::Index::ExplicitIndex.new( index_name, \n instance_persistence_bucket, \n permits_duplicates,\n sort_duplicates_by_proc,\n & sort_by_proc )\n\n indexes[ index_name ] = explicit_indexes[ index_name ] = index_instance\n\n return index_instance\n \n end",
"def indexes(table_name, name = nil)\n select_rows(\n \"SELECT index_name, \"+\n \" is_unique \"+\n \"FROM information_schema.indexes \"+\n \"WHERE table_schema = CURRENT_SCHEMA \"+\n \" AND table_name = '#{quote_string(table_name.to_s)}' \"+\n \" AND index_type <> 'PRIMARY' \"+\n \"ORDER BY index_name\",\n name || SCHEMA_LOG_NAME\n ).map { |row|\n cols = select_rows(\n \"SELECT column_name \"+\n \"FROM information_schema.index_columns \"+\n \"WHERE index_table_schema = CURRENT_SCHEMA \"+\n \" AND index_table_name = '#{quote_string(table_name.to_s)}' \"+\n \" AND index_name = '#{quote_string(row[0])}' \"+\n \"ORDER BY ordinal_position\",\n name || SCHEMA_LOG_NAME\n ).map { |col_row|\n col_row[0]\n }\n IndexDefinition.new(table_name, row[0], row[1] == 'YES', cols, [], {})\n }\n end",
"def create_index o_class, name:, on: :automatic, type: :unique\n logger.progname = 'RestCreate#CreateIndex'\n begin\n c = classname o_class\n execute transaction: false do\n \t command = if on == :automatic\n \t\t \"CREATE INDEX #{c}.#{name} #{type.to_s.upcase}\"\n \t\telsif on.is_a? Array\n \t\t \"CREATE INDEX #{name} ON #{classname(o_class)}(#{on.join(', ')}) #{type.to_s.upcase}\"\n \t\telse\n \t\t nil\n \t\tend\n \t [{type: \"cmd\", language: 'sql', command: command}]\n end\n logger.info{\"Index on #{c} based on #{name} created.\"}\n rescue RestClient::InternalServerError => e\n response = JSON.parse(e.response)['errors'].pop\n \t error_message = response['content'].split(':').last\n logger.error{\"Index not created.\"}\n logger.error{\"Error-code #{response['code']} --> #{response['content'].split(':').last }\"}\n nil\n end\n end",
"def create_hypothetical_index(table, col_set)\n execute(\"SELECT * FROM hypopg_create_index('CREATE INDEX ON #{quote_ident(table)} (#{col_set.map {|c| quote_ident(c[:column])}.join(\", \")})')\").first[\"indexname\"]\n end",
"def uniq_index\n\t\t\t\tcreate_property :in, type: :link, linked_class: :V\n\t\t\t\tcreate_property :out, type: :link, linked_class: :V\n\t\t\t\tcreate_index \"#{ref_name}_idx\", on: [ :in, :out ]\n\t\t\tend",
"def index_name(table_name, options) #:nodoc:\n if Hash === options # legacy support\n if options[:column]\n column_names = Array.wrap(options[:column]).map {|c| expression_index_name(c)}\n \"index_#{table_name}_on_#{column_names * '_and_'}\"\n elsif options[:name]\n options[:name]\n else\n raise ArgumentError, \"You must specify the index name\"\n end\n else\n index_name(table_name, column: options)\n end\n end",
"def create_bucket_index( index_name, \n permits_duplicates, \n sort_by_proc = nil, \n sort_duplicates_by_proc = nil, \n & indexing_block )\n \n if index_instance = @indexes[ index_name ] and \n index_instance.permits_duplicates? != permits_duplicates\n \n raise 'Index ' << index_name.to_s + ' has already been declared, ' <<\n 'and new duplicates declaration does not match existing declaration.'\n \n end\n\n index_instance = ::Persistence::Port::Bucket::BucketIndex.new( index_name, \n self, \n permits_duplicates,\n sort_by_proc, \n sort_duplicates_by_proc,\n & indexing_block )\n \n @indexes[ index_name ] = index_instance\n \n return index_instance\n \n end",
"def create_index_with_duplicates( index_name, sort_by_proc = nil, sort_duplicates_by_proc = nil, & indexing_block )\n\n return create_bucket_index( index_name, true, sort_by_proc, sort_duplicates_by_proc, & indexing_block )\n \n end",
"def create_index(args)\n if args[:name]\n new_index = create_new_index(args)\n\n @conn.query({url_path: \"#{database}/_index\", opts: new_index, method: :post})\n else\n raise ArgumentError.new('name is required')\n end\n end",
"def create_i18n_indexes(table_name)\n i18n_indexes.each do |index|\n unless indexes(table_name).map(&:columns).flatten.include? index.to_s\n add_index table_name, index\n end\n end\n end",
"def create_index(field_or_spec)\n @db.create_index(@name, field_or_spec)\n end",
"def index(name)\n query\n @options[:index_name] = name.to_s\n self\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n raise Error, \"Index types are not supported for this database\" if index[:type]\n raise Error, \"Partial indexes are not supported for this database\" if index[:where] && !supports_partial_indexes?\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_schema_table(table_name)} #{literal(index[:columns])}#{\" WHERE #{filter_expr(index[:where])}\" if index[:where]}\"\n end",
"def create_search_index(name, schema = nil, n_val = nil)\n @data[:search_indexes][name] = {:name => name, :schema => schema || '_yz_default', :n_val => n_val || 3}\n true\n end",
"def ensure_index_does_not_exist( index_name, permits_duplicates )\n\n if index_instance = indexes[ index_name ] and \n index_instance.permits_duplicates? != permits_duplicates\n\n raise 'Index ' << index_name.to_s + ' has already been declared, ' <<\n 'and new duplicates declaration does not match existing declaration.'\n\n end\n\n end",
"def temporal_index_name(index_name)\n\t\t\tindex_name.to_s.sub(/^index/, \"ind_h\").sub(/_ix(\\d+)$/, '_hi\\1')\n\t\tend",
"def indexes(_table_name, _name = nil)\n []\n end",
"def safe_add_index(*args, **options); end",
"def create_unique_indexes\n @client[URLS_COLLECTION].indexes.create_one(\n { url: 1 }, name: UNIQUE_INDEX, unique: true\n )\n\n @client[DOCUMENTS_COLLECTION].indexes.create_one(\n { 'url.url' => 1 }, name: UNIQUE_INDEX, unique: true\n )\n\n nil\n end",
"def create_index\n # Only create the index if it doesn't exist\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} already exists !! use #rebuild_index to rebuild the index.\") if index_exists?\n \n Mebla.log(\"Creating index\")\n \n # Create the index\n build_index\n end",
"def add_index(table_name, column_name, options = {})\n # We have to fully replace to add the gist clause.\n options ||= {} # in case nil explicitly passed\n gist = options.delete(:spatial)\n index_name, index_type, index_columns, index_options, index_algorithm, index_using = add_index_options(table_name, column_name, options)\n index_using = 'USING GIST' if gist\n execute \"CREATE #{index_type} INDEX #{index_algorithm} #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} #{index_using} (#{index_columns})#{index_options}\"\n end",
"def create_simple_index(table_name, index_name, column)\n spec = new IndexSpecification(index_name, column.to_java_bytes)\n create_index(table_name, spec)\nend",
"def indexes(table_name, name = nil) #:nodoc:\n schemas = schema_search_path.split(/,/).map { |p| quote(p) }.join(',')\n result = query(<<-SQL, name)\nSELECT i.relname, d.indisunique, a.attname\nFROM pg_class t, pg_class i, pg_index d, pg_attribute a, pg_namespace n\nWHERE i.relkind = 'i'\nAND d.indexrelid = i.oid\nAND d.indisprimary = 'f'\nAND t.oid = d.indrelid\nAND t.relname = '#{table_name}'\nAND a.attrelid = t.oid\nAND n.nspname in (#{schemas})\nAND n.oid = t.relnamespace\nAND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum\nOR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum\nOR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum\nOR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum\nOR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum )\nORDER BY i.relname\nSQL\n \n current_index = nil\n indexes = []\n \n result.each do |row|\n if current_index != row[0]\n indexes << IndexDefinition.new(table_name, row[0], row[1] == \"t\", [])\n current_index = row[0]\n end\n \n indexes.last.columns << row[2]\n end\n \n indexes\n end",
"def index(column_name, **options)\n indexes << [column_name, options]\n end",
"def index_by_name(table_name, index_name)\n index_record = data_dictionary.index_by_name(table_name, index_name)\n\n index_space = space(index_record[\"SPACE\"])\n describer = data_dictionary.record_describer_by_index_name(table_name, index_name)\n index_space.index(index_record[\"PAGE_NO\"], describer)\n end",
"def add_index(table_name, column_name, options = {})\n creation_method = options.delete(:concurrently) ? 'CONCURRENTLY' : nil\n\n # Whether to skip the quoting of columns. Used only for expressions like JSON indexes in which\n # the column is difficult to target for quoting.\n skip_column_quoting = options.delete(:skip_column_quoting) or false\n\n index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options)\n algorithm = creation_method || algorithm\n create_index = CreateIndexDefinition.new(index, algorithm, if_not_exists)\n\n # GOTCHA:\n # It ensures that there is no existing index only for the case when the index\n # is created concurrently to avoid changing the error behavior for default\n # index creation.\n # -- zekefast 2012-09-25\n # GOTCHA:\n # This check prevents invalid index creation, so after migration failed\n # here there is no need to go to database and clean it from invalid\n # indexes. But note that this handles only one of the cases when index\n # creation can fail!!! All other case should be procesed manually.\n # -- zekefast 2012-09-25\n if creation_method.present? && index_exists?(table_name, column_name, options)\n raise ::PgSaurus::IndexExistsError,\n \"Index #{index.name} for `#{table_name}.#{column_name}` \" \\\n \"column can not be created concurrently, because such index already exists.\"\n end\n\n execute schema_creation.accept(create_index)\n end",
"def index_options\n return false unless index && index == entity.key_column\n if entity.is_core\n { unique: true }\n else\n true\n end\n end",
"def explicit_index_with_duplicates( *index_names )\n\n index_names.each do |this_index_name|\n instance = create_explicit_index( this_index_name, true )\n indexes[ this_index_name ] = explicit_indexes[ this_index_name ] = instance\n end\n\n return self\n \n end",
"def create_search_index\n Tire.index self.index_name\n end",
"def indexes(table_name, name = nil)\n result = query(<<-SQL, 'SCHEMA')\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table_name}'\n AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) )\n ORDER BY i.relname\n SQL\n\n result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n inddef = row[3]\n oid = row[4]\n\n columns = query(<<-SQL, \"SCHEMA\")\n SELECT a.attnum, a.attname, t.typname\n FROM pg_attribute a, pg_type t\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n AND a.atttypid = t.oid\n SQL\n columns = columns.inject({}){ |h, r| h[r[0].to_s] = [r[1], r[2]]; h }\n column_names = columns.values_at(*indkey).compact.map{ |a| a[0] }\n\n unless column_names.empty?\n # add info on sort order for columns (only desc order is explicitly specified, asc is the default)\n desc_order_columns = inddef.scan(/(\\w+) DESC/).flatten\n orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {}\n where = inddef.scan(/WHERE (.+)$/).flatten[0]\n # using = inddef.scan(/USING (.+?) /).flatten[0].to_sym\n\n spatial = inddef =~ /using\\s+gist/i &&\n columns.size == 1 &&\n %w[geometry geography].include?(columns.values.first[1])\n\n # IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, nil, using)\n ::RGeo::ActiveRecord::SpatialIndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, !!spatial)\n end\n end.compact\n end",
"def create_indexes\n indexes = %w{ Page(page_id) Trait(eol_pk) Trait(resource_pk) Term(uri) Term(name)\n Resource(resource_id) MetaData(eol_pk)}\n indexes.each do |index|\n begin\n query(\"CREATE INDEX ON :#{index};\")\n rescue Neography::NeographyError => e\n if e.to_s =~ /already created/\n puts \"Already have an index on #{index}, skipping.\"\n else\n raise e\n end\n end\n end\n end",
"def expression_index_name(name)\n column_name, operator_name = split_column_name(name)\n\n result_name = if column_name =~ FUNCTIONAL_INDEX_REGEXP\n \"#{$1.downcase}_#{$3}\"\n else\n column_name\n end\n\n result_name += \"_\" + operator_name.parameterize.underscore if operator_name\n\n result_name\n end",
"def test_indexes\n idx_name = \"accounts_idx\"\n\n indexes = @connection.indexes(\"accounts\")\n assert_empty indexes\n\n @connection.add_index :accounts, :firm_id, name: idx_name\n indexes = @connection.indexes(\"accounts\")\n assert_equal \"accounts\", indexes.first.table\n assert_equal idx_name, indexes.first.name\n assert !indexes.first.unique\n assert_equal [\"firm_id\"], indexes.first.columns\n ensure\n @connection.remove_index(:accounts, name: idx_name) rescue nil\n end",
"def test_indexes\n idx_name = \"accounts_idx\"\n\n indexes = @connection.indexes(\"accounts\")\n assert_empty indexes\n\n @connection.add_index :accounts, :firm_id, name: idx_name\n indexes = @connection.indexes(\"accounts\")\n assert_equal \"accounts\", indexes.first.table\n assert_equal idx_name, indexes.first.name\n assert !indexes.first.unique\n assert_equal [\"firm_id\"], indexes.first.columns\n ensure\n @connection.remove_index(:accounts, name: idx_name) rescue nil\n end",
"def index( index_name, ensure_exists = false )\n \n index_instance = nil\n \n if index_name.nil?\n raise ::ArgumentError, 'Index name required but received nil.'\n end\n \n unless index_instance = indexes[ index_name ]\n if ensure_exists\n raise ::ArgumentError, 'No index found by name ' << index_name.to_s + ' for ' << to_s + '.'\n end\n end\n \n return indexes[ index_name ]\n\n end",
"def build_automatic_index(name, et, keys = nil)\n if keys and not keys.is_a? java.util.Set\n set = java.util.HashSet.new\n keys.each { |k| set.add k.to_s }\n keys = set\n end\n index = createAutomaticIndex name.to_s, index_class(et), keys\n index.graph = self\n if index_class(et) == element_type(:vertex).java_class\n v.bulk_job do |v|\n Pacer::Utils::AutomaticIndexHelper.addElement(index, v)\n end\n else\n e.bulk_job do |e|\n Pacer::Utils::AutomaticIndexHelper.addElement(index, e)\n end\n end\n index\n end",
"def update_index(name, attribute)\n @index[name] = @index[name.to_s.freeze] = attribute\n end",
"def indexes(table_name, name = nil)\n []\n end",
"def indexes(table_name, name = nil)\n []\n end",
"def ensure_index(spec, opts={})\n now = Time.now.utc.to_i\n opts[:dropDups] = opts[:drop_dups] if opts[:drop_dups]\n opts[:bucketSize] = opts[:bucket_size] if opts[:bucket_size]\n field_spec = parse_index_spec(spec)\n name = opts[:name] || generate_index_name(field_spec)\n name = name.to_s if name\n\n if !@cache[name] || @cache[name] <= now\n generate_indexes(field_spec, name, opts)\n end\n\n # Reset the cache here in case there are any errors inserting. Best to be safe.\n @cache[name] = now + @cache_time\n name\n end",
"def add_indexes\n if hereditary? && !index_keys.include?(self.discriminator_key.to_sym => 1)\n index({ self.discriminator_key.to_sym => 1 }, unique: false, background: true)\n end\n true\n end",
"def with_index(name = nil, &block)\n name ||= caller(1)[0].match(/in `(.*)'\\z/)[1]\n mapper.indexes[name.to_s] or begin\n indexable = yield\n mapper.add_index(name, indexable)\n end\n end",
"def index_name=(name)\n @index_name = name\n end",
"def index_name=(name)\n @index_name = name\n end",
"def create_indexes\n source_attributes = self.base_class.attributes\n self.indexes.each do |name, index|\n opts = {:table_name => index.table_name, :id => :id}\n if index.range_key?\n if index.range_keys.select{|v| !source_attributes[v].nil? && source_attributes[v][:type] == :string}.any?\n opts[:range_key] = { :range => :string }\n else\n opts[:range_key] = { :range => :number }\n end\n else\n opts[:range_key] = nil\n end\n self.create_table(opts)\n end\n end",
"def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end",
"def create_index( index_name, sort_by_proc = nil, & indexing_block )\n \n return create_bucket_index( index_name, false, sort_by_proc, & indexing_block )\n \n end",
"def create_main_index(version = 1)\n self.create_index(version)\n self.set_alias(version)\n end",
"def default_index_name(table_name, columns)\n \"#{table_name}_#{columns.join(UNDERSCORE)}_index\"\n end",
"def supports_indexes_in_create?\n false\n end",
"def supports_indexes_in_create?\n false\n end",
"def create_cell_name_index!\n return nil unless can_index?\n\n update!(is_indexing: true)\n study_cells = study.all_cells_array\n cell_index = cell_name_index(study_cells)\n # if some cells are not indexed, don't create array as this will break things downstream\n index_count = cell_index.compact.size\n if cell_index.empty?\n Rails.logger.info \"using default cell index for #{study.accession}:#{name}\"\n update!(is_indexing: false, indexed: true, use_default_index: true)\n elsif index_count != points\n Rails.logger.info \"aborting cell index for #{study.accession}:#{name} - #{points - index_count} cells not found\"\n update!(is_indexing: false)\n else\n cell_index.each_slice(DataArray::MAX_ENTRIES).with_index do |slice, index|\n begin\n DataArray.create!(\n name: 'index', array_type: 'cells', array_index: index, values: slice, linear_data_type: 'ClusterGroup',\n linear_data_id: id, study_id: study.id, study_file_id:, cluster_name: name\n )\n rescue => e\n update!(is_indexing: false)\n ErrorTracker.report_exception(e, nil, study, self, { job: :create_cell_name_index! })\n end\n end\n update!(is_indexing: false, indexed: true)\n end\n end",
"def index_definition_sql(table_name, index)\n\t raise Error, \"Partial indexes are not supported for this database\" if index[:where]\n\n\t # Basic index creation DDL.\n\t sql = [\"CREATE\"]\n\t case index[:type]\n\t when :bitmap\n\t\t raise Error, \"Bitmap indexes cannot be unique\" if index[:unique]\n\t sql << 'BITMAP'\n\t when NilClass, :normal\n\t sql << 'UNIQUE' if index[:unique]\n\t else\n\t raise Error, \"Index type #{index[:type].inspect} is not supported for this database\"\n\t end\n\t index_name = index[:name] || default_index_name(table_name, index[:columns])\n\t qualified_table_name = quote_schema_table table_name\n\t sql << \"INDEX #{quote_identifier(index_name)} ON #{qualified_table_name}\"\n\t \n\t # Index columns and join indexes.\n index_join, index_columns = *index.values_at(:join,:columns)\n\t sql << literal(index_columns)\n if index_join\n\t\t raise Error, \"Join clauses are only supported for bitmap indexes\" if index[:type]!=:bitmap\n\t\t sql << \"FROM #{qualified_table_name},\"\n\t\t sql << index_columns.map{|k| quote_identifier schema_and_table(k).first }.uniq.join(', ')\n\t\t \n\t\t # TODO: Document this short-hand syntax: {:columns=>[:ref_table__ref_column], :join=>[:fk_column]}\n if Array===index_join and index_join.length==index_columns.length and index_join.all?{|k| Symbol===k}\n index_join = Hash[ index_join.map{|k| :\"#{table_name}__#{k}\" }.zip(index_columns) ]\n end\n\n\t sql << \"WHERE #{filter_expr(index_join)}\"\n\t end\n\t \n\t # Index attributes and options.\n\t sql << 'LOCAL' if index[:partitioned]\n\t sql << flag_option_sql(index, :parallel)\n\t sql << flag_option_sql(index, :logging)\n\t sql << \"TABLESPACE #{quote_identifier(index[:tablespace])}\" if index[:tablespace]\n\t sql << flag_option_sql(index, :visible, 'INVISIBLE')\n\t sql << compress_option_sql(index)\n\t sql << index[:options] if String === index[:options]\n\t sql << 'UNUSABLE' if FalseClass === index[:valid]\n\t sql.compact.join ' '\n\t end",
"def unique_index_for(keys)\n inventory_collection.unique_index_for(keys)\n end",
"def unique_index_for(keys)\n inventory_collection.unique_index_for(keys)\n end",
"def index_exists_by_name?(table, index)\n indexes_for_table[table].include?(index)\n end",
"def unique?\n if @args[:data][:Index_type] == \"UNIQUE\"\n return true\n else\n return false\n end\n end",
"def make_artist unique_index\n artist_name = (0...8).map{ 65.+(rand(26)).chr }.join\n return \"INSERT INTO artists VALUES (#{rand(500)}, '#{artist_name}');\"\nend",
"def index_name(event)\n\n index_name, num_docs, write_alias, read_alias = index_status()\n @logger.error(\"status\", :index_name => index_name, :num_docs => num_docs, :write_alias => write_alias, :read_alias => read_alias)\n\n if num_docs == 0\n\n @logger.error(\"index does not exist, create one\", :index_name => index_name)\n\n create_index(index_name)\n\n create_index_aliases(index_name, write_alias, read_alias)\n\n elsif num_docs < @messages_per_slice\n\n @logger.error(\"less than, use the current index\", :index_name => index_name)\n\n else\n\n @logger.error(\"greater than or equal to, create new index and aliases\")\n\n slice = index_name.split('_')[0].to_i\n @logger.error(\"slice\", :slice => slice)\n\n new_index_name = to_index_name(slice += 1, @application, @domain)\n @logger.error(\"index_name\", :new_index_name => new_index_name)\n\n create_index(new_index_name)\n\n update_index_aliases(index_name, new_index_name, write_alias, read_alias)\n end\n\n write_alias\n\n end",
"def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end",
"def index_name\n raise SearchFlip::MethodNotImplemented, \"You must implement #{name}::index_name\"\n end",
"def index_name\n @element[:name] || @element[:column]\n end",
"def global_index index_name, key, key_type, range_key_name=nil, range_key_type=nil\n @global_index = {} if @global_index.nil?\n @global_index[index_name] = [key, Dynamosaurus::DynamoBase::TYPES[key_type]]\n @global_index[index_name] << range_key_name << Dynamosaurus::DynamoBase::TYPES[range_key_type] if range_key_name\n end",
"def valid_index?\n param! :name, String, blank: false\n end",
"def to_create_composite_index_sql\n queries = []\n unless composite_indexes.blank?\n composite_indexes.each do |columns, unique|\n sql = \"CREATE #{unique ? 'UNIQUE ' : ''}INDEX \"\n sql << \"#{to_s.downcase}_#{columns.join('_')}_index ON \"\n sql << \"#{to_sql} (#{columns.join(', ')})\"\n queries << sql.compress_lines\n end\n end\n queries\n end",
"def default_index_name(table_name, columns)\n\t\t schema, table = schema_and_table(table_name)\n\t\t ds = DB[:all_indexes].where(:table_name=>table,:dropped=>'NO')\n\t\t ds = ds.where :owner=>schema unless schema.nil?\n\t\t \"#{table[0,25]}_ix%2.2d\" % [ds.count + 1]\n\t\t end",
"def on(name)\n indexes_on(name).map.(&method(:index_from_database))\n end",
"def change\n add_index :handcuffs_primary_tests, :test_field, algorithm: :concurrently\n end",
"def index_name(table_name, options) #:nodoc:\n super table_name.tr('.', '_'), options\n end",
"def index_field?(name)\n index_fields.key?(name)\n end",
"def explicit_index( *index_names )\n\n index_names.each do |this_index_name|\n instance = create_explicit_index( this_index_name, false )\n indexes[ this_index_name ] = explicit_indexes[ this_index_name ] = instance\n end\n \n return self\n\n end",
"def add_to_index(vendor_prod_id, name, severity)\n year = NvdFileSystem::year_from_name(name)\n\n path=\"#{@nvdfs.root_path}/index\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{year}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{vendor_prod_id}\"\n\n\n idx = NvdfsSimpleIndex.load path\n idx.add(severity, name)\n idx.save\n\n end",
"def add_index(table, *args)\n alter_table(table) {add_index(*args)}\n end",
"def index_to_generator_opts(table, name, index_opts)\n h = {}\n h[:name] = name unless default_index_name(table, index_opts[:columns]) == name.to_s\n h[:unique] = true if index_opts[:unique]\n h\n end",
"def create_index\n dataset.create_index(index_params)\n end"
] | [
"0.80841625",
"0.79588526",
"0.7905823",
"0.77104324",
"0.7225079",
"0.7225079",
"0.7085467",
"0.70254433",
"0.69911695",
"0.69751793",
"0.69751793",
"0.6944564",
"0.6942853",
"0.6911964",
"0.6911134",
"0.67506224",
"0.6749996",
"0.6748517",
"0.67222816",
"0.66959053",
"0.6679907",
"0.66698074",
"0.6660517",
"0.664539",
"0.66368204",
"0.6604901",
"0.6592468",
"0.65906554",
"0.65822107",
"0.65807414",
"0.6564995",
"0.6547127",
"0.65462077",
"0.6532339",
"0.650708",
"0.6503789",
"0.64986676",
"0.64974344",
"0.6494882",
"0.6441036",
"0.639932",
"0.6390752",
"0.6377737",
"0.6351874",
"0.6335387",
"0.63277936",
"0.6327102",
"0.6319742",
"0.6307596",
"0.63054925",
"0.6304207",
"0.6301078",
"0.62853026",
"0.6275446",
"0.6272381",
"0.6267929",
"0.6266232",
"0.62423",
"0.6241322",
"0.6241322",
"0.62408394",
"0.6240265",
"0.62013453",
"0.61915475",
"0.61915475",
"0.6178479",
"0.6174034",
"0.6160759",
"0.615804",
"0.615804",
"0.61566275",
"0.615457",
"0.6150664",
"0.61341506",
"0.61188275",
"0.6114732",
"0.6114732",
"0.61141527",
"0.60996544",
"0.6096589",
"0.6096589",
"0.60906464",
"0.60871375",
"0.6065473",
"0.6061598",
"0.6055149",
"0.6047074",
"0.603668",
"0.60342646",
"0.6027227",
"0.60256165",
"0.6016896",
"0.60031074",
"0.60004276",
"0.5997716",
"0.5995654",
"0.59906906",
"0.59764904",
"0.5955184",
"0.5953556",
"0.5950195"
] | 0.0 | -1 |
======================================================================================= Object Instantiation ======================================================================================= | def create_field( name, type, *marks )
TableParts::Field.new(self, name, type, *marks)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n \n end",
"def initialize() end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def constructor; end",
"def initialize\n end",
"def initialize()\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\r\n\r\n end",
"def initialize\n init\n end",
"def initialize object\n\t\tself.object = object\n\tend",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(obj)\n @obj = obj\n end",
"def initialize(obj)\n @obj = obj\n end",
"def initialize(obj); end",
"def initialize\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n\t\t\n\tend",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n @data = Data.instance\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def init\n raise NotImplementedError\n end",
"def initialize(object)\n @object = object\n end",
"def initialize(object)\n @object = object\n end",
"def initialize(object)\n @object = object\n end",
"def initialize(object)\n @object = object\n end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize()\n\t\tend",
"def initialize()\r\n\r\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize(obj)\n @base = obj\n end",
"def initialize()\n # override parent\n end"
] | [
"0.80444825",
"0.7907648",
"0.7829564",
"0.7829564",
"0.7829564",
"0.7829564",
"0.7829564",
"0.7829564",
"0.7816187",
"0.7742366",
"0.7739882",
"0.773351",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.7690315",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.76701385",
"0.7641568",
"0.7618932",
"0.7592924",
"0.7586031",
"0.7573075",
"0.7573075",
"0.7573075",
"0.7573075",
"0.7573075",
"0.75716144",
"0.75716144",
"0.75483066",
"0.75069773",
"0.7469452",
"0.7469452",
"0.7437232",
"0.7437232",
"0.7437232",
"0.7437232",
"0.7437232",
"0.7437232",
"0.7437232",
"0.74161845",
"0.74142605",
"0.74142605",
"0.74142605",
"0.74142605",
"0.74142605",
"0.74142605",
"0.74142605",
"0.74142605",
"0.7366736",
"0.7366736",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7354481",
"0.7323053",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.73192406",
"0.731061",
"0.731061",
"0.731061",
"0.73102486",
"0.72665757",
"0.7264342",
"0.7264342",
"0.7264342",
"0.7263797",
"0.7263797",
"0.7254346",
"0.72489446",
"0.7240501",
"0.7240501",
"0.7164084",
"0.713547"
] | 0.0 | -1 |
method to add a student | def add_student(database, name)
database.execute("INSERT INTO students (name) VALUES (?)", [name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_student(new_student)\n @students << new_student\n end",
"def addStudent(studentId, fName, lName)\n @studentOne = Student.new(studentId, fName, lName)\n end",
"def add_student(student)\n @student << student\n end",
"def add_student(student)\n @students << student\n end",
"def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend",
"def add_student(student_name, student_grade)\n\t\tSCHOOL[:students] << {:name => student_name, :grade => student_grade}\n\tend",
"def add_student=(student_id)\n return unless student_id.present?\n students << Student.find(student_id)\n end",
"def add_student(name, grade, semester)\n\t\tstudents.push(Student.new(name, grade, semester))\n\tend",
"def add_student( student )\n CourseRegistration.create :user_id => student.id, :course_id => self.id\n end",
"def addstudent(name, grade, semester)\n\t\t@students.push(:name=>name, :grade=>grade, :semester=>semester)\n\tend",
"def add_student(name, grade, semester)\n\t\tstudents.push( {:name => name, :grade => grade, :semester => semester} )\n\tend",
"def add_student(school, new_student_name, new_student_grade, new_student_semester)\n school[:students].push(:name => new_student_name, \n :grade => new_student_grade, :semester => new_student_semester)\nend",
"def add_student(person)\n c = CoursePerson.new type: \"student\"\n c.person = person\n self.course_person << c\n self.save \n end",
"def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend",
"def add_student (name, grade)\n # @student_name = name\n # @grade = grade\n if @roster.include?(grade) \n @roster [grade] << name \n else\n @roster [grade] = [name]\n end\n end",
"def student_add\n\t\tname_array = name.split(\" \")\n\t\tname = Student.new(name_array[0], name_array[1])\n\t\tputs \"Enter course you would like to add.\"\n\t\tchoice = gets.chomp.downcase\n\t\tname.enroll(choice) if choice.is_a?(Course)\n\tend",
"def add_student_name(name)\n @student_names << name\n end",
"def addstudent(student, grade, semester, school)\n school[:students] << {name: student, grade: grade, semester: semester} \nend",
"def add_student\n @student = nil\n @portal_clazz = Portal::Clazz.find(params[:id])\n\n if params[:student_id] && (!params[:student_id].empty?)\n @student = Portal::Student.find(params[:student_id])\n end\n if @student\n @student.add_clazz(@portal_clazz)\n @portal_clazz.reload\n render :update do |page|\n page.replace_html 'students_listing', :partial => 'portal/students/table_for_clazz', :locals => {:portal_clazz => @portal_clazz}\n page.visual_effect :highlight, 'students_listing'\n page.replace_html 'student_add_dropdown', @template.student_add_dropdown(@portal_clazz)\n end\n else\n render :update do |page|\n # previous message was \"that was a total failure\"\n # this case should not happen, but if it does, display something\n # more friendly such as:\n # page << \"$('flash').update('Please elect a user from the list before clicking add button.')\"\n end\n end\n end",
"def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university\n end\n\n if self.surveys.count > 0\n add_student_to_course_surveys(student)\n end\n\n self.students << student\nend",
"def add\n # variable scope\n # no student\nend",
"def add_student\n course_id = params[:course_id]\n requires({'role' => ['admin','faculty'],'course_id'=>course_id})\n first = params[:first]\n last = params[:last]\n email = params[:email]\n role = params[:role]\n \n \n course = Course.find(course_id)\n\n student = User.find_by_email(email)\n unless student\n student = create_and_invite_user(first, last, email, 'student')\n end\n\n unless student\n render :text => 'Error adding student.'\n else\n if role == 'student'\n StudentInCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'Student added successfully.'\n elsif role == 'ta'\n TaForCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'TA added successfully.'\n end\n end\n end",
"def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def add_student(name, grade)\r\n if @roster[grade] != nil \r\n @roster[grade] << name\r\n else\r\n @roster[grade] = [name]\r\n end\r\n end",
"def add_student(student_name, grade)\n if @roster[grade] == nil\n @roster[grade] = []\n end\n @roster[grade] << student_name\n end",
"def new_student(list, name, grade, semester)\n\tlist.push( {:name => name, :grade => grade, :semester => semester} )\nend",
"def addstudent(newname, schoolvar)\n\tschoolvar[:students]<<{:name=>newname}\nend",
"def add_student(student, grade)\n @roster[grade] ||= []\n @roster[grade] << student\n # binding.pry\n end",
"def enroll(new_student)\n @students.push(new_student)\n end",
"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 new_student(name, email)\n #code here\n @students.push({name: name, email: email})\nend",
"def create_new_student(student_name)\n object = controller_create(:student)\n fail format(\"Student '%s' not created.\", student_name) if object.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n student_name,\n object[:id]))\n object\n end",
"def enroll(new_student) \n @students.push(new_student) \n end",
"def add_teacher(first, last, campus, veracross, email)\n puts(\"Adding #{first} #{last} #{campus} #{veracross} #{email}\")\n Student.create(\n first_name: first,\n last_name: last,\n campus: campus,\n veracross_id: veracross,\n email: email,\n teacher: true\n )\nend",
"def add_student(student_name, grade)\n if @roster.has_key?(grade)\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(first_name, last_name, local_cohort)\n self.local_cohorts[local_cohort].students.push Student.new(first_name, last_name, local_cohort)\n puts \"#{first_name} #{last_name} has been added to the #{local_cohorts[local_cohort].name} #{self.name} cohort.\"\n end",
"def create\n @student = current_user.students.create(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Registro Exitoso.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def adding_students\n if params[:students_id] == nil\n session[:error] =\"You have to select one or more students.\"\n hasError = 1\n else\n params[:students_id].each{|t|\n student_aux =Student.find(t)\n @student_class.students << student_aux\n }\n end \n end",
"def add_student(student_name, grade)\n roster[grade] ||= []\n roster[grade] << student_name\n end",
"def add_student(name, grade)\n @roster[grade] ||= []\n @roster[grade] << name\n end",
"def add_student(name, grade)\n #check if empty\n if roster[grade] != nil\n roster[grade] << name\n else\n roster[grade] = [name]\n end\n end",
"def newstudent firstname, lastname, course\n $roster << {firstname: firstname, lastname: lastname, course: course}\nend",
"def create\n @student = Student.new(params[:student])\n @student.save\n end",
"def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'],\n\t\t\t:gender => p['gender'] == 'Male' ? 'M' : 'F', :born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t:home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t:biographical_notes => p['biographical_notes'], :quotes => p['quotes'], :additional_notes => p['additional_notes'], :private_notes => p['private_notes'], :is_stub => 0\n\t\t}\n\n\t\t@student = Student.new(hash)\n\t\t@student.generate_unique_name()\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\tif !marriage['name'].blank?\n\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\tresidences.each {|residence|\n\t\t\t\t\tif !residence.blank?\n\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tBrowse.student_changed(@student, nil)\n\t\t\t\tsolr().add_object(@student.to_solr())\n\n\t\t\t\tformat.html { redirect_to(@student, :notice => 'The student was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tnew_setup()\n\t\t\t\t\trender :action => \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def add_student(name, grade)\n roster[grade]||=[]\n roster[grade] << name\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 add_student(name, grade)\r\n roster[grade] = [] unless roster[grade]\r\n roster[grade] << name\r\n end",
"def add_student(name, grade)\n\t\tif @roster.key?(grade)\n\t\t\t@roster[grade] << name\n\t\telse \n\t\t\t@roster[grade]= []\n\t\t\troster[grade] << name\n\t\tend\n\tend",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n flash[:success] = \"Aluno criado com sucesso\"\n redirect_to student_path(@student)\n else\n flash[:error] = \"Não foi possível criar o aluno\"\n redirect_to students_path\n end\n end",
"def create\n @student = current_user.students.build(student_params)\n # @student = Student.new(student_params)\n # @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to admissions_url, success: 'Student record was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n # Add the course just created to this student's courses, better use the drop down list \n if params[:course] != nil then\n @student.courses << Course.find(params[:course][:id])\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n answer = Student.createNew(params[:student])\n redirect_to teachers_path, notice: \"Student wasn't created! Please bind at least one teacher to class #{gcl} before.\" unless answer\n\n redirect_to \"/gclasses/#{Gclass.where(:gclass=>params[:student][:gclass]).first.id}\", notice: \"Student was successfully created.\"\n end",
"def create_new_student(hParams)\n user = hParams[:student_name].split(' ')\n\n controller_data = {}\n unless hParams.exist?(:first_name)\n if user.length == 1\n controller_data[:first_name] = 'unknown first name'\n else\n controller_data[:first_name] = user[0..-2].join(' ')\n end\n end\n controller_data[:last_name] = user[-1] unless hParams.exist?(:last_name)\n\n student = controller_create(:student, controller_data)\n\n process_fail format(\"Student '%s' not created.\",\n hParams[:student_name]) if student.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n hParams[:student_name],\n student[:id]))\n student\n end",
"def create\n Student.conn.exec('INSERT INTO students (name, age, spirit_animal, squad_id) values ($1,$2,$3,$4)', [ name, age, spirit_animal, squad_id])\n end",
"def add_student(student, grade_level)\n roster[grade_level] ||= []\n roster[grade_level] << student \n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n relate_with_courses\n format.html { redirect_to admin_student_path(@student), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(student_name, student_grade)\n# pp @roster\n \n if roster[student_grade]\n roster[student_grade] << student_name\n else\n roster[student_grade] = []\n roster[student_grade] << student_name\n end\n\n# roster[grade] name\n end",
"def add_students(name, cohort)\n @students << {name: name, cohort: cohort}\nend",
"def create\n @student = current_user.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_url, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade].push(student_name)\n else\n #if not present, create the key and empty array value and add \n #the student name to it\n @roster[grade] = []\n @roster[grade].push(student_name)\n end\n end",
"def create\n @student = current_district.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully created.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @manage_student = Manage::Student.new(manage_student_params)\n\n respond_to do |format|\n if @manage_student.save\n format.html { redirect_to @manage_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @manage_student }\n else\n format.html { render :new }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n if @student.save\n flash[:success] = \"Student Created!\"\n redirect_to @student\n else\n render 'new'\n end\n end",
"def create\n @student = Student.new(student_params)\n if @student.save\n flash[:success] = \"Student was successfully created...\"\n redirect_to student_path(@student)\n else\n render 'new'\n end\n end",
"def create\n# @student = Student.new(params[:student])\n @student = Student.new(student_params)\n if @student.save\n redirect_to new_student_path\n end\n end",
"def new\n\t\t@student = Student.new\n\tend",
"def new\n\t\t@student = Student.new\n\tend",
"def new\n\t\t@student = Student.new\n\tend",
"def create\n\t\t@student = Student.new(student_params)\n\t\tif @student.save\n\t\t\tredirect_to @student\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def create\n\t\t#for each student, create student params\n\t\t@student = Student.create!(student_params)\n\t\t#once created, go back to students path\n\t\tredirect_to students_path\n\t#wrap up \"create\" action\n\tend",
"def create\n @student = Student.create!(student_params)\n session[:student_id] = @student_id\n redirect_to students_path, notice: 'Hi, #{@student.name}. Welcome to the Bueller System.'\n end",
"def add_student(name, grade)\n if roster.key?(grade) == false\n roster[grade] = [ ]\n roster[grade] << name \n else \n roster[grade] << name\n end \n end",
"def add_student(name, cohort, food)\n @students << {name: name, cohort: cohort.to_sym, food: food}\nend",
"def create\n @thesis = Thesis.new(thesis_params)\n\n# this adds the thesis created to the logged-in user\n @student.theses << @thesis\n\n if @thesis.save\n redirect_to(theses_path, notice: \"The thesis #{@thesis.title} has been uploaded.\")\n else\n render \"new\"\n end\n end",
"def add_student(name, cohort)\n @students << {name: name, cohort: cohort.to_sym}\nend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_url, notice: 'Student was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente creado.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_student(db, name, address, age, program)\n\tdb.execute(\"INSERT INTO school (name, address, age, program) VALUES (?, ?, ?, ?)\", [name, address, age, program])\nend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student,\n notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student (name,grade)\n if @roster[grade] == nil\n @roster[grade] = []\n @roster[grade] << name\n else \n @roster[grade] << name\n end \nend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @student_instrument = StudentInstrument.new(params[:student_instrument])\n\n @student = Student.find(params[:student_instrument][:student_id])\n\n respond_to do |format|\n if @student_instrument.save\n format.html { redirect_to @student, notice: 'Instrument was successfully added.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.83528656",
"0.83310837",
"0.8289876",
"0.8281807",
"0.8242785",
"0.80043757",
"0.7938122",
"0.7918924",
"0.79144514",
"0.78676206",
"0.7859744",
"0.78085536",
"0.76485455",
"0.7648163",
"0.7566657",
"0.75616866",
"0.7543123",
"0.75255984",
"0.7481705",
"0.747584",
"0.73632014",
"0.73538405",
"0.7298939",
"0.7276188",
"0.7270139",
"0.72591114",
"0.7238601",
"0.7228282",
"0.7205181",
"0.719134",
"0.7187438",
"0.7181457",
"0.7137429",
"0.71335274",
"0.71307266",
"0.71192044",
"0.71191555",
"0.71064675",
"0.7098376",
"0.7079132",
"0.70689243",
"0.7056671",
"0.7045268",
"0.70370257",
"0.70142865",
"0.70084304",
"0.6969843",
"0.6956546",
"0.69546634",
"0.69415826",
"0.69268155",
"0.69015473",
"0.6893337",
"0.6870485",
"0.6853983",
"0.68396825",
"0.68358654",
"0.68333495",
"0.6817465",
"0.6806426",
"0.6801365",
"0.6771649",
"0.6769388",
"0.6768032",
"0.67625415",
"0.67540437",
"0.6734624",
"0.67318195",
"0.6730932",
"0.6726107",
"0.6726107",
"0.6726107",
"0.6713956",
"0.6709126",
"0.6697853",
"0.6696894",
"0.6694393",
"0.669046",
"0.6687304",
"0.6687093",
"0.668511",
"0.6681934",
"0.66626203",
"0.66606516",
"0.66390544",
"0.6632412",
"0.66309655",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6630948",
"0.6629771",
"0.6623922"
] | 0.6870187 | 54 |
add_student(db, "Bob") methoad to add a subject | def add_subject(database, name)
database.execute("INSERT INTO subjects (name) VALUES (?)", [name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university\n end\n\n if self.surveys.count > 0\n add_student_to_course_surveys(student)\n end\n\n self.students << student\nend",
"def add_student(database, name)\r\n\tdatabase.execute(\"INSERT INTO students (name) VALUES (?)\", [name])\r\nend",
"def add_teacher(first, last, campus, veracross, email)\n puts(\"Adding #{first} #{last} #{campus} #{veracross} #{email}\")\n Student.create(\n first_name: first,\n last_name: last,\n campus: campus,\n veracross_id: veracross,\n email: email,\n teacher: true\n )\nend",
"def add_student(person)\n c = CoursePerson.new type: \"student\"\n c.person = person\n self.course_person << c\n self.save \n end",
"def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend",
"def add_student( student )\n CourseRegistration.create :user_id => student.id, :course_id => self.id\n end",
"def add_student(student)\n @student << student\n end",
"def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend",
"def add_student\n course_id = params[:course_id]\n requires({'role' => ['admin','faculty'],'course_id'=>course_id})\n first = params[:first]\n last = params[:last]\n email = params[:email]\n role = params[:role]\n \n \n course = Course.find(course_id)\n\n student = User.find_by_email(email)\n unless student\n student = create_and_invite_user(first, last, email, 'student')\n end\n\n unless student\n render :text => 'Error adding student.'\n else\n if role == 'student'\n StudentInCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'Student added successfully.'\n elsif role == 'ta'\n TaForCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'TA added successfully.'\n end\n end\n end",
"def add_student(student)\n @students << student\n end",
"def new_student (db, name)\n db.execute(\"INSERT INTO student (name) VALUES (?)\", [name])\nend",
"def add_student(new_student)\n @students << new_student\n end",
"def addStudent(studentId, fName, lName)\n @studentOne = Student.new(studentId, fName, lName)\n end",
"def create_student(db, name, address, age, program)\n\tdb.execute(\"INSERT INTO school (name, address, age, program) VALUES (?, ?, ?, ?)\", [name, address, age, program])\nend",
"def add_student_name(name)\n @student_names << name\n end",
"def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend",
"def add_student(school, new_student_name, new_student_grade, new_student_semester)\n school[:students].push(:name => new_student_name, \n :grade => new_student_grade, :semester => new_student_semester)\nend",
"def addstudent(newname, schoolvar)\n\tschoolvar[:students]<<{:name=>newname}\nend",
"def add_student(student_name, student_grade)\n\t\tSCHOOL[:students] << {:name => student_name, :grade => student_grade}\n\tend",
"def add_student=(student_id)\n return unless student_id.present?\n students << Student.find(student_id)\n end",
"def student_add\n\t\tname_array = name.split(\" \")\n\t\tname = Student.new(name_array[0], name_array[1])\n\t\tputs \"Enter course you would like to add.\"\n\t\tchoice = gets.chomp.downcase\n\t\tname.enroll(choice) if choice.is_a?(Course)\n\tend",
"def create_students (db, name, essay_1, essay_2, midterm_1, midterm_2)\n\tdb.execute(\"INSERT INTO students (name, essay_1, essay_2, midterm_1, midterm_2) VALUES (?, ?, ?, ?, ?)\", [name, essay_1, essay_2, midterm_1, midterm_2])\nend",
"def addstudent(student, grade, semester, school)\n school[:students] << {name: student, grade: grade, semester: semester} \nend",
"def add\n # variable scope\n # no student\nend",
"def add_new_school(db, name)\n db.execute(\"INSERT INTO school (name) VALUES (?)\", [name])\nend",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students_db (first_name, last_name, birthday) VALUES ('#{first_name}', '#{last_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students (first_name, last_name, birthdate) VALUES ('#{first_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def add_student(first_name, last_name, birthdate)\n @conn.exec(\"INSERT INTO students (first_name, last_name, birthdate) VALUES ('#{first_name}', '#{last_name}', '#{birthdate}');\")\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 addstudent(name, grade, semester)\n\t\t@students.push(:name=>name, :grade=>grade, :semester=>semester)\n\tend",
"def create\n @subject = current_user.subjects.new(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: \"已成功创建学生账户:#{@subject.title}. \"}\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_subject(subject)\n res = subject.put(:add_role, :id => subject.id, :role_id => self.id, :client_id => CLIENT_ID)\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n return true\n else\n return false\n end\n end",
"def add_student(name, grade, semester)\n\t\tstudents.push(Student.new(name, grade, semester))\n\tend",
"def add_student(name, grade, semester)\n\t\tstudents.push( {:name => name, :grade => grade, :semester => semester} )\n\tend",
"def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend",
"def update_subject(school, name, subject)\n\tschool[:instructors].each { |instructor| instructor[:subject] = subject if instructor[:name] == name}\nend",
"def add_student(first_name, last_name,birthdate)\n @conn.exec(\"INSERT INTO students (first_name, last_name, birthdate) VALUES ('#{first_name}', '#{last_name}', '#{birthdate}');\")\nend",
"def add_to_test(test, student_first, student_last, grade)\n db.execute(\"INSERT INTO #{test} (student_first, student_last, grade) VALUES (?, ?, ?);\", [student_first, student_last, grade])\nend",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def add_student(student, owner)\n @user = User.find(student)\n @owner = User.find(owner)\n @app = @user.appointments.create(:booking_id => eslf.id)\n if @app.save\n BookingMailer.booking_email(@user, @app.booking, @owner).deliver\n end\n end",
"def add_student (name, grade)\n # @student_name = name\n # @grade = grade\n if @roster.include?(grade) \n @roster [grade] << name \n else\n @roster [grade] = [name]\n end\n end",
"def new_student(name, email)\n #code here\n @students.push({name: name, email: email})\nend",
"def create\n Student.conn.exec('INSERT INTO students (name, age, spirit_animal, squad_id) values ($1,$2,$3,$4)', [ name, age, spirit_animal, squad_id])\n end",
"def set_subject(subject)\n\t\tend",
"def newstudent firstname, lastname, course\n $roster << {firstname: firstname, lastname: lastname, course: course}\nend",
"def set_student_subject\n @student_subject = StudentSubject.find(params[:id])\n end",
"def create_subject(options = {})\n default_values = { :name => 'Test subject' }\n Subject.create(default_values.merge(options))\n end",
"def update_subject(instructor_name, new_subject)\n\t\tSCHOOL[:instructors].each do |hash|\n\t\t\thash[:subject]=new_subject if hash[:name]==instructor_name\n\t\tend\n\tend",
"def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend",
"def add_student(student, grade)\n @roster[grade] ||= []\n @roster[grade] << student\n # binding.pry\n end",
"def create_new_subject_item_note\n if subject_item_note.save\n redirect_to student_subjects_path(params[:subject_item_note][:student_id]), notice: I18n.t('shared.created', resource: 'subject_item_note')\n else\n redirect_to student_subjects_path(params[:subject_item_note][:student_id]), :flash => { :error => subject_item_note.errors.full_messages.join(', ') }\n end\n end",
"def create\n hasError = 0\n @subject = Subject.new(params[:subject])\n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\"\n hasError = 1\n else\n if @subject.save\n params[:teachers_id].each{|t|\n teacher_aux =Teacher.find(t)\n @subject.teachers << teacher_aux\n }\n CustomLogger.debug(\"Subject created\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject= Subject.new\n end\n end\n restore_lists\n end",
"def add_student(name, grade)\r\n if @roster[grade] != nil \r\n @roster[grade] << name\r\n else\r\n @roster[grade] = [name]\r\n end\r\n end",
"def create\n session[:setting] = \"\"\n @subject = @student.subject.create(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to student_path(@student), notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_main_course(db, name, main_course_descr)\n db.execute(\"INSERT INTO main_course (name, main_course_descr) VALUES (?, ?)\", [name, main_course_descr])\nend",
"def add_to_database\n Partner.add({\"assignment_id\" => \"#{self.assignment_id}\", \"name_worked\" => \"#{self.name_worked}\"})\n end",
"def add_student(student_name, grade)\n if @roster[grade] == nil\n @roster[grade] = []\n end\n @roster[grade] << student_name\n end",
"def create\n @subject = Subject.new(subject_params)\n @user = current_user\n @subject.user = @user\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_subject\n @exam = session[:exam]\n if session[:exam].subject_id == nil\n session[:exam].subject_id = params[:subject][:id]\n end\n @indices = PlanSubject.find_unfinished_by_subject(\\\n session[:exam].subject_id, :indices => true)\n end",
"def add_symptom(db, symptom, date, time_of_day, severity)\n $db.execute(\"INSERT INTO symptoms (symptom, date, time_of_day, severity) VALUES (?, ?, ?, ?)\", [symptom, date, time_of_day, severity])\nend",
"def save_external_subject\n session[:exam].subject = @subject = Subject.find(params['subject']['id'])\n @exam = session[:exam]\n @plan_subject = PlanSubject.find_for_exam(@exam)\n end",
"def update_subject(school, instructor_name, new_subject)\n school[:instructors].collect do |instructor|\n if instructor[:name] == instructor_name\n instructor[:subject] = new_subject\n end\n end\nend",
"def subject_params\n params.require(:subject).permit(:name, :grade, :tutor_id)\n end",
"def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def create_forum_subject(contest)\n s = Subject.create(:contest => contest,\n :user_id => 0,\n :title => \"Concours ##{contest.number}\",\n :content => helpers.get_new_contest_forum_message(contest),\n :last_comment_time => DateTime.now,\n :last_comment_user_id => 0,\n :category => Category.where(:name => \"Mathraining\").first)\n end",
"def create\n @student_subject = StudentSubject.new(student_subject_params)\n\n respond_to do |format|\n if @student_subject.save\n format.html { redirect_to @student_subject, notice: 'Student subject was successfully created.' }\n format.json { render :show, status: :created, location: @student_subject }\n else\n format.html { render :new }\n format.json { render json: @student_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student\n @student = nil\n @portal_clazz = Portal::Clazz.find(params[:id])\n\n if params[:student_id] && (!params[:student_id].empty?)\n @student = Portal::Student.find(params[:student_id])\n end\n if @student\n @student.add_clazz(@portal_clazz)\n @portal_clazz.reload\n render :update do |page|\n page.replace_html 'students_listing', :partial => 'portal/students/table_for_clazz', :locals => {:portal_clazz => @portal_clazz}\n page.visual_effect :highlight, 'students_listing'\n page.replace_html 'student_add_dropdown', @template.student_add_dropdown(@portal_clazz)\n end\n else\n render :update do |page|\n # previous message was \"that was a total failure\"\n # this case should not happen, but if it does, display something\n # more friendly such as:\n # page << \"$('flash').update('Please elect a user from the list before clicking add button.')\"\n end\n end\n end",
"def new_student(list, name, grade, semester)\n\tlist.push( {:name => name, :grade => grade, :semester => semester} )\nend",
"def add_student(name, grade)\n @roster[grade] ||= []\n @roster[grade] << name\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @client.subjects << @subject\n flash[:notice] = 'Subject was successfully created.'\n format.html { redirect_to client_subject_url(@client, @subject) }\n format.xml { render :xml => @subject, :status => :created, :location => [@client, @subject] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:subject) #requires model subject and column subject\n end",
"def enroll(new_student) \n @students.push(new_student) \n end",
"def create\n @subject = Subject.new(subject_params)\n if @subject.save\n redirect_to(subjects_path)\n else\n render('new')\n end\n end",
"def change_subject(school, instructor_name2, new_subject)\n school[:instructors].each do |instructor|\n if instructor_name2 == instructor[:name]\n instructor[:subject] = new_subject\n puts \"#{instructor_name2}'s subject has been updated to #{new_subject}\"\n end\n end\nend",
"def create_new_student(student_name)\n object = controller_create(:student)\n fail format(\"Student '%s' not created.\", student_name) if object.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n student_name,\n object[:id]))\n object\n end",
"def add(list, student,group)\n list[student] = group\nend",
"def set_subject\n @subject = params[:id] ? Subject.find(params[:id]) : Subject.new(subject_params)\n end",
"def set_subject\n @subject = params[:id] ? Subject.find(params[:id]) : Subject.new(subject_params)\n end",
"def create\n @subject = current_user.subjects.where(project_id: @project.id).new(subject_params)\n if @subject.save\n redirect_to [@project, @subject], notice: \"Subject was successfully created.\"\n else\n render :new\n end\n end",
"def save\n # sql, and set it equal to the SQL statement that will INSERT the correct data into the table.\n sql = \"INSERT INTO students (name,grade) VALUES (?,?)\"\n DB[:conn].execute(sql,@name,@grade)\n # you do need to grab the ID of the last inserted row, i.e. the row you just inserted into the database,\n # and assign it to the be the value of the @id attribute of the given instance.\n sql=\"SELECT id FROM students WHERE name = (?)\"\n id = DB[:conn].execute(sql,@name)\n # puts \"***********id#{id[0][0]}\"\n @id=id[0][0]\n end",
"def add_student(student_name, grade)\n if @roster.has_key?(grade)\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def add_students\n @course = Course.find(params[:id])\n to_add = params[:to_be_added]\n if to_add\n\t\t\tnot_added = []\n to_add.each do |stu_id, do_it|\n if do_it == \"yes\"\n student = Student.find(stu_id)\n\t\t\t\t\tif not @course.add_student(student)\n\t\t\t\t\t\t not_added << student.name\n\t\t\t\t\tend\n end\n end\n end\n\t\tif not not_added.empty?\n\t\t\tflash[:notice] = \"Students has already joined this course:\" + not_added.join(\",\")\n\t\tend\n\t\tredirect_to students_admin_course_path(@course)\n end",
"def student_subject_params\n params.require(:student_subject).permit(:subject_id, :student_id)\n end",
"def add_teacher(teacher)\n CourseTeachingAssignment.create :user_id => teacher.id, :course_id => self.id\n end",
"def subject_params\n params.require(:subject).permit(:name, :course_id)\n end",
"def set_subject\r\n @subject = Subject.find(params[:id])\r\n end",
"def test_associate_courses_students_03\n timmy = CourseStudent.create(id: 1)\n horsies = Course.create(name: \"Are horsies pretty?\", course_code: \"ABC 123\")\n horsies.course_students << timmy\n assert_equal 1, Course.count\n horsies.destroy\n assert_equal 1, Course.count\n end",
"def create\n @thesis = Thesis.new(thesis_params)\n\n# this adds the thesis created to the logged-in user\n @student.theses << @thesis\n\n if @thesis.save\n redirect_to(theses_path, notice: \"The thesis #{@thesis.title} has been uploaded.\")\n else\n render \"new\"\n end\n end",
"def adding_students\n if params[:students_id] == nil\n session[:error] =\"You have to select one or more students.\"\n hasError = 1\n else\n params[:students_id].each{|t|\n student_aux =Student.find(t)\n @student_class.students << student_aux\n }\n end \n end",
"def create\n\t\t@subject = Subject.new(subject_params)\n\n\t\trespond_to do |format|\n\t\t\tif @subject.save\n\t\t\t\tcreate_audit __method__, 'subject', @subject.id\n\t\t\t\tformat.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @subject }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @subject.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def add_student(name, grade)\n\t\tif @roster.key?(grade)\n\t\t\t@roster[grade] << name\n\t\telse \n\t\t\t@roster[grade]= []\n\t\t\troster[grade] << name\n\t\tend\n\tend",
"def add_student(student_name, grade)\n roster[grade] ||= []\n roster[grade] << student_name\n end",
"def set_subject\n @subject = Subject.find params[:subject_id]\n end",
"def create\n @subject_item = SubjectItem.new(tutor_id: @tutor.id, subject_id: subject_item_params[:subject_id])\n\n respond_to do |format|\n if @subject_item.save\n format.html { redirect_to @tutor, notice: 'Subject was successfully added.' }\n format.json { render :show, status: :created, location: @subject_item }\n else\n format.html { render :new }\n format.json { render json: @subject_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enroll(new_student)\n @students.push(new_student)\n end",
"def subject_params\n params[:subject].permit(:name, :user_id, :user)\n end",
"def add_employee(employee)\n subject = Subject.new(\n administrator_id: id,\n employee_id: employee.id\n )\n subject.save ? true : false\n end",
"def set_subject\n @subject = Subject.find(params[:subject_id])\n end"
] | [
"0.74211407",
"0.7257415",
"0.7249954",
"0.71419096",
"0.7114764",
"0.70805085",
"0.7029817",
"0.69931626",
"0.693987",
"0.69269323",
"0.692504",
"0.68591183",
"0.67597145",
"0.66752774",
"0.6672282",
"0.6646676",
"0.6644185",
"0.6618015",
"0.6579783",
"0.65795845",
"0.65648353",
"0.6537008",
"0.65360695",
"0.64646804",
"0.6448104",
"0.6418874",
"0.6364962",
"0.6364962",
"0.6328933",
"0.6326998",
"0.63247204",
"0.63182414",
"0.6305566",
"0.6302068",
"0.6294921",
"0.6288388",
"0.62873805",
"0.6238055",
"0.62305856",
"0.6212338",
"0.62108237",
"0.6209337",
"0.61951244",
"0.61860824",
"0.61745256",
"0.6152476",
"0.6147591",
"0.61054254",
"0.6104949",
"0.61036456",
"0.6084771",
"0.6077143",
"0.60699904",
"0.60605353",
"0.60557514",
"0.603818",
"0.60050344",
"0.60048777",
"0.60028666",
"0.6001056",
"0.5998295",
"0.59913707",
"0.5986727",
"0.5983026",
"0.5982419",
"0.59756404",
"0.5960425",
"0.5930807",
"0.59268045",
"0.5922259",
"0.59099394",
"0.59092677",
"0.5898545",
"0.58872354",
"0.5871739",
"0.5864014",
"0.5863905",
"0.5863905",
"0.58627856",
"0.58524084",
"0.58478963",
"0.5836617",
"0.5836617",
"0.5835259",
"0.58323586",
"0.5815345",
"0.58059895",
"0.58040595",
"0.5797821",
"0.5792833",
"0.5788323",
"0.5784478",
"0.5778436",
"0.57645607",
"0.57601583",
"0.57543683",
"0.57535607",
"0.5749152",
"0.57469124",
"0.5745411"
] | 0.79847014 | 0 |
add_subject(db, "Math") add_subject(db, "English") add_subject(db, "Physics") add_subject(db, "Art") add_subject(db, "Chemistry") method to add a grade | def add_grade(database, student_id, subject_id, grade)
database.execute("INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)", [grade, student_id, subject_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end",
"def add_subject(database, name)\r\n\tdatabase.execute(\"INSERT INTO subjects (name) VALUES (?)\", [name])\r\nend",
"def add_student(student_name, student_grade)\n\t\tSCHOOL[:students] << {:name => student_name, :grade => student_grade}\n\tend",
"def update_grade(database, student, subject, grade)\r\n\tstudent_id = get_student_id(database, student)\r\n\tsubject_id = get_subject_id(database, subject)\r\n\tdatabase.execute(\"UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?\",[grade, student_id, subject_id])\r\nend",
"def addstudent(student, grade, semester, school)\n school[:students] << {name: student, grade: grade, semester: semester} \nend",
"def subject_grade_params(*extra_params)\n permitted = [:subject_id, :grade, :ects]\n extra_params.each { |param| permitted << param }\n params.require(:subject_grade).permit(permitted)\n end",
"def student_add\n\t\tname_array = name.split(\" \")\n\t\tname = Student.new(name_array[0], name_array[1])\n\t\tputs \"Enter course you would like to add.\"\n\t\tchoice = gets.chomp.downcase\n\t\tname.enroll(choice) if choice.is_a?(Course)\n\tend",
"def add_student(name, grade, semester)\n\t\tstudents.push( {:name => name, :grade => grade, :semester => semester} )\n\tend",
"def addstudent(name, grade, semester)\n\t\t@students.push(:name=>name, :grade=>grade, :semester=>semester)\n\tend",
"def subject_params\n params.require(:subject).permit(:name, :grade, :tutor_id)\n end",
"def grade_params\n params.require(:grade).permit(:cat1, :cat2, :cat3, :exam_id, :score, :grade, :subject_id)\n end",
"def add_student(name, grade)\n roster[grade]||=[]\n roster[grade] << name\n end",
"def add_student(name, grade)\r\n roster[grade] = [] unless roster[grade]\r\n roster[grade] << name\r\n end",
"def create\n @course = Course.find(params[:course_id])\n @grade = @course.grades.create(grade_params)\n if @course.save\n redirect_to @course,\n notice: ' Grade was added successfully.'\n else\n redirect_to @course,\n alert: 'Error creating grade.'\n end\n end",
"def add_student(name, grade)\n @roster[grade] ||= []\n @roster[grade] << name\n end",
"def add_student(student_name, grade)\n roster[grade] ||= []\n roster[grade] << student_name\n end",
"def add_student (name, grade)\n # @student_name = name\n # @grade = grade\n if @roster.include?(grade) \n @roster [grade] << name \n else\n @roster [grade] = [name]\n end\n end",
"def add_student(school, new_student_name, new_student_grade, new_student_semester)\n school[:students].push(:name => new_student_name, \n :grade => new_student_grade, :semester => new_student_semester)\nend",
"def add_grade (student, grade)\n if enrolled?(student)\n @grades[student] << grade\n return true # returns true\n else\n return false\n end\n end",
"def add_student(student, grade)\n @roster[grade] ||= []\n @roster[grade] << student\n # binding.pry\n end",
"def add_student(name, grade)\n #check if empty\n if roster[grade] != nil\n roster[grade] << name\n else\n roster[grade] = [name]\n end\n end",
"def add_student(name, grade)\r\n if @roster[grade] != nil \r\n @roster[grade] << name\r\n else\r\n @roster[grade] = [name]\r\n end\r\n end",
"def add_student(student_name, grade)\n if @roster[grade] == nil\n @roster[grade] = []\n end\n @roster[grade] << student_name\n end",
"def grade(student_name)\n frm.table(:class=>\"listHier lines nolines\").row(:text=>/#{Regexp.escape(student_name)}/).link(:text=>\"Grade\").click\n frm.frame(:id, \"grade_submission_feedback_comment___Frame\").td(:id, \"xEditingArea\").frame(:index=>0).wait_until_present\n AssignmentSubmission.new(@browser)\n end",
"def grade(student_name)\n frm.table(:class=>\"listHier lines nolines\").row(:text=>/#{Regexp.escape(student_name)}/).link(:text=>\"Grade\").click\n frm.frame(:id, \"grade_submission_feedback_comment___Frame\").td(:id, \"xEditingArea\").frame(:index=>0).wait_until_present\n AssignmentSubmission.new(@browser)\n end",
"def add_student(name, grade)\n\t\tif @roster.key?(grade)\n\t\t\t@roster[grade] << name\n\t\telse \n\t\t\t@roster[grade]= []\n\t\t\troster[grade] << name\n\t\tend\n\tend",
"def add\n # variable scope\n # no student\nend",
"def add_student(name, grade, semester)\n\t\tstudents.push(Student.new(name, grade, semester))\n\tend",
"def update_subject(school, name, subject)\n\tschool[:instructors].each { |instructor| instructor[:subject] = subject if instructor[:name] == name}\nend",
"def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def add_student(name, grade)\n if roster.key?(grade) == false\n roster[grade] = [ ]\n roster[grade] << name \n else \n roster[grade] << name\n end \n end",
"def grade_params\n params.require(:grade).permit(:student_has_subject_id, :aplicar_parcial, :grade_type, :calificacion)\n end",
"def make_feedback_for_final_grade\n feedback = \"Final grade has been assigned for \"\n feedback += self.course.name + \"\\n\"\n end",
"def add_student(student_name, grade)\n if @roster.has_key?(grade)\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end",
"def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university\n end\n\n if self.surveys.count > 0\n add_student_to_course_surveys(student)\n end\n\n self.students << student\nend",
"def update_subject(instructor_name, new_subject)\n\t\tSCHOOL[:instructors].each do |hash|\n\t\t\thash[:subject]=new_subject if hash[:name]==instructor_name\n\t\tend\n\tend",
"def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def grade(assignment_name)\n frm.table(:class=>\"listHier lines nolines\").row(:text=>/#{Regexp.escape(assignment_name)}/).link(:text=>\"Grade\").click\n AssignmentSubmissionList.new(@browser)\n end",
"def submit_new_course\r\n @school = School.find(params[:nid]) rescue render_return\r\n render_return unless @user_supported_schools.include_schools?(@school)\r\n render_return unless logged_in_user.can_add_more_course(@school)\r\n #status = logged_in_user.is_admin? ? :approved : :pending \r\n status = :pending\r\n if params[:s1].to_i > 0\r\n subject = @school.subjects.find(params[:s1]) rescue render_return\r\n else\r\n s = Subject.new(:code=>params[:s_code].to_s,:name=>params[:s_name].to_s)\r\n s.before_save\r\n subject = @school.subjects.find(:first,:conditions=>[\"code LIKE ?\",s.code]) \r\n unless subject \r\n subject = Subject.new(:code=>s.code,:name=>s['name'],\r\n :creator_id=>logged_in_user.id,\r\n :status=>status)\r\n \r\n render_return unless subject.before_save\r\n @school.subjects << subject \r\n end\r\n end\r\n \r\n c = Course.new(:name=>params[:cname],:number=>params[:cnum])\r\n course = @school.courses.find(:first,:conditions=>[\"subject_code LIKE '#{subject.code}' AND number LIKE ? \",c.number])\r\n render_return if course\r\n course = Course.new(:subject_id=>subject.id,\r\n :creator_id=>logged_in_user.id,\r\n :subject_code=>subject.code,\r\n :number => c.number,\r\n :name=> c.name,\r\n :status=>status)\r\n\r\n render_return unless c.before_save\r\n @school.courses << course \r\n render_p \"course_display/list_subjects\",{'caller'=>params[:caller],'subjects'=>@school.subjects.reload,'subject'=>subject}\r\n \r\n end",
"def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend",
"def gradeQuestion(studentAns, keyAns )\n # Value of correctness\n score = 0\n if studentAns == keyAns then\n score = 1\n end\n score\n end",
"def grade(assignment_name)\n assignment_row(assignment_name).link(:text=>\"Grade\").click\n AssignmentSubmissionList.new(@browser)\n end",
"def create\n @subject = current_user.subjects.new(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: \"已成功创建学生账户:#{@subject.title}. \"}\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_test(test, student_first, student_last, grade)\n db.execute(\"INSERT INTO #{test} (student_first, student_last, grade) VALUES (?, ?, ?);\", [student_first, student_last, grade])\nend",
"def post\n # Make sure cid belongs to user\n if check_id(params[:cid])\n flash[:danger] = \"Try not to post in places that doesn't belong to you\"\n return redirect_to '/'\n end\n\n @grade = Grade.new(:courseItem => params[:courseItem],\n :worth => params[:worth],\n :mark => params[:mark],\n :courseMark => \"%.2f\" % (params[:worth].to_f*(params[:mark].to_f/100)),\n :subject_id => params[:cid])\n\n #Data Validation - Blank values\n if !@grade.valid?\n flash[:danger] = \"Please Input Valid Values\"\n return redirect_to '/'\n elsif @grade.save\n update_subject_grade(Grade.where(subject_id: params[:cid]), params[:cid])\n return redirect_to action: \"show\",\n id:params[:cid]\n else\n flash[:warning] = \"A Random Bug Occured, Please Try Again\"\n return redirect_to '/'\n end\n end",
"def add_student(student_name, grade)\n # roster[grade] = [] # ...first: create the new key and point it to an empty array\n roster[grade] ||= [] # add multiple students to a grade & add students to different grades using ||=\n roster[grade] << student_name # ...then: push the new value into that array\n end",
"def grade_params\n params.require(:grade).permit(:student_id, :assignment_id, :score)\n end",
"def add_student(student, grade_level)\n roster[grade_level] ||= []\n roster[grade_level] << student \n end",
"def test_course_students_associated_with_assignment_grades\n cs = CourseStudent.create()\n ag = AssignmentGrade.create()\n cs.assignment_grades << ag\n assert_equal [ag], CourseStudent.find(cs.id).assignment_grades\n end",
"def add_to_database\n Partner.add({\"assignment_id\" => \"#{self.assignment_id}\", \"name_worked\" => \"#{self.name_worked}\"})\n end",
"def exam_subject_params\n params.require(:exam_subject).permit({ exam_subject: [:subject_id, :exam_id, :max_marks, :pass_marks, :written_marks, :assessment_marks]})\n end",
"def create\n\t\t@grade = Grade.new(params[:grade])\n\t\t@grade.assignment_id = params[:assignment_id]\n\t\t@grade.user_id = @current_user.id\n\t\t\n\t\tLogsController.createGrade(@current_user, @grade)\n\n\t\trespond_to do |format|\n\t\t\t# For fast grades (:commit == \"Save\") redirect to the course page\n\t\t\tif params[:commit] == \"Save\" && @grade.save\n\t\t\t\tformat.html { redirect_to course_path(@assignment.course), notice: 'Grade was successfully created.' }\n\t\t\telsif @grade.save\n\t\t\t\tformat.html { redirect_to assignment_path(@assignment), notice: 'Grade was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\tend\n\t\tend\n\tend",
"def gradeQuestion(studentAns, keyAns )\n # Value of correctness\n score = 0\n if( studentAns == keyAns ) then\n score = 1\n end\n score\n end",
"def grade_params\n params.require(:grade).permit(:assignment_name, :grade, :student_id, :teacher_id)\n end",
"def change_subject(school, instructor_name2, new_subject)\n school[:instructors].each do |instructor|\n if instructor_name2 == instructor[:name]\n instructor[:subject] = new_subject\n puts \"#{instructor_name2}'s subject has been updated to #{new_subject}\"\n end\n end\nend",
"def save_subject\n @exam = session[:exam]\n if session[:exam].subject_id == nil\n session[:exam].subject_id = params[:subject][:id]\n end\n @indices = PlanSubject.find_unfinished_by_subject(\\\n session[:exam].subject_id, :indices => true)\n end",
"def subject_params\n params.require(:subject).permit(:name, :course_id)\n end",
"def add(name, grade)\n rosters[grade] <<= name\n end",
"def grade_params\n params.require(:grade).permit(:activity_id, :section_id, :student_id, :teacher_id, :score)\n end",
"def create_students (db, name, essay_1, essay_2, midterm_1, midterm_2)\n\tdb.execute(\"INSERT INTO students (name, essay_1, essay_2, midterm_1, midterm_2) VALUES (?, ?, ?, ?, ?)\", [name, essay_1, essay_2, midterm_1, midterm_2])\nend",
"def add_student (name,grade)\n if @roster[grade] == nil\n @roster[grade] = []\n @roster[grade] << name\n else \n @roster[grade] << name\n end \nend",
"def set_grade\n #@student_course = StudentCourse.find(params[:id])\n end",
"def create\n @course = Course.find(params[:course_id])\n #@grade = Grade.new(params[:grade])\n end",
"def add_student\n course_id = params[:course_id]\n requires({'role' => ['admin','faculty'],'course_id'=>course_id})\n first = params[:first]\n last = params[:last]\n email = params[:email]\n role = params[:role]\n \n \n course = Course.find(course_id)\n\n student = User.find_by_email(email)\n unless student\n student = create_and_invite_user(first, last, email, 'student')\n end\n\n unless student\n render :text => 'Error adding student.'\n else\n if role == 'student'\n StudentInCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'Student added successfully.'\n elsif role == 'ta'\n TaForCourse.create(:user_id => student.id, :course_id => course.id)\n render :text => 'TA added successfully.'\n end\n end\n end",
"def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade].push(student_name)\n else\n #if not present, create the key and empty array value and add \n #the student name to it\n @roster[grade] = []\n @roster[grade].push(student_name)\n end\n end",
"def add_student(person)\n c = CoursePerson.new type: \"student\"\n c.person = person\n self.course_person << c\n self.save \n end",
"def addstudent(newname, schoolvar)\n\tschoolvar[:students]<<{:name=>newname}\nend",
"def grade\n @grade\n end",
"def subject_params\n params.require(:subject).permit(:result_no, :generate_no, :e_no, :slash, :thrust, :stroke, :shot, :guard, :dance, :theft, :cooking, :technology, :movement, :chemistry, :arithmetic, :fire, :theology, :life, :demonology, :geography, :astronomy, :fengshui, :psychology, :music, :curse, :illusion, :trick)\n end",
"def create\n @grade = Grade.new(grade_params)\n if @grade.save\n flash[:success] = \"Grade was successfully created\"\n redirect_to grades_path\n else\n flash[:errors] = @grade.errors.full_messages.join(' ')\n redirect_to grades_path\n end\n end",
"def update_subject(school, instructor_name, new_subject)\n school[:instructors].collect do |instructor|\n if instructor[:name] == instructor_name\n instructor[:subject] = new_subject\n end\n end\nend",
"def subject_params\n params.require(:subject).permit(:subject) #requires model subject and column subject\n end",
"def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend",
"def criterion_grade_params\n params.require(:criterion_grade).permit(:score, :student_id, :criterion_id, :assessment_id)\n end",
"def create\n respond_to do |format|\n if ExamSubject.create(exam_subject_params[:exam_subject])\n format.html { redirect_to exams_path, notice: 'Exam marks saved.' }\n else\n format.html { render :new }\n end\n end\n end",
"def add_student(student_name, student_grade)\n# pp @roster\n \n if roster[student_grade]\n roster[student_grade] << student_name\n else\n roster[student_grade] = []\n roster[student_grade] << student_name\n end\n\n# roster[grade] name\n end",
"def grade(*args)\n process_using(*args.unshift(:grade))\n end",
"def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend",
"def set_subject(subject)\n\t\tend",
"def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end",
"def create\n @grade = Grade.find(params[:grade_id])\n @course = @grade.courses.build(course_params)\n if @course.save\n redirect_to grade_courses_path(@grade, @courses), notice: 'Successfully Created Course'\n else\n render action: 'new'\n end\n end",
"def create\n @subject = Subject.new(params[:subject])\n @subject_types = SubjectType.select_list\n respond_to do |format|\n if @subject.save\n format.html { redirect_to(admin_subject_path(@subject), :notice => 'Subject was successfully created.') }\n format.xml { render :xml => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def grade_params\n params.require(:grade).permit(:student_id, :course_id, :value)\n end",
"def add_teacher(first, last, campus, veracross, email)\n puts(\"Adding #{first} #{last} #{campus} #{veracross} #{email}\")\n Student.create(\n first_name: first,\n last_name: last,\n campus: campus,\n veracross_id: veracross,\n email: email,\n teacher: true\n )\nend",
"def initialize(student)\n @number_grade = set_number_grade(student)\n @letter_grade = set_letter_grade\n end",
"def mod\n # get the grade params\n grade_params = Hash.new\n params.each{ |key, value|\n begin\n key = key.to_i\n if key.kind_of?(Fixnum) && key != 0\n grade_params[key] = value\n end\n rescue Error\n # ignore\n end\n }\n grade_params.each{ |key,value|\n as = AssignmentsStudents.find(key.to_i)\n as.grade = value\n as.save\n } \n redirect_to :action => 'index', :controller => 'assignments_students'\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n if ind2 == '7'\n sfs << ['2', subject['source']]\n end\n\n # add authority ID as subject 6xx $0\n authority_id = subject['authority_id']\n subfield_0 = authority_id ? [0, authority_id] : nil\n sfs.push(subfield_0) unless subfield_0.nil?\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def grade_params\n params.require(:grade).permit(:name, :score, :total, :weight)\n end",
"def create_forum_subject(contest)\n s = Subject.create(:contest => contest,\n :user_id => 0,\n :title => \"Concours ##{contest.number}\",\n :content => helpers.get_new_contest_forum_message(contest),\n :last_comment_time => DateTime.now,\n :last_comment_user_id => 0,\n :category => Category.where(:name => \"Mathraining\").first)\n end",
"def add_addition(statement)\n if statement.subject != @subject_of_change\n raise \"Subject of statement must match subject of change of changeset\"\n end\n @additions << statement\n end",
"def create_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_GRADEBOOKITEMS_GRADE % [user_id, course_id, gradebook_item_id]\r\n post(relative_url, grade)\r\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def grade(*args)\n process_using(*args.unshift(:grade))\n end",
"def subject_params\n params.require(:subject).permit(:subjectName, :startWeek, :semester_id, :field_id, :year)\n end",
"def create\n hasError = 0\n @subject = Subject.new(params[:subject])\n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\"\n hasError = 1\n else\n if @subject.save\n params[:teachers_id].each{|t|\n teacher_aux =Teacher.find(t)\n @subject.teachers << teacher_aux\n }\n CustomLogger.debug(\"Subject created\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject= Subject.new\n end\n end\n restore_lists\n end",
"def add_student( student )\n CourseRegistration.create :user_id => student.id, :course_id => self.id\n end",
"def create_main_course(db, name, main_course_descr)\n db.execute(\"INSERT INTO main_course (name, main_course_descr) VALUES (?, ?)\", [name, main_course_descr])\nend",
"def report_card\n puts self.get_gpa\n grades = self.registrations.includes(:course)\n # puts \"Your grades for each class are as follows:\\n\"\n tp grades, {\"Subject\" => {:display_method => lambda{|x| x.course.subject}}}, {\"Grades\" => {:display_method => lambda{|x| numeric(x.grade)}}}\n end",
"def grade_params\n params.require(:grade).permit(:score, :verify)\n end"
] | [
"0.67687356",
"0.65627533",
"0.6485465",
"0.6350736",
"0.626064",
"0.61422634",
"0.613574",
"0.60928875",
"0.6089411",
"0.6088551",
"0.6086325",
"0.60766816",
"0.6043076",
"0.60364455",
"0.601754",
"0.60110974",
"0.6000983",
"0.593063",
"0.59266424",
"0.58940816",
"0.5888349",
"0.58844066",
"0.58632904",
"0.5838922",
"0.5838922",
"0.58201003",
"0.58161664",
"0.58097625",
"0.58083355",
"0.58016896",
"0.57776225",
"0.576733",
"0.5764063",
"0.57605237",
"0.57315266",
"0.57311827",
"0.5728829",
"0.57161516",
"0.571075",
"0.56911916",
"0.5685092",
"0.5674548",
"0.565904",
"0.56507874",
"0.5642533",
"0.56423974",
"0.5638584",
"0.56342894",
"0.56205446",
"0.56171656",
"0.56135315",
"0.5610789",
"0.56105447",
"0.560351",
"0.55994934",
"0.5592769",
"0.55781794",
"0.5568325",
"0.555426",
"0.5549062",
"0.5548016",
"0.55460405",
"0.5537745",
"0.5506737",
"0.5504699",
"0.55016625",
"0.5491393",
"0.54912066",
"0.5464926",
"0.5461401",
"0.5460099",
"0.54577506",
"0.5449137",
"0.5439496",
"0.54363894",
"0.54295594",
"0.5427135",
"0.54252356",
"0.542161",
"0.54134166",
"0.5395954",
"0.5386418",
"0.53795123",
"0.5374382",
"0.537369",
"0.5367215",
"0.536601",
"0.5365022",
"0.53567505",
"0.5353389",
"0.5350404",
"0.53459704",
"0.53414494",
"0.53396845",
"0.53387654",
"0.5338439",
"0.5330912",
"0.53272057",
"0.53152",
"0.53001046"
] | 0.7312546 | 0 |
add_grade(db, 1, 1, 80) method to update a grade | def update_grade(database, student, subject, grade)
student_id = get_student_id(database, student)
subject_id = get_subject_id(database, subject)
database.execute("UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?",[grade, student_id, subject_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend",
"def update_grade\n grade_entry_form = record\n grade_entry_student =\n grade_entry_form.grade_entry_students.find(params[:student_id])\n grade =\n grade_entry_student.grades.find_or_create_by(grade_entry_item_id: params[:grade_entry_item_id])\n\n grade.update(grade: params[:updated_grade])\n grade_entry_student.save # Refresh total grade\n grade_entry_student.reload\n render plain: grade_entry_student.get_total_grade\n end",
"def change_grade(new_grade)\n @grade = new_grade\nend",
"def update_grade\n grade_entry_form = GradeEntryForm.find(params[:id])\n grade_entry_student =\n grade_entry_form.grade_entry_students.find(params[:student_id])\n grade =\n grade_entry_student.grades.find_or_create_by(grade_entry_item_id: params[:grade_entry_item_id])\n\n grade.update(grade: params[:updated_grade])\n grade_entry_student.save # Refresh total grade\n grade_entry_student.reload\n render plain: grade_entry_student.total_grade\n end",
"def alter\n authorize! :update, AssignmentGrade\n error = false\n\n if !params.has_key?(:grade) || !params.has_key?(:userid) || !params.has_key?(:assignment)\n error = true\n \n else\n @agrade = AssignmentGrade.find_by_user_assignment(params[:userid], params[:assignment])\n\n if(!@agrade)\n @agrade = AssignmentGrade.new();\n @agrade.user_id = params[:userid]\n @agrade.assignment_id=params[:assignment]\n else\n end\n @agrade.grade_value=params[:grade]\n @agrade.comment=params[:comment]\n\n # Sanitize the incoming grade - check grade value\n #if @attendance != nil && Constants::Attendance::List.include?(params[:attendance].to_i)\n #@attendance.attendance = params[:attendance].to_i\n #else\n #error = true\n #end\n end\n\n if(@agrade!=nil)\n\t respond_to do |format|\n\t if @agrade.save\n\t\t format.html {redirect_to assignment_grades_path(:assignment => params[:assignment])}\n\t else\n\t\tformat.html { redirect_to alter_assignment_grades, :notice => 'Invalid grade parameters.' }\n\t end\n\t end\n else\n redirect_to assignment_grades_path and return\n end\n end",
"def update_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_GRADEBOOKITEMS_GRADE % [user_id, course_id, gradebook_item_id]\r\n put(relative_url, grade)\r\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\n end",
"def mod\n # get the grade params\n grade_params = Hash.new\n params.each{ |key, value|\n begin\n key = key.to_i\n if key.kind_of?(Fixnum) && key != 0\n grade_params[key] = value\n end\n rescue Error\n # ignore\n end\n }\n grade_params.each{ |key,value|\n as = AssignmentsStudents.find(key.to_i)\n as.grade = value\n as.save\n } \n redirect_to :action => 'index', :controller => 'assignments_students'\n end",
"def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def add_grade (student, grade)\n if enrolled?(student)\n @grades[student] << grade\n return true # returns true\n else\n return false\n end\n end",
"def update\n @grade = Grade.find(params[:id])\n if @grade.update_attributes(params[:grade])\n respond_to do |format|\n format.html { redirect_to \"/assignments/#{@grade.assignment_id}/show\" } unless @grade.graded\n format.json { head :ok }\n end\n end\n end",
"def store_grades gpa, gpa_percent\n ActiveRecord::Base.connection_pool.with_connection do \n gpa_percent = gpa_percent.merge({'gpa'=>gpa})\n gpa_percent = gpa_percent.to_json\n @repo.update(gpa: gpa_percent)\n end\n end",
"def update_grade(student)\n # Set homeroom grade level to be first student's grade level, since\n # we don't have any crosswalk between homerooms and grades in\n # Somerville's Student Information System\n\n return if self.grade.present?\n return if student.grade.blank?\n\n update_attribute(:grade, student.grade)\n end",
"def update\n if @grade.save\n flash[:success] = \"Grade was successfully updated\"\n redirect_to grades_path\n else\n flash[:errors] = @grade.errors.full_messages.join(' ')\n redirect_to grades_path\n end\n end",
"def grade(*args)\n process_using(*args.unshift(:grade))\n end",
"def grade(*args)\n process_using(*args.unshift(:grade))\n end",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\nend",
"def grade_params\n params.require(:grade).permit(:number, :grade)\n end",
"def update\n # check if there is an existing assignment\n form = record\n if form.nil?\n render 'shared/http_status', locals: { code: '404', message:\n 'Grade Entry Form not found' }, status: :not_found\n return\n end\n\n ApplicationRecord.transaction do\n update_params = params.permit(*DEFAULT_FIELDS)\n unless form.update(update_params)\n render 'shared/http_status', locals: { code: '500', message:\n form.errors.full_messages.first }, status: :internal_server_error\n raise ActiveRecord::Rollback\n end\n\n position = form.grade_entry_items.count\n params[:grade_entry_items]&.each do |column_params|\n if column_params[:id].nil?\n column_params = column_params.permit(:name, :out_of, :bonus).to_h.symbolize_keys\n grade_item = form.grade_entry_items.build(**column_params, position: position += 1)\n unless grade_item.save\n render 'shared/http_status', locals: { code: '500', message:\n grade_item.errors.full_messages.first }, status: :internal_server_error\n raise ActiveRecord::Rollback\n end\n else\n column_params = column_params.permit(:id, :name, :out_of, :bonus).to_h.symbolize_keys\n grade_item = form.grade_entry_items.where(id: column_params[:id]).first\n if grade_item.nil?\n render 'shared/http_status', locals: { code: '404', message:\n \"Grade Entry Item with id=#{column_params[:id]} not found\" }, status: :not_found\n raise ActiveRecord::Rollback\n end\n unless grade_item.update(column_params)\n render 'shared/http_status', locals: { code: '500', message:\n grade_item.errors.full_messages.first }, status: :internal_server_error\n raise ActiveRecord::Rollback\n end\n end\n end\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok\n end\n end",
"def update_gradebook_item_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOKITEMS_GRADE % [user_id,\r\n course_id,\r\n gradebook_item_id]\r\n put(relative_url, grade)\r\n end",
"def update\n\t\t@grade = Grade.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\t# For fast grades (:commit == \"Save\") redirect to the course page\n\t\t\tif params[:commit] == \"Save\" && @grade.update_attributes(params[:grade])\n\t\t\t\tLogsController.updateGrade(@current_user, @grade)\n\n\t\t\t\tformat.html { redirect_to course_path(@assignment.course), notice: 'Grade was successfully updated.' }\n\t\t\telsif @grade.update_attributes(params[:grade])\n\t\t\t\tformat.html { redirect_to assignment_path(@assignment), notice: 'Grade was successfully updated.' }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\tend\n\t\tend\n\tend",
"def grade_params\n params.require(:grade).permit(:student_id, :assignment_id, :score)\n end",
"def set_grade\n @grade = Grade.where(section_id: params[:section_id])\n end",
"def create_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_GRADEBOOKITEMS_GRADE % [user_id, course_id, gradebook_item_id]\r\n post(relative_url, grade)\r\n end",
"def set_grade\n #@student_course = StudentCourse.find(params[:id])\n end",
"def grade_params\n params.require(:grade).permit(:student_id, :course_id, :value)\n end",
"def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(student_name, student_grade)\n\t\tSCHOOL[:students] << {:name => student_name, :grade => student_grade}\n\tend",
"def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end",
"def add(name, grade)\n rosters[grade] <<= name\n end",
"def create\n @course = Course.find(params[:course_id])\n @grade = @course.grades.create(grade_params)\n if @course.save\n redirect_to @course,\n notice: ' Grade was added successfully.'\n else\n redirect_to @course,\n alert: 'Error creating grade.'\n end\n end",
"def grade_params\n params.require(:grade).permit(:name, :score, :total, :weight)\n end",
"def grade_params\n params.require(:grade).permit(:user_id, :grade, :course_id, :lesson_id, :lesson_module_id)\n end",
"def set_final_grade\n @final_grade = FinalGrade.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade_params\n params.require(:grade).permit(:activity_id, :section_id, :student_id, :teacher_id, :score)\n end",
"def update\n DB[:conn].execute(\"UPDATE students SET name = ? WHERE id = ?\", @name, @id)\n DB[:conn].execute(\"UPDATE students SET grade = ? WHERE id = ?\", @grade, @id)\n end",
"def create_gradebook_item_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOKITEMS_GRADE % [user_id, course_id, gradebook_item_id]\r\n post(relative_url, grade)\r\n end",
"def grade\n @grade\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to grades_path, notice: '成功編輯新的年級' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade_params\n params.require(:grade).permit(:assignment_name, :grade, :student_id, :teacher_id)\n end",
"def add_student(name, grade)\r\n roster[grade] = [] unless roster[grade]\r\n roster[grade] << name\r\n end",
"def grade_params\n params.require(:grade).permit(:score, :verify)\n end",
"def update\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @grade\n @portal_grade = Portal::Grade.find(params[:id])\n\n respond_to do |format|\n if @portal_grade.update_attributes(params[:portal_grade])\n flash[:notice] = 'Grade was successfully updated.'\n format.html { redirect_to(@portal_grade) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @portal_grade.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @default_grade_denominator = args[:default_grade_denominator] if args.key?(:default_grade_denominator)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def add_to_test(test, student_first, student_last, grade)\n db.execute(\"INSERT INTO #{test} (student_first, student_last, grade) VALUES (?, ?, ?);\", [student_first, student_last, grade])\nend",
"def edit\n\t\t@grade = Grade.find_by_assignment_id_and_user_id(@assignment.id, @current_user.id)\n\tend",
"def add_student(student, grade)\n @roster[grade] ||= []\n @roster[grade] << student\n # binding.pry\n end",
"def set_member_grade\n @member_grade = MemberGrade.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to [\"cal\",@grade], notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(name, grade)\n roster[grade]||=[]\n roster[grade] << name\n end",
"def grade_params\n params.require(:grade).permit(:project_id, :student_id, :projectGrade)\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to student_grades_path, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_average_grade\n @average_grade = AverageGrade.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(name, grade)\n @roster[grade] ||= []\n @roster[grade] << name\n end",
"def grade\n \tquiz = Quiz.new(params[:quiz])\n \tquiz.grade\n \tcurrent_user.update_attribute(:has_passed_quiz, quiz.passed?)\n end",
"def save\n if @id\n DB[:conn].execute(\"update students set name = ? where id = ?\", @name,@id)\n DB[:conn].execute(\"update students set grade = ? where id = ?\", @grade,@id)\n else\n DB[:conn].execute(\"insert into students (name,grade) values( ?,? )\",@name,@grade)\n @id=DB[:conn].execute(\"select last_insert_rowID() from students\")[0][0]\n end\n end",
"def update_grade_entry_students\n if params[:students].blank?\n flash_message(:warning, I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n grade_entry_form = record\n release = params[:release_results] == 'true'\n GradeEntryStudent.transaction do\n data = record.course\n .students\n .joins(:grade_entry_students)\n .where('grade_entry_students.assessment_id': grade_entry_form.id,\n 'grade_entry_students.id': params[:students])\n .pluck('grade_entry_students.id', 'roles.id')\n .map { |ges_id, r_id| { id: ges_id, role_id: r_id, released_to_student: release } }\n GradeEntryStudent.upsert_all(data)\n num_changed = data.length\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n action = release ? 'released' : 'unreleased'\n log_message = \"#{action} #{num_changed} for marks spreadsheet '#{grade_entry_form.short_identifier}'.\"\n MarkusLogger.instance.log(log_message)\n rescue StandardError => e\n flash_message(:error, e.message)\n raise ActiveRecord::Rollback\n end\n GradeEntryStudent.where(id: params[:students]).includes(:role).each do |current_student|\n if current_student.role.receives_results_emails?\n NotificationMailer.with(student: current_student, form: grade_entry_form, course: current_course)\n .release_spreadsheet_email.deliver_later\n end\n end\n end\n end",
"def add_student(student_name, grade)\n roster[grade] ||= []\n roster[grade] << student_name\n end",
"def grade_params\n params.require(:grade).permit(:student_has_subject_id, :aplicar_parcial, :grade_type, :calificacion)\n end",
"def update\n @course = Course.find(@grade.course_id)\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @course, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @average_grade.update(average_grade_params)\n format.html { redirect_to @average_grade, notice: 'Average grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @average_grade }\n else\n format.html { render :edit }\n format.json { render json: @average_grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_student(school, new_student_name, new_student_grade, new_student_semester)\n school[:students].push(:name => new_student_name, \n :grade => new_student_grade, :semester => new_student_semester)\nend",
"def grade_book_params\n params.require(:grade_book).permit(:modified_grade_value)\n end",
"def update\n respond_to do |format|\n if @final_grade.update(final_grade_params)\n format.html { redirect_to @final_grade, notice: 'Final grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @final_grade }\n else\n format.html { render :edit }\n format.json { render json: @final_grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade(student_grade)\n roster[student_grade]\n end",
"def update\n @studentgrade = Studentgrade.find(params[:id])\n\n respond_to do |format|\n if @studentgrade.update_attributes(params[:studentgrade])\n format.html { redirect_to @studentgrade, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentgrade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade) VALUES (?, ?)\n SQL\n\n DB[:conn].execute(sql, @name, @grade)\n @id = DB[:conn].execute('SELECT last_insert_rowid() FROM students')[0][0]\n self\n end",
"def create\n\t\t@grade = Grade.new(params[:grade])\n\t\t@grade.assignment_id = params[:assignment_id]\n\t\t@grade.user_id = @current_user.id\n\t\t\n\t\tLogsController.createGrade(@current_user, @grade)\n\n\t\trespond_to do |format|\n\t\t\t# For fast grades (:commit == \"Save\") redirect to the course page\n\t\t\tif params[:commit] == \"Save\" && @grade.save\n\t\t\t\tformat.html { redirect_to course_path(@assignment.course), notice: 'Grade was successfully created.' }\n\t\t\telsif @grade.save\n\t\t\t\tformat.html { redirect_to assignment_path(@assignment), notice: 'Grade was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\tend\n\t\tend\n\tend",
"def add_student (name, grade)\n # @student_name = name\n # @grade = grade\n if @roster.include?(grade) \n @roster [grade] << name \n else\n @roster [grade] = [name]\n end\n end",
"def update\n respond_to do |format|\n if @member_grade.update(member_grade_params)\n format.html { redirect_to @member_grade, notice: 'Member grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_grade }\n else\n format.html { render :edit }\n format.json { render json: @member_grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_modifiers(grade, completed, flash)\n\t\n\t\t\tif completed == true\n\t\t\t\tif flash == true\n\t\t\t\t\t\tgrade *= 1.5\n\t\t\t\telse\n\t\t\t\t\tgrade\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tgrade *= 0.25\n\t\t\tend\n\t\t\tgrade\n\t\tend",
"def set_pay_grade\r\n @pay_grade = PayGrade.find(params[:id])\r\n end",
"def add_student(student, grade_level)\n roster[grade_level] ||= []\n roster[grade_level] << student \n end",
"def addstudent(name, grade, semester)\n\t\t@students.push(:name=>name, :grade=>grade, :semester=>semester)\n\tend",
"def add_student(name, grade)\r\n if @roster[grade] != nil \r\n @roster[grade] << name\r\n else\r\n @roster[grade] = [name]\r\n end\r\n end",
"def save\n if self.id\n self.update\n else\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n # This method also assigns the id attribute of the object once the row has\n # been inserted into the database.\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end\n end",
"def add_student(name, grade, semester)\n\t\tstudents.push( {:name => name, :grade => grade, :semester => semester} )\n\tend",
"def add_student(name, grade)\n if roster.key?(grade) == false\n roster[grade] = [ ]\n roster[grade] << name \n else \n roster[grade] << name\n end \n end",
"def grade!\n # default method does nothing and leaves a score of 0\n end",
"def grade_params\n params.require(:grade).permit(:cat1, :cat2, :cat3, :exam_id, :score, :grade, :subject_id)\n end",
"def add_student(name, grade)\n\t\tif @roster.key?(grade)\n\t\t\t@roster[grade] << name\n\t\telse \n\t\t\t@roster[grade]= []\n\t\t\troster[grade] << name\n\t\tend\n\tend",
"def save\n if self.id\n self.update\n else\n sql_insert = 'INSERT INTO students (name, grade) VALUES (?, ?)'\n DB[:conn].execute(sql_insert, @name, @grade)\n\n sql_select_last = 'SELECT last_insert_rowid() FROM students'\n @id = DB[:conn].execute(sql_select_last)[0][0]\n end\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def add_to_income(db, user_name, dolla_dolla_bills_yall)\r\n\tnew_income_total = (dolla_dolla_bills_yall.to_i + current_income(db, user_name))\r\n\tchange_income = '\r\n\tUPDATE users \r\n\r\n\tSET actual_income = ?\r\n\tWHERE name = ?'\r\n\tdb.execute(change_income, [new_income_total, user_name])\r\nend",
"def update_score\n \t\tuser.score += 10\n user.save\n\tend",
"def set_grade_calc\n @grade_calc = GradeCalc.find(params[:id])\n end",
"def set_pay_grade\n @paygrade = PayGrade.find(params[:id])\n end",
"def grade(student_grade)\n roster[student_grade]\nend",
"def set_pay_grade\n @pay_grade = PayGrade.find(params[:id])\n end",
"def add_student(student_name, grade)\n # roster[grade] = [] # ...first: create the new key and point it to an empty array\n roster[grade] ||= [] # add multiple students to a grade & add students to different grades using ||=\n roster[grade] << student_name # ...then: push the new value into that array\n end"
] | [
"0.7757418",
"0.70768535",
"0.70141536",
"0.6971177",
"0.6917739",
"0.6823761",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6644402",
"0.66316",
"0.66285104",
"0.66190195",
"0.6585793",
"0.6584383",
"0.65841913",
"0.6547775",
"0.65057826",
"0.6505209",
"0.64552534",
"0.6450467",
"0.6433163",
"0.64189255",
"0.63991183",
"0.6370484",
"0.63697577",
"0.63677824",
"0.6351289",
"0.6321689",
"0.6302152",
"0.62930965",
"0.62714595",
"0.6269619",
"0.62222004",
"0.6213233",
"0.61898285",
"0.6153253",
"0.6136384",
"0.6126841",
"0.6115726",
"0.61121285",
"0.60937077",
"0.60904413",
"0.60789585",
"0.60771984",
"0.60740256",
"0.6066501",
"0.6066192",
"0.6059974",
"0.6056367",
"0.6051939",
"0.6042848",
"0.6028299",
"0.60188425",
"0.6015553",
"0.6010806",
"0.60039455",
"0.6002369",
"0.5996667",
"0.59884804",
"0.59829867",
"0.5964732",
"0.59617704",
"0.5955728",
"0.5951209",
"0.5942434",
"0.5942355",
"0.5935168",
"0.59169203",
"0.59145087",
"0.59118205",
"0.590379",
"0.58995855",
"0.58946174",
"0.589355",
"0.5891022",
"0.5885623",
"0.5882801",
"0.5873165",
"0.5872125",
"0.58660024",
"0.5857021",
"0.5846031",
"0.5845011",
"0.5844734",
"0.5842933",
"0.5839203",
"0.5837636",
"0.5837116",
"0.5825502",
"0.5819871",
"0.5816281",
"0.5812024",
"0.5809482",
"0.58041936"
] | 0.7691302 | 1 |
update_grade(db, 1, 1, 75) method to get student id | def get_student_id(database, name)
student = database.execute("SELECT * FROM students WHERE name=?",[name])
student_id = student[0][0].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_grade(database, student, subject, grade)\r\n\tstudent_id = get_student_id(database, student)\r\n\tsubject_id = get_subject_id(database, subject)\r\n\tdatabase.execute(\"UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?\",[grade, student_id, subject_id])\r\nend",
"def update_grade\n grade_entry_form = record\n grade_entry_student =\n grade_entry_form.grade_entry_students.find(params[:student_id])\n grade =\n grade_entry_student.grades.find_or_create_by(grade_entry_item_id: params[:grade_entry_item_id])\n\n grade.update(grade: params[:updated_grade])\n grade_entry_student.save # Refresh total grade\n grade_entry_student.reload\n render plain: grade_entry_student.get_total_grade\n end",
"def set_grade\n #@student_course = StudentCourse.find(params[:id])\n end",
"def update_grade(student)\n # Set homeroom grade level to be first student's grade level, since\n # we don't have any crosswalk between homerooms and grades in\n # Somerville's Student Information System\n\n return if self.grade.present?\n return if student.grade.blank?\n\n update_attribute(:grade, student.grade)\n end",
"def update_grade\n grade_entry_form = GradeEntryForm.find(params[:id])\n grade_entry_student =\n grade_entry_form.grade_entry_students.find(params[:student_id])\n grade =\n grade_entry_student.grades.find_or_create_by(grade_entry_item_id: params[:grade_entry_item_id])\n\n grade.update(grade: params[:updated_grade])\n grade_entry_student.save # Refresh total grade\n grade_entry_student.reload\n render plain: grade_entry_student.total_grade\n end",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\n end",
"def save\n if @id\n DB[:conn].execute(\"update students set name = ? where id = ?\", @name,@id)\n DB[:conn].execute(\"update students set grade = ? where id = ?\", @grade,@id)\n else\n DB[:conn].execute(\"insert into students (name,grade) values( ?,? )\",@name,@grade)\n @id=DB[:conn].execute(\"select last_insert_rowID() from students\")[0][0]\n end\n end",
"def save\n if self.id\n self.update\n else\n sql_insert = 'INSERT INTO students (name, grade) VALUES (?, ?)'\n DB[:conn].execute(sql_insert, @name, @grade)\n\n sql_select_last = 'SELECT last_insert_rowid() FROM students'\n @id = DB[:conn].execute(sql_select_last)[0][0]\n end\n end",
"def grade_for_course(course)\n course_students.find_by(course_id: course).grade\n end",
"def grade(student_grade)\n roster[student_grade]\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def set_grade\n @grade = Grade.find(params[:id])\n end",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\nend",
"def update\n DB[:conn].execute(\"UPDATE students SET name = ? WHERE id = ?\", @name, @id)\n DB[:conn].execute(\"UPDATE students SET grade = ? WHERE id = ?\", @grade, @id)\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade) \n VALUES (?, ?)\n SQL\n \n DB[:conn].execute(sql, self.name, self.grade)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name,grade)\n VALUES (?,?)\n SQL\n DB[:conn].execute(sql,self.name,self.grade)\n @id = DB[:conn].execute(\n \"SELECT last_insert_rowid() FROM students\")[0][0]\n end",
"def student_id\r\n\t\t\t \t51771125.51772509\r\n\t\t end",
"def save\n # sql, and set it equal to the SQL statement that will INSERT the correct data into the table.\n sql = \"INSERT INTO students (name,grade) VALUES (?,?)\"\n DB[:conn].execute(sql,@name,@grade)\n # you do need to grab the ID of the last inserted row, i.e. the row you just inserted into the database,\n # and assign it to the be the value of the @id attribute of the given instance.\n sql=\"SELECT id FROM students WHERE name = (?)\"\n id = DB[:conn].execute(sql,@name)\n # puts \"***********id#{id[0][0]}\"\n @id=id[0][0]\n end",
"def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend",
"def update\n @studentgrade = Studentgrade.find(params[:id])\n\n respond_to do |format|\n if @studentgrade.update_attributes(params[:studentgrade])\n format.html { redirect_to @studentgrade, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentgrade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n\n DB[:conn].execute(sql, self.name, self.grade)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end",
"def update_grade_entry_students\n if params[:students].blank?\n flash_message(:warning, I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n grade_entry_form = record\n release = params[:release_results] == 'true'\n GradeEntryStudent.transaction do\n data = record.course\n .students\n .joins(:grade_entry_students)\n .where('grade_entry_students.assessment_id': grade_entry_form.id,\n 'grade_entry_students.id': params[:students])\n .pluck('grade_entry_students.id', 'roles.id')\n .map { |ges_id, r_id| { id: ges_id, role_id: r_id, released_to_student: release } }\n GradeEntryStudent.upsert_all(data)\n num_changed = data.length\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n action = release ? 'released' : 'unreleased'\n log_message = \"#{action} #{num_changed} for marks spreadsheet '#{grade_entry_form.short_identifier}'.\"\n MarkusLogger.instance.log(log_message)\n rescue StandardError => e\n flash_message(:error, e.message)\n raise ActiveRecord::Rollback\n end\n GradeEntryStudent.where(id: params[:students]).includes(:role).each do |current_student|\n if current_student.role.receives_results_emails?\n NotificationMailer.with(student: current_student, form: grade_entry_form, course: current_course)\n .release_spreadsheet_email.deliver_later\n end\n end\n end\n end",
"def save_student_profile(id)\n student = id\n end",
"def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade) VALUES (?, ?)\n SQL\n\n DB[:conn].execute(sql, @name, @grade)\n @id = DB[:conn].execute('SELECT last_insert_rowid() FROM students')[0][0]\n self\n end",
"def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def grade(student_grade)\n roster[student_grade]\nend",
"def save\n if self.id\n self.update\n else\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n # This method also assigns the id attribute of the object once the row has\n # been inserted into the database.\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end\n end",
"def update_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_GRADEBOOKITEMS_GRADE % [user_id, course_id, gradebook_item_id]\r\n put(relative_url, grade)\r\n end",
"def update\n @grade = Grade.find(params[:id])\n if @grade.update_attributes(params[:grade])\n respond_to do |format|\n format.html { redirect_to \"/assignments/#{@grade.assignment_id}/show\" } unless @grade.graded\n format.json { head :ok }\n end\n end\n end",
"def update_grade_entry_students\n if params[:students].blank?\n flash_message(:warning, I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n grade_entry_form = GradeEntryForm.find_by_id(params[:id])\n release = params[:release_results] == 'true'\n GradeEntryStudent.transaction do\n GradeEntryStudent.upsert_all(params[:students].map { |id| { id: id, released_to_student: release } })\n num_changed = params[:students].length\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n action = release ? 'released' : 'unreleased'\n log_message = \"#{action} #{num_changed} for marks spreadsheet '#{grade_entry_form.short_identifier}'.\"\n MarkusLogger.instance.log(log_message)\n rescue StandardError => e\n flash_message(:error, e.message)\n raise ActiveRecord::Rollback\n end\n GradeEntryStudent.where(id: params[:students]).includes(:user).each do |current_student|\n if current_student.user.receives_results_emails?\n NotificationMailer.with(student: current_student, form: grade_entry_form)\n .release_spreadsheet_email.deliver_later\n end\n end\n end\n end",
"def mod\n # get the grade params\n grade_params = Hash.new\n params.each{ |key, value|\n begin\n key = key.to_i\n if key.kind_of?(Fixnum) && key != 0\n grade_params[key] = value\n end\n rescue Error\n # ignore\n end\n }\n grade_params.each{ |key,value|\n as = AssignmentsStudents.find(key.to_i)\n as.grade = value\n as.save\n } \n redirect_to :action => 'index', :controller => 'assignments_students'\n end",
"def set_member_grade\n @member_grade = MemberGrade.find(params[:id])\n end",
"def edit\n\t\t@grade = Grade.find_by_assignment_id_and_user_id(@assignment.id, @current_user.id)\n\tend",
"def save\n if self.id\n self.update\n else\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end\nend",
"def set_grade\n @grade = Grade.where(section_id: params[:section_id])\n end",
"def student_grade(student_name)\n\t\tSCHOOL[:students].each do |hash|\n\t\t\treturn hash[:grade] if hash[:name]==student_name\n\t\tend\n\tend",
"def update\n\t\t@grade = Grade.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\t# For fast grades (:commit == \"Save\") redirect to the course page\n\t\t\tif params[:commit] == \"Save\" && @grade.update_attributes(params[:grade])\n\t\t\t\tLogsController.updateGrade(@current_user, @grade)\n\n\t\t\t\tformat.html { redirect_to course_path(@assignment.course), notice: 'Grade was successfully updated.' }\n\t\t\telsif @grade.update_attributes(params[:grade])\n\t\t\t\tformat.html { redirect_to assignment_path(@assignment), notice: 'Grade was successfully updated.' }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\tend\n\t\tend\n\tend",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n #select last inserted row and assign it to be the value of the @id attribute of the given instance\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end",
"def change_grade(new_grade)\n @grade = new_grade\nend",
"def update_student(id, fields)\n list = query_student(:id => id)\n list[0].merge(fields) if list.length == 1\n save_data\n end",
"def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade(grade)\n @roster[grade]\n end",
"def grade(grade)\n @roster[grade]\n end",
"def grade(grade)\n @roster[grade]\n end",
"def grade(grade)\r\n @roster[grade]\r\n end",
"def get_student_grade(number)\n self.grades.each do |key, range|\n if range.include?(number)\n return key\n end\n end\n return \"NA\"\n end",
"def grade(grade)\n\t\t@roster[grade]\n\tend",
"def grade\n @grade\n end",
"def set_final_grade\n @final_grade = FinalGrade.find(params[:id])\n end",
"def check_student (db, student_name, final_student)\n\tputs db.execute(\"SELECT * FROM students WHERE name=?;\", [student_name])\n\tputs \"Final Grade: #{final_student[student_name]}\"\nend",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to student_grades_path, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_staff_grade\n @staff_grade = StaffGrade.find(params[:id])\n end",
"def set_average_grade\n @average_grade = AverageGrade.find(params[:id])\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?,?)\n SQL\n\n DB[:conn].execute(sql, self.name, self.grade)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\nend",
"def get_grade(school, name) \n\t\t\t grade = nil\n school[:students].each do |student|\n if student[:name] == name\n grade = student[:grade]\n end\n end\n return grade\nend",
"def set_grade_book\n #@grade_book = LessonModule.find(params[:id])\n #@course = Course.find(params[:course_id])\n end",
"def update\n @student_grade_personality = StudentGradePersonality.find(params[:id])\n\n respond_to do |format|\n if @student_grade_personality.update_attributes(params[:student_grade_personality])\n flash[:notice] = 'StudentGradePersonality was successfully updated.'\n format.html { redirect_to :action => 'by_student', :id => @student_grade_personality.student.id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_grade_personality.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def set_pay_grade\r\n @pay_grade = PayGrade.find(params[:id])\r\n end",
"def update\n if @grade.save\n flash[:success] = \"Grade was successfully updated\"\n redirect_to grades_path\n else\n flash[:errors] = @grade.errors.full_messages.join(' ')\n redirect_to grades_path\n end\n end",
"def set_pay_grade\n @pay_grade = PayGrade.find(params[:id])\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def alter\n authorize! :update, AssignmentGrade\n error = false\n\n if !params.has_key?(:grade) || !params.has_key?(:userid) || !params.has_key?(:assignment)\n error = true\n \n else\n @agrade = AssignmentGrade.find_by_user_assignment(params[:userid], params[:assignment])\n\n if(!@agrade)\n @agrade = AssignmentGrade.new();\n @agrade.user_id = params[:userid]\n @agrade.assignment_id=params[:assignment]\n else\n end\n @agrade.grade_value=params[:grade]\n @agrade.comment=params[:comment]\n\n # Sanitize the incoming grade - check grade value\n #if @attendance != nil && Constants::Attendance::List.include?(params[:attendance].to_i)\n #@attendance.attendance = params[:attendance].to_i\n #else\n #error = true\n #end\n end\n\n if(@agrade!=nil)\n\t respond_to do |format|\n\t if @agrade.save\n\t\t format.html {redirect_to assignment_grades_path(:assignment => params[:assignment])}\n\t else\n\t\tformat.html { redirect_to alter_assignment_grades, :notice => 'Invalid grade parameters.' }\n\t end\n\t end\n else\n redirect_to assignment_grades_path and return\n end\n end",
"def update\n @course = Course.find(@grade.course_id)\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @course, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pay_grade\n @paygrade = PayGrade.find(params[:id])\n end",
"def assignment_score(grade_hash, student, assignment_num)\n score = grade_hash[student][assignment_num - 1]\nend",
"def displayed_grade\n (grade * 4 + 1).to_i\n end",
"def get_grade(school,name)\n school[:students].each { |student|\n if student[:name] == name\n return student[:grade]\n end\n }\nend",
"def update\n #Validation - Check if course id and grade id belongs to user\n if check_id(params[:cid],params[:id])\n flash[:danger] = \"Try not to edit data that does not belong to you\"\n return redirect_to '/'\n end\n\n #Get the grade active record that needs editing\n grade = Grade.where(:id => params[:id], :subject_id => params[:cid]).first\n\n #Edit active record\n grade.courseItem = params[:courseItem]\n grade.worth = params[:worth]\n grade.mark = params[:mark]\n grade.courseMark = \"%.2f\" % (params[:worth].to_f*(params[:mark].to_f/100))\n grade.subject_id = params[:cid]\n\n #Data Validation\n if !grade.valid?\n flash[:danger] = \"Please Input Valid Values\"\n return redirect_to '/'\n elsif grade.save\n update_subject_grade(Grade.where(subject_id: params[:cid]), params[:cid])\n return redirect_to action:\"show\", id:params[:cid]\n else\n flash[:warning] = \"A Random Bug Occursed, Please Try Again\"\n return redirect_to '/'\n end\n end",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_gradebook_item_grade(user_id, course_id, gradebook_item_id, grade)\r\n relative_url = Path::USERS_COURSES_GRADEBOOKITEMS_GRADE % [user_id,\r\n course_id,\r\n gradebook_item_id]\r\n put(relative_url, grade)\r\n end",
"def update\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @grade\n @portal_grade = Portal::Grade.find(params[:id])\n\n respond_to do |format|\n if @portal_grade.update_attributes(params[:portal_grade])\n flash[:notice] = 'Grade was successfully updated.'\n format.html { redirect_to(@portal_grade) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @portal_grade.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize Student\n @user = User.find_by_email(@student.email)\n # if student_params['education'] == 'Undergraduate'\n # student_params[:student][:max_books] = 2\n # elsif student_params['education'] == 'Masters'\n # student_params[:student][:max_books] = 4\n # else\n # student_params[:student][:max_books] = 6\n # end\n\n respond_to do |format|\n if @student.update(student_params)\n @user.update({email:@student.email})\n\n maxbooks_cnt=0\n # update max_books here\n education = @student.education\n if education == 'Undergraduate'\n maxbooks_cnt = 2\n elsif education == 'Masters'\n maxbooks_cnt = 4\n else\n maxbooks_cnt = 6\n end\n\n # fire update query here\n @student.update(max_books: maxbooks_cnt)\n\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade(grade)\n @roster[grade]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n return grade_hash[student][assignment_num-1]\nend",
"def grade(student, school)\n school[:students].each do |s|\n return s[:grade] if s[:name] == student\n end\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num-1]\nend",
"def set_student_grader\n @grader = current_student.graders.find(params[:id])\n end",
"def grade_status(student)\n\tif student[:grade] == \"F\"\n\t\t\"failed\"\n\telse\n\t\t\"passed\"\n\tend\nend",
"def set_gradework\n @gradework = Gradework.find(params[:id])\n end",
"def set_gradework\n @gradework = Gradework.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_grades(student, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#a. create method to return student's grade\n\tschool[:students].each do |s|\n\t\tputs s[:grade] if s[:name] == student\n\tend\nend",
"def set_student\n @student = current_school.students.find(params[:id])\n end",
"def grade_average(school_id,user_id)\n results = Assignment.find_by_sql([\"\n SELECT (sum(grades.grade * assignments.weight)/sum(assignments.weight)) AS total\n FROM assignments\n LEFT JOIN grades ON (assignments.id = grades.assignment_id)\n WHERE assignments.school_id=? and grades.user_id=?\n GROUP BY grades.user_id\",school_id,user_id])\n grade = results[0]['total'].to_i unless results.count == 0\n pending = \"pending\"\n return grade || pending\n end",
"def user_grade(user)\n\t\t\n\t\tgrade = Grade.where(:assignment_id => self.id, :user_id => user.id).first\n\t\t\n\t\tif grade\n\t\t\treturn grade.grade\n\t\tend\n\tend"
] | [
"0.7777008",
"0.7150516",
"0.7108687",
"0.7021364",
"0.7018361",
"0.69828594",
"0.6969169",
"0.6856364",
"0.6833396",
"0.67951024",
"0.6773907",
"0.6773907",
"0.6773907",
"0.6773907",
"0.6773907",
"0.6773907",
"0.6773907",
"0.6773907",
"0.67475665",
"0.6730361",
"0.6674328",
"0.6656881",
"0.66529685",
"0.6644679",
"0.6620349",
"0.66040987",
"0.66034704",
"0.6598318",
"0.6548377",
"0.6542352",
"0.6530349",
"0.6529568",
"0.6517538",
"0.6495493",
"0.6479305",
"0.6454582",
"0.6431263",
"0.64272785",
"0.6418576",
"0.64142084",
"0.64007974",
"0.6385015",
"0.6380593",
"0.6372067",
"0.63589025",
"0.6336475",
"0.6282638",
"0.62541527",
"0.62524384",
"0.6218454",
"0.6218454",
"0.6218454",
"0.6212415",
"0.620018",
"0.6197459",
"0.6189816",
"0.61825085",
"0.61775804",
"0.61536497",
"0.6135757",
"0.61209625",
"0.60810924",
"0.6077292",
"0.60747963",
"0.607402",
"0.60584307",
"0.6054588",
"0.6051551",
"0.60486114",
"0.60436267",
"0.6041712",
"0.6030268",
"0.6018403",
"0.60175496",
"0.6016596",
"0.601543",
"0.59866005",
"0.5982003",
"0.59586054",
"0.59586054",
"0.59586054",
"0.59586054",
"0.59586054",
"0.5946314",
"0.5942082",
"0.5941392",
"0.5924521",
"0.591298",
"0.5910895",
"0.5907213",
"0.58953583",
"0.5890404",
"0.5885754",
"0.58839935",
"0.58839935",
"0.58655995",
"0.58352274",
"0.5833534",
"0.58289033",
"0.5822662"
] | 0.6109993 | 61 |
p get_student_id(db, "Bob") method to get subject id | def get_subject_id(database, name)
subject = database.execute("SELECT * FROM subjects WHERE name=?",[name])
subject_id = subject[0][0].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def get_student_id(database, name)\r\n\tstudent = database.execute(\"SELECT * FROM students WHERE name=?\",[name])\r\n\tstudent_id = student[0][0].to_i\r\nend",
"def subject_id\n raise ArgumentError, \"#subject_id not implemented for #{self.class}\"\n end",
"def student_id\r\n\t\t\t \t51771125.51772509\r\n\t\t end",
"def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollment_code\n end",
"def student_id\n \tregisterable.class.name == \"Student\" ? registerable.id : nil\n end",
"def find_student\n Student.find(params[:id])\n end",
"def subject(instructor, school)\n school[:instructors].each do |i|\n return i[:subject] if i[:name] == instructor\n end\nend",
"def current_student\n Student.find_by({id: session[:student_id]})\nend",
"def get_subject\n @subject = Subject.find_by_id(params[:id])\n return if check_nil_object(@subject)\n end",
"def set_student_subject\n @student_subject = StudentSubject.find(params[:id])\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def id\n self.subject\n end",
"def id\n self.subject\n end",
"def find_student(student_surname)\n Student.find(student_surname)\n end",
"def id\n @id ||= \"#{student.id}-#{lesson_part.id}\"\n end",
"def plain_text_student_id\n @student_id.to_s + \"|\" + utc_date_time;\n end",
"def find_student\n @student = Student.find(params[:id])\n end",
"def student?\n student_id?\n end",
"def education_user_id\n teacher.nil? ? student.external_id : teacher.external_id\n end",
"def get_subject\n @pcp_subject = PcpSubject.find( params[ :pcp_subject_id ])\n end",
"def subject_name\n return @subject_name\n end",
"def generate_subjectid\n\t\tsubjectids = ( (1..999999).to_a - StudySubject.select('subjectid'\n\t\t\t).collect(&:subjectid).collect(&:to_i) )\n\t\tsprintf(\"%06d\",subjectids[rand(subjectids.length)].to_i)\n\tend",
"def subject_name\n subject_full_name\n end",
"def get_subject\n\t\tend",
"def subject(subject_id, project_id: nil)\n query = {}\n query[:project_id] = project_id if project_id\n\n response = panoptes.get(\"/subjects/#{subject_id}\", query)\n if response.fetch('subjects', []).count > 1\n raise StandardError, 'Unexpectedly many subjects returned'\n end\n\n response.fetch('subjects', []).fetch(0, nil)\n end",
"def find_subject(name)\n self.subjects.each { |subject|\n if subject.name == name\n return subject\n end\n }\n return nil\n end",
"def students\n Student.conn.exec(\"SELECT * FROM students WHERE squad_id = ($1)\", [id])\n end",
"def display_subjects(database)\r\n\tsubjects = database.execute(\"SELECT * FROM subjects\")\r\n\tsubjects.each do |subject|\r\n\t\tputs \"ID: #{subject[0]} Subject: #{subject[1]}\"\r\n\tend\r\nend",
"def get_subject2\n @subject = Subject.find_by_id(params[:subject_id])\n return if check_nil_object(@subject)\n end",
"def first_student_by_index\n return STUDENT_NAMES[0]\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def find_or_create_preallowed_id\n # first lets see if such seubject already eixst to avoid dups\n preallowed_id = Client.find(CLIENT_ID).get(:subject_id_from_name, :subject_name => login)\n \n if preallowed_id != nil and preallowed_id != \"0\"\n return preallowed_id\n end\n \n #otherwise create a new one\n subject = Subject.create(:name => self.login)\n return subject.id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id()\n return @id\n end",
"def get_students\n StudentInCourse.where(:course_id => id).collect(&:user_id)\n end",
"def case_subject\n\t\t( matchingid.blank? ) ? nil : StudySubject.cases.with_matchingid(matchingid).first\n\tend",
"def get_subject(school, instructor_name)\n school[:instructors].each do |instructor|\n if instructor_name == instructor[:name]\n puts instructor[:subject]\n end\n end\nend",
"def subject_name\n subject&.name\n end",
"def save_student_profile(id)\n student = id\n end",
"def find_user_id (db, user)\n user_values = db.execute(\"SELECT id FROM user WHERE name = ?\", [user])\n user_values[0][0]\nend",
"def student_name()\n return @student_name\nend",
"def get_matching_students\n\t\tstudent\n\tend",
"def reg_id\n @reg_id ||= StudentResource.find_by_system_key(system_key, false)\n end",
"def student_name\n student = Student.find_by_admission_no(admission_no)\\\n if type == 'Student'\n student.first_name + ' ' + student.last_name\n end",
"def student_name\n return @name\n end",
"def getId jid\n\t\tuser = @users.read [\"id\"], [\"jid\", jid]\n\t\tif user.count > 0\n\t\t\tuser[0]['id']\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_student\n student = Student.find(params[:id])\n end",
"def find_student(student_name)\n\tputs \"Welcome back! Feel free to drink some Butterbeer!\"\nend",
"def check_student (db, student_name, final_student)\n\tputs db.execute(\"SELECT * FROM students WHERE name=?;\", [student_name])\n\tputs \"Final Grade: #{final_student[student_name]}\"\nend",
"def subjects_person\n get_item_data_by_name('SubjectPerson')\n end",
"def index\n @subject = Subject.find(params[:subject_id])\n \n end",
"def save\n # sql, and set it equal to the SQL statement that will INSERT the correct data into the table.\n sql = \"INSERT INTO students (name,grade) VALUES (?,?)\"\n DB[:conn].execute(sql,@name,@grade)\n # you do need to grab the ID of the last inserted row, i.e. the row you just inserted into the database,\n # and assign it to the be the value of the @id attribute of the given instance.\n sql=\"SELECT id FROM students WHERE name = (?)\"\n id = DB[:conn].execute(sql,@name)\n # puts \"***********id#{id[0][0]}\"\n @id=id[0][0]\n end",
"def subject_name\n subjects.any? ? subjects.first.name : nil\n end",
"def return_id\n\t\treturn @idStr\n\tend",
"def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend",
"def set_subject\r\n @subject = Subject.find(params[:id])\r\n end",
"def set_subject\n begin\n @subject = Subject.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid subject #{params[:id]}\"\n @subject_not_found = true\n render json: {message: \"Illegal subject access request\"}, status: :unauthorized\n return\n else\n @subject_not_found = false\n end\n end",
"def get_id()\n return @id\n end",
"def get_id\n\t\treturn id\n\tend",
"def current_subject_from_session\n return unless session[:subject_type].present? && session[:subject_id].present?\n\n session[:subject_type].constantize.find session[:subject_id]\n end",
"def is_person_a_student? (person_id)\r\n client = self.connect\r\n \r\n # escaping... you don't have do it for single quotes inside double quotes.\r\n db_sql = \"SELECT * \" +\r\n \"FROM person p \" +\r\n \"INNER JOIN role r ON r.id = p.role_id \" +\r\n \"WHERE r.name='student'\" +\r\n \"AND p.id=\" + person_id.to_s + \";\"\r\n #\"WHERE r.name=\\'teacher\\' \" +\r\n # \"AND p.id = \" + person_id.to_s + \";\"\r\n # puts db_sql\r\n result = client.query(db_sql)\r\n \r\n # close sql client.\r\n # might need to do this to allow more connections.\r\n client.close\r\n \r\n if result.count > 0\r\n return true\r\n else\r\n return false\r\n end\r\n \r\n #puts result.count.to_s\r\n #puts result\r\n #puts \"done....\"\r\n end",
"def return_id(db, user_name)\r\n\tretrieve_id = '\r\n\tSELECT id FROM users\r\n\tWHERE name = ?'\r\n\tid = db.execute(retrieve_id, [user_name])\r\nend",
"def set_subject\n\t\t\t@subject = Subject.find(params[:id])\n\t\tend",
"def personen_id(db,name,vorname)\n t = db.execute(\"SELECT id FROM personen WHERE name='\"+name+\n \"' AND vorname='\"+vorname+\"';\")\n if t==[] then\n return nil\n else\n return t[0][0]\n end\nend",
"def set_subject\n @subject = Subject.friendly.find(params[:id])\n end",
"def login_user\n student.user\n end",
"def student\n @student ||= Student.find_by_uic(uic)\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def questions\n # SELECT * FROM questions WHERE student_id = 2;\n DATABASE.execute(\"SELECT * FROM questions WHERE student_id = #{@id}\")\n end",
"def get_id(email)\n db_params = {\n host: ENV['host'],\n port: ENV['port'],\n dbname: ENV['dbname'],\n user: ENV['user'],\n password: ENV['password']\n }\n db = PG::Connection.new(db_params)\n user_id = db.exec(\"SELECT user_id FROM email WHERE email = '#{email}'\").values\n db.close\n user_id.flatten.first\nend",
"def show\n\n @subject = Subject.find(params[:id])\n\n end",
"def get_id(user_name)\n return get_value_of(user_name, :id)\n end",
"def subject\n title \n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def course_id_details\n a='id=? ' if Student.find(:all,:conditions=>['course_id=?',course_id]).map(&:id).uniq.count!=0\n 0.upto(Student.find(:all,:conditions=>['course_id=?',course_id]).map(&:id).uniq.count-2) do |l| \n a=a+'OR id=? '\n end \n return a unless course_id.blank?\n end",
"def show\n @subject = Subject.find(params[:id])\n end",
"def id(name, league_id)\n database do |db|\n # return 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"
] | [
"0.72265273",
"0.7163225",
"0.70819074",
"0.7021264",
"0.6876979",
"0.6489194",
"0.64713913",
"0.63267535",
"0.6314024",
"0.63004786",
"0.62624776",
"0.62099344",
"0.6209032",
"0.61056346",
"0.61007106",
"0.61007106",
"0.6090539",
"0.60806286",
"0.60690045",
"0.60500723",
"0.6027517",
"0.60213476",
"0.6011831",
"0.60079265",
"0.59903926",
"0.59352475",
"0.59271556",
"0.59114933",
"0.5903433",
"0.5900606",
"0.58693314",
"0.5858706",
"0.58495355",
"0.5847962",
"0.5847962",
"0.58455753",
"0.5837391",
"0.5837391",
"0.5837391",
"0.5837391",
"0.5825901",
"0.57933545",
"0.57840633",
"0.5783731",
"0.57760817",
"0.5769783",
"0.57593423",
"0.5734192",
"0.57315636",
"0.57195765",
"0.5714811",
"0.5692638",
"0.56899303",
"0.56748426",
"0.56748426",
"0.5673275",
"0.5655546",
"0.56368554",
"0.5634057",
"0.56323403",
"0.5631081",
"0.5616737",
"0.55984026",
"0.55946654",
"0.55857867",
"0.55842525",
"0.5583019",
"0.5566163",
"0.5565435",
"0.55650645",
"0.5563911",
"0.55605173",
"0.5559497",
"0.5558878",
"0.5552102",
"0.5545611",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5520632",
"0.5516458",
"0.5515488",
"0.5510851",
"0.5510404",
"0.55030584",
"0.5500957",
"0.54992837",
"0.54924804",
"0.5491521"
] | 0.77052814 | 0 |
p get_subject_id(db, "Math") method to display all students | def display_students(database)
students = database.execute("SELECT * FROM students")
students.each do |student|
puts "ID: #{student[0]} Name: #{student[1]}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'caller'=>params[:caller],'school'=>school}\r\n end",
"def display_subjects(database)\r\n\tsubjects = database.execute(\"SELECT * FROM subjects\")\r\n\tsubjects.each do |subject|\r\n\t\tputs \"ID: #{subject[0]} Subject: #{subject[1]}\"\r\n\tend\r\nend",
"def index\n @subject = Subject.find(params[:subject_id])\n \n end",
"def index\n @student_subjects = StudentSubject.all\n end",
"def index\n if(params[:subject]==nil)\n @sections = Section.all\n @sections = Section.find_by_sql(\"SELECT * FROM `sections`\njoin subjects\non subjects.id = subject_id\nwhere user_id = \n\" + session[:userid])\n else\n session[:subjectid]=params[:subject]\n \n \n @sections = Section.find(:all, :conditions=>\"subject_id = \"+params[:subject]+\" and user_id = \"+session[:userid])\n @subject = Subject.find(:all,:conditions=>\"id = \"+params[:subject])\n flash[:subjectname]=@subject[0].name \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def index\n logged_in\n if @current_user.teacher?\n @subjects = Subject.where(teacher_id: @current_user.id)\n elsif @current_user.student?\n @subjects = Subject.where(id: Relation.select(:subject_id).where(student_id: @current_user.id))\n else\n @subjects = Subject.all\n end\n end",
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end",
"def show\n\n @subject = Subject.find(params[:id])\n\n end",
"def get_students\n StudentInCourse.where(:course_id => id).collect(&:user_id)\n end",
"def set_student_subject\n @student_subject = StudentSubject.find(params[:id])\n end",
"def show\n @subject = Subject.find(params[:id])\n end",
"def get_subject_id(database, name)\r\n\tsubject = database.execute(\"SELECT * FROM subjects WHERE name=?\",[name])\r\n\tsubject_id = subject[0][0].to_i\r\nend",
"def index\n @thesubjects = Thesubject.all\n end",
"def index\n @mysubjects = Mysubject.all\n end",
"def subject_list\n list = []\n subjects.each { |subject| list << subject.name }\n list.to_sentence\n end",
"def list\n \n @lesson = Lesson.sorted.where(:subject_id => @subject.id) #@subjects= instance variable, Subject = Model name, subjects =table name\n # @subjects_list = Subject.all\n end",
"def subject_specialization\n mg_school_id=session[:current_user_school_id]\n # @examination_hod_logins=MdgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n examination_hod_logins=MgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n employee=MgEmployee.find_by(:id=>examination_hod_logins.mg_employee_id)\n subject=MgSubject.where(:is_deleted=>0, :mg_school_id=>mg_school_id, :mg_employee_specialization_id=>employee.hod_specialization_id)\n @subject_specialization=MgExamSubjectSpecializedEmployees.where(:is_deleted => 0, :mg_school_id=>session[:current_user_school_id], :mg_subject_id=>subject.pluck(:id)).paginate(page: params[:page], per_page: 10)\n \n end",
"def index\n @subjectms = Subjectm.all\n end",
"def student_ids\n ids = []\n scores_table = frm.table(:id=>\"editTotalResults:totalScoreTable\").to_a\n scores_table.delete_at(0)\n scores_table.each { |row| ids << row[1] }\n return ids\n end",
"def list_subjects(study_id)\n act = SubjectListAction.new(self)\n act.get(study_id)\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def show\n @user_subject = UserSubject.find(params[:id])\n end",
"def students\n Rollcall::Student.find_all_by_school_id schools\n end",
"def index\n @students = Student.where(:course_id => params[:course_id])\n end",
"def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end",
"def subject_id\n raise ArgumentError, \"#subject_id not implemented for #{self.class}\"\n end",
"def view_subject\n @programme_id = params[:programmeid]\n unless @programme_id.blank? \n @subjects = Subject.find(:all, :joins => :programmes,:conditions => ['programme_id=?', @programme_id])\n end\n render :partial => 'view_subject', :layout => false\n end",
"def index\n @subjects = Subject.all\n \n end",
"def index\n @course_subjects = CourseSubject.all\n end",
"def show\n \n id = params[:id].to_i\n \n if id == 0\n @subject = Subject.find_by_subject(params[:id])\n else \n @subject = Subject.find(params[:id])\n end\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @subjects = Subject.all\n end",
"def index\n @subjects = Subject.all\n end",
"def show\n\n @student = Student.find(params[:id])#search_stdId(params[:Id])\n\n end",
"def index\n set_enrolment\n if @enrolment\n @student_ids = @enrolment.student_ids\n else\n @student_ids = StudentId.all\n @notice = \"Displaying All Ids\"\n end\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def students\n Student.conn.exec(\"SELECT * FROM students WHERE squad_id = ($1)\", [id])\n end",
"def index\n @program_subjects = ProgramSubject.all\n end",
"def show\r\n authorize! :read, Subject\r\n @subject = Subject.where(id: params[:id]).first\r\n @books = BookTitle.where(subject_id: @subject).all.order(:title)\r\n end",
"def students\n self.course_person.all(:type => \"student\").persons\n end",
"def show\n if @current_user\n @students = Student.where.not(id: Relation.select(:student_id).where(subject_id: @subject.id))\n @inscrits = Student.where(id: Relation.select(:student_id).where(subject_id: @subject.id))\n else\n redirect_to request.referrer || root_path\n end\n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def student_id\r\n\t\t\t \t51771125.51772509\r\n\t\t end",
"def index\n #assemlbe a list of all the subjects\n # @subjects = Subject.all or\n @subjects = Subject.sorted #defined in lambda\n end",
"def index\n @user_subjects = UserSubject.all\n end",
"def index\n # puts \"params[:course][:id] is: #{params[:course][:id]}\"\n # @course = Course.find_by_id(params[:course][:id])\n# @students = @course.students\n end",
"def subject(instructor, school)\n school[:instructors].each do |i|\n return i[:subject] if i[:name] == instructor\n end\nend",
"def generate_subjectid\n\t\tsubjectids = ( (1..999999).to_a - StudySubject.select('subjectid'\n\t\t\t).collect(&:subjectid).collect(&:to_i) )\n\t\tsprintf(\"%06d\",subjectids[rand(subjectids.length)].to_i)\n\tend",
"def course_students\n return student_terms.find_all_by_term_type(\"Course\")\n end",
"def display_grades(database, name)\r\n\tstudent_id = get_student_id(database, name)\r\n\tdisplay_cmd= <<-SQL\r\n\t\tSELECT students.name, subjects.name, grades.grade\r\n\t\tFROM grades\r\n\t\t\tJOIN students\r\n\t\t\t\tON grades.student_id=students.id\r\n\t\t\tJOIN subjects\r\n\t\t\t\tON grades.subject_id=subjects.id\r\n\t\tWHERE student_id=?\r\n\tSQL\r\n\tdisplay = database.execute(display_cmd,[student_id])\r\n\tdisplay.each do |grade|\r\n\t\tputs \"#{grade[0]} scored a #{grade[2]} on #{grade[1]}.\"\r\n\tend\r\nend",
"def show\n\t\tcreate_audit __method__, 'subject', @subject.id\n\tend",
"def exam_data(subject)\n Exam.result(subject.id, id)\n end",
"def index\n @subjects_users = SubjectsUser.all\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def show_all_students\n Student.all\n end",
"def students \n sk = Sektion.where(:teacher_id => self.id).map(&:id)\n sids = StudentRoster.where(:sektion_id => sk).map(&:student_id).uniq\n return Student.where(:id => sids)\n end",
"def get_matching_students\n\t\tstudent\n\tend",
"def get_subject\n @subject = Subject.find_by_id(params[:id])\n return if check_nil_object(@subject)\n end",
"def guardian_students\n id=session[:user_id]\n @guardian=MgGuardian.find_by(:mg_user_id=>\"#{id}\")\n logger.info(\"=================================================\")\n logger.info(id)\n @sql = \"SELECT S.first_name ,S.last_name,S.admission_number, S.id from mg_students S,mg_guardians G ,mg_student_guardians M Where M.has_login_access=1 And M.mg_guardians_id = #{@guardian.id} And S.id = M.mg_student_id and G.id = M.mg_guardians_id\"\n\n @StudentListQuery=MgStudent.find_by_sql(@sql)\n\n render :layout => false\nend",
"def show\n @subject = @student.subject.find(params[:id])\n session[:setting] = \"\"\n end",
"def subject(subject_id, project_id: nil)\n query = {}\n query[:project_id] = project_id if project_id\n\n response = panoptes.get(\"/subjects/#{subject_id}\", query)\n if response.fetch('subjects', []).count > 1\n raise StandardError, 'Unexpectedly many subjects returned'\n end\n\n response.fetch('subjects', []).fetch(0, nil)\n end",
"def list\n @students= Student.all\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def find_student\n Student.find(params[:id])\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def index\n @q = Subject.search(params[:q])\n @subjects = @q.result(distinct: true).page(params[:page])\n end",
"def show\n @subject = Subject.find(params[:subject_id])\n @lessons = ClassJournal.where(subject: @subject, form: @pupil.form).first.lessons\n end",
"def index\n\t @search = Subject.search do\n\t\t\tfulltext params[:search]\n\t\t end\n\t\t@subjects = @search.results\n\t\t#@subjects = Subject.all\n\tend",
"def index\n @university_subjects = UniversitySubject.all\n end",
"def subjects_person\n get_item_data_by_name('SubjectPerson')\n end",
"def set_exam_subject\n @exam_subject = ExamSubject.find(params[:id])\n end",
"def index\n @subjects = Subject.all.sort_by { |m| m.name.downcase }\n @user = current_user\n end",
"def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end",
"def count_subjects\n Subject.count(:id)\n end",
"def save_subject\n @exam = session[:exam]\n if session[:exam].subject_id == nil\n session[:exam].subject_id = params[:subject][:id]\n end\n @indices = PlanSubject.find_unfinished_by_subject(\\\n session[:exam].subject_id, :indices => true)\n end",
"def index\n @subjects = subject_scope\n end",
"def show_subjects\n @kw_by_code_keys.each{|key|\t# Iterate thru tags in the same order we read them\n # For this instance (parent ID) of this tag...\n pid, tag = key\n\n h_tag = @kw_by_code[key]\n next unless h_tag['a']\n\n h_tag['a'].each{|s|\n subject = s.sub(/ *thesis *$/i, '')\t# Remove \"thesis\" from end of 695.a\n puts \" <meta tagcode=\\\"subjects.fixed1\\\">#{subject}</meta>\"\n }\n }\n end",
"def all_other_subject\n @user = User.find(params[:data])\n\n\n @all_other_subjects = @user.other_subject_assesses.order(\"id\")\n @title_groups_other_subjects = TitleGroupsOtherSubject.order(\"id\")\n\n render :layout => false\n end",
"def index\n if params[:student_id]\n @enrollments = Enrollment.where student_id: params[:student_id]\n @student = Student.find params[:student_id]\n else\n @enrollments = Enrollment.all\n end\n\n end",
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def index\n @school_cycle_has_subjects = SchoolCycleHasSubject.all\n end",
"def get_groups\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\tend\n\t\trender 'get_groups'\n\tend",
"def show\n\t\n\t@misses=Array.new\n\t@student.group.subjects.each do |subj|\n\t\ttmp=Array.new\n\t\t@student.misses.each do |miss|\n\t\t\tif Pair.find(miss.pair_id).subject==subj\n\t\t\t\ttmp << miss\n\t\t\tend\n\t\tend\n\t\t@misses << tmp\n\tend\n end",
"def index\n @tutor_subjects = TutorSubject.all\n end",
"def questions\n # SELECT * FROM questions WHERE student_id = 2;\n DATABASE.execute(\"SELECT * FROM questions WHERE student_id = #{@id}\")\n end",
"def index\n @subject_classes = SubjectClass.all\n end",
"def show\n @subject = get_subject\n end",
"def students\n users.students\n end",
"def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end",
"def show\n @manual_subject = Manual::Subject.find(params[:id])\n\n redirect_to manual_subject_laboratories_path(@manual_subject)\n end",
"def find_student\n @student = Student.find(params[:id])\n end",
"def student_index\n end",
"def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollment_code\n end",
"def show\n school_id = @student.school_id\n @course_selection = []\n @assigned_school = School.find(school_id)\n course_ids = @student.course_ids\n course_ids.each do |id|\n selection_unit = Course.find(id)\n @course_selection << selection_unit\n end\n end",
"def open_subject_id_form\n click_subject_buttons('Subject ID')\n end",
"def index\n @subject_items = SubjectItem.all\n end",
"def get_subject(school, instructor_name)\n school[:instructors].each do |instructor|\n if instructor_name == instructor[:name]\n puts instructor[:subject]\n end\n end\nend",
"def all_viewable_subjects\n Subject.current.where(site_id: all_viewable_sites.select(:id))\n end",
"def students\n users\n end"
] | [
"0.6959218",
"0.6828457",
"0.6642038",
"0.6640494",
"0.6523877",
"0.6490552",
"0.6389986",
"0.6362381",
"0.6354497",
"0.63431907",
"0.63132465",
"0.6304929",
"0.6288541",
"0.62871635",
"0.62840205",
"0.6244341",
"0.62196714",
"0.62151325",
"0.6197774",
"0.61873615",
"0.61857116",
"0.61803293",
"0.61727536",
"0.61715806",
"0.6170505",
"0.61588037",
"0.6158399",
"0.61458206",
"0.61395156",
"0.6137957",
"0.6135244",
"0.61338407",
"0.6130669",
"0.6130669",
"0.6128843",
"0.6126371",
"0.6124813",
"0.6116433",
"0.6115874",
"0.60988176",
"0.6091946",
"0.60843205",
"0.60789895",
"0.60629576",
"0.6059234",
"0.6054893",
"0.6049319",
"0.60413355",
"0.6023534",
"0.6020362",
"0.5978684",
"0.5977875",
"0.597253",
"0.59648144",
"0.5961068",
"0.5955049",
"0.59389365",
"0.592023",
"0.59201926",
"0.5908351",
"0.5908057",
"0.59065914",
"0.5905327",
"0.5903487",
"0.58865994",
"0.5882223",
"0.5879419",
"0.58692944",
"0.5867824",
"0.5854383",
"0.58491915",
"0.5848145",
"0.5846328",
"0.58450884",
"0.5842546",
"0.58360916",
"0.5826549",
"0.5815725",
"0.5806841",
"0.5804439",
"0.57812774",
"0.5779901",
"0.5779157",
"0.5778617",
"0.57783693",
"0.5778264",
"0.5777078",
"0.5772265",
"0.57699925",
"0.57618177",
"0.57618153",
"0.57606316",
"0.575444",
"0.5752586",
"0.57510656",
"0.57461435",
"0.5746103",
"0.5744277",
"0.5743386",
"0.5743271"
] | 0.58351296 | 76 |
display_students(db) method to display all subjects | def display_subjects(database)
subjects = database.execute("SELECT * FROM subjects")
subjects.each do |subject|
puts "ID: #{subject[0]} Subject: #{subject[1]}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'caller'=>params[:caller],'school'=>school}\r\n end",
"def index\n @student_subjects = StudentSubject.all\n end",
"def show_all_students\n Student.all\n end",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def print_students_list\n if @students.length > 0\n print_info_each_student\n else puts \"No students in database\"\n end\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def display_students(database)\r\n\tstudents = database.execute(\"SELECT * FROM students\")\r\n\tstudents.each do |student|\r\n\t\tputs \"ID: #{student[0]} Name: #{student[1]}\"\r\n\tend\r\nend",
"def list\n @students= Student.all\n end",
"def display_grades(database, name)\r\n\tstudent_id = get_student_id(database, name)\r\n\tdisplay_cmd= <<-SQL\r\n\t\tSELECT students.name, subjects.name, grades.grade\r\n\t\tFROM grades\r\n\t\t\tJOIN students\r\n\t\t\t\tON grades.student_id=students.id\r\n\t\t\tJOIN subjects\r\n\t\t\t\tON grades.subject_id=subjects.id\r\n\t\tWHERE student_id=?\r\n\tSQL\r\n\tdisplay = database.execute(display_cmd,[student_id])\r\n\tdisplay.each do |grade|\r\n\t\tputs \"#{grade[0]} scored a #{grade[2]} on #{grade[1]}.\"\r\n\tend\r\nend",
"def student_displayer\n print_header\n print_students_list\n print_footer\nend",
"def display_students\n all_students = @conn.exec(\"SELECT * FROM students;\")\n all_students.each do | student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\n end\nend",
"def index\n @user_subjects = UserSubject.all\n end",
"def index\n @university_subjects = UniversitySubject.all\n end",
"def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{student[:hobby]}, Country = #{student[:country]}\".center(80)\n end\n end\nend",
"def index\n @thesubjects = Thesubject.all\n end",
"def show_students\n print_header\n print_students\n print_footer\nend",
"def show\n @courses = @student.courses\n @groups = @student.groups\n end",
"def index\n @course_subjects = CourseSubject.all\n end",
"def index\n @subjects = Subject.all\n end",
"def index\n @subjects = Subject.all\n end",
"def print_students\n @students.each do |student|\n puts \" Name:\".ljust(11) + \"-\".center(8) + \"#{student[:name]}\"\n puts \" Cohort:\".ljust(11) + \"-\".center(8) + \"#{student[:cohort]}\"\n puts \"\"\n end\nend",
"def display_students_db\n all_students = @conn.exec(\"SELECT * FROM students_db;\")\n #usp[e exec to pretty much do everything\n all_students.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n puts all_students\n end\n end\nend",
"def show\n if @current_user\n @students = Student.where.not(id: Relation.select(:student_id).where(subject_id: @subject.id))\n @inscrits = Student.where(id: Relation.select(:student_id).where(subject_id: @subject.id))\n else\n redirect_to request.referrer || root_path\n end\n end",
"def index\n @subjects = Subject.all\n \n end",
"def index\n @mysubjects = Mysubject.all\n end",
"def index\n #assemlbe a list of all the subjects\n # @subjects = Subject.all or\n @subjects = Subject.sorted #defined in lambda\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend",
"def index\n @subjects_users = SubjectsUser.all\n end",
"def index\n logged_in\n if @current_user.teacher?\n @subjects = Subject.where(teacher_id: @current_user.id)\n elsif @current_user.student?\n @subjects = Subject.where(id: Relation.select(:subject_id).where(student_id: @current_user.id))\n else\n @subjects = Subject.all\n end\n end",
"def print_students_list\n\t@students.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]} cohort)\"\n\tend\nend",
"def index\n @subjects = Subject.all.sort_by { |m| m.name.downcase }\n @user = current_user\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @records = Record.all\n @subjects = Subject.all\n @students = Student.all\n end",
"def index\n @program_subjects = ProgramSubject.all\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def index\n @students = Student.all\n render :index\n end",
"def all_students(teacher_user)\n counter = 0 \n while counter <= Student.all.count \n list = Student.all.map do |pupil|\n pupil.name\n end\n counter += 1\n end\n puts list\n end",
"def print_student_list(students)\n\tstudents_by_cohort = students.sort_by {|a| a[:cohort]}\n\tstudents_by_cohort.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]}) cohort\".center(@width)\n\tend\nend",
"def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end",
"def students\n Rollcall::Student.find_all_by_school_id schools\n end",
"def show\n @student_schools = @student.schools.order(:name => :asc)\n end",
"def show\n @students = StudentInfo.where(referenced_class_id: params[:id]).all\n #puts YAML::dump(@students)\n end",
"def print_students(label='', students)\n \n students.each do |s|\n \n puts \"#{label} #{s}\"\n puts \"\\n\\n\"\n end\n\n end",
"def display_list(students)\n students.each { |key, value| puts \"#{key}: #{value} students\" }\nend",
"def index\n @students = Student.where(:course_id => params[:course_id])\n end",
"def subject_list\n list = []\n subjects.each { |subject| list << subject.name }\n list.to_sentence\n end",
"def list\n \n @lesson = Lesson.sorted.where(:subject_id => @subject.id) #@subjects= instance variable, Subject = Model name, subjects =table name\n # @subjects_list = Subject.all\n end",
"def list_subjects(study_id)\n act = SubjectListAction.new(self)\n act.get(study_id)\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\"\n end\nend",
"def display (x)\n x.each do |x|\n puts\"#{x} students\\n\\n\"\n end\nend",
"def index\n @school_cycle_has_subjects = SchoolCycleHasSubject.all\n end",
"def index\n @tutor_subjects = TutorSubject.all\n end",
"def show\n @students = Student.where(school: @school.id)\n @teachers = Teacher.where(school: @school.id) \n end",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def show\n\t\n\t@misses=Array.new\n\t@student.group.subjects.each do |subj|\n\t\ttmp=Array.new\n\t\t@student.misses.each do |miss|\n\t\t\tif Pair.find(miss.pair_id).subject==subj\n\t\t\t\ttmp << miss\n\t\t\tend\n\t\tend\n\t\t@misses << tmp\n\tend\n end",
"def show\n school_id = @student.school_id\n @course_selection = []\n @assigned_school = School.find(school_id)\n course_ids = @student.course_ids\n course_ids.each do |id|\n selection_unit = Course.find(id)\n @course_selection << selection_unit\n end\n end",
"def show\r\n authorize! :read, Subject\r\n @subject = Subject.where(id: params[:id]).first\r\n @books = BookTitle.where(subject_id: @subject).all.order(:title)\r\n end",
"def index\n @student = Student.all\n end",
"def index\n @subjectms = Subjectm.all\n end",
"def students\n self.course_person.all(:type => \"student\").persons\n end",
"def index\n @subject_teachers = SubjectTeacher.all\n end",
"def index\n admin_only\n @subjects = Subject.all\n end",
"def index\n @students_records = @student.records\n end",
"def print_student_list(students)\n puts \"Students:\"\n puts \"----------------\"\n students.each do |student|\n puts \"#{student[:name]}, Cohort: #{student[:cohort]}\"\n end\n puts \"Overall, we have #{students.count} students\"\nend",
"def index\n @find_students = FindStudent.all\n end",
"def show\n @books = @promotion.books.order(:sort_title)\n @subjects = @promotion.books.map{ |book| book.subjects }\n # binding.pry\n\n unless params[:subject].nil?\n @books = @promotion.books.where('subjects LIKE ?', \"%#{params[:subject]}%\")\n .order(:sort_title)\n end\n end",
"def index\n if(params[:subject]==nil)\n @sections = Section.all\n @sections = Section.find_by_sql(\"SELECT * FROM `sections`\njoin subjects\non subjects.id = subject_id\nwhere user_id = \n\" + session[:userid])\n else\n session[:subjectid]=params[:subject]\n \n \n @sections = Section.find(:all, :conditions=>\"subject_id = \"+params[:subject]+\" and user_id = \"+session[:userid])\n @subject = Subject.find(:all,:conditions=>\"id = \"+params[:subject])\n flash[:subjectname]=@subject[0].name \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def index\n \n @subjects = Subject.sorted\n \n end",
"def index\n @group_students = GroupStudent.all\n end",
"def show\n @student = @topic.student\n end",
"def index\n @student_classes = StudentClass.all\n end",
"def print_courses\n self.make_courses\n Course.all.each do |course|\n if course.title && course.title != \"\"\n puts \"Title: #{course.title}\"\n puts \" Schedule: #{course.schedule}\"\n puts \" Description: #{course.description}\"\n end\n end\n end",
"def print_students_list\n count = @students.count\n if count ==0\n puts \"There are no students to print.\".center(40)\n exit\n else\n\n n = 1\n while n <= count\n @students.map do |student|\n name = student[:name]\n cohortstr = student[:cohort].to_s.capitalize\n puts \"#{n.to_s.center(4)} #{name.ljust(30)} #{cohortstr}\"\n n +=1\n end #end of map do\n end #end of while\n puts #spacer line\n success\n end #end if\nend",
"def index\n @exam_students = ExamStudent.all\n end"
] | [
"0.71916765",
"0.70844215",
"0.69682807",
"0.6877798",
"0.68359965",
"0.68359965",
"0.6818311",
"0.6809174",
"0.6809174",
"0.6809174",
"0.67688406",
"0.67515945",
"0.67114455",
"0.66914874",
"0.66760284",
"0.66130507",
"0.6603461",
"0.6588587",
"0.6587552",
"0.65592146",
"0.6550973",
"0.65323097",
"0.6492904",
"0.6492904",
"0.64717895",
"0.647022",
"0.64688283",
"0.64627254",
"0.645053",
"0.6434985",
"0.64229834",
"0.6419381",
"0.64037937",
"0.6371643",
"0.6360175",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.6344593",
"0.63247997",
"0.63247997",
"0.6315195",
"0.6312684",
"0.63031733",
"0.62831056",
"0.6281656",
"0.62739676",
"0.6265757",
"0.625728",
"0.62517065",
"0.62441814",
"0.62440586",
"0.6242957",
"0.62321365",
"0.62232035",
"0.62192404",
"0.6214581",
"0.6213921",
"0.6212677",
"0.6207491",
"0.62022084",
"0.61996263",
"0.6194216",
"0.6183932",
"0.615149",
"0.614473",
"0.6141305",
"0.61400986",
"0.6127053",
"0.6120145",
"0.61018944",
"0.6096768",
"0.6096765",
"0.6094223",
"0.6071363",
"0.6067282",
"0.60455185",
"0.60390097",
"0.60312116",
"0.60288644",
"0.6027419",
"0.6027407",
"0.6026962"
] | 0.74699634 | 0 |
method to display all grades | def display_grades(database, name)
student_id = get_student_id(database, name)
display_cmd= <<-SQL
SELECT students.name, subjects.name, grades.grade
FROM grades
JOIN students
ON grades.student_id=students.id
JOIN subjects
ON grades.subject_id=subjects.id
WHERE student_id=?
SQL
display = database.execute(display_cmd,[student_id])
display.each do |grade|
puts "#{grade[0]} scored a #{grade[2]} on #{grade[1]}."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_grades\n @learn_grades.each do |grade|\n puts grade.which_course?.foreground(:yellow) + \": \".foreground(:yellow)\n puts grade.summary\n end\n end",
"def show_grades(grades, format)\n puts 'Assessment\\'s grades'\n puts AssessmentSerializer::serialize_grades(grades, format)\n puts\n end",
"def index\n @grades = Grade.all\n end",
"def index\n @grades = Grade.all\n end",
"def index\n @grades = Grade.all\n end",
"def index\n @grades = Grade.all\n end",
"def index\n @final_grades = FinalGrade.all\n end",
"def print_grades (roster, final_student)\n\troster.each do |student|\n\t\tputs \"#{student['name']} has these grades: #{student['essay_1']}, #{student['essay_2']}, #{student['midterm_1']}, #{student['midterm_2']}.\"\n\tend\n\tfinal_student.each do |student, grade|\n\t\tputs \"#{student}'s final grade is #{grade}.\"\n\tend\nend",
"def report_card\n puts self.get_gpa\n grades = self.registrations.includes(:course)\n # puts \"Your grades for each class are as follows:\\n\"\n tp grades, {\"Subject\" => {:display_method => lambda{|x| x.course.subject}}}, {\"Grades\" => {:display_method => lambda{|x| numeric(x.grade)}}}\n end",
"def show\n #@grade_book = Gradebook.all\n end",
"def all\n roster.each do |k|\n if k[:students]\n puts \"Grade #{k[:grade]} : #{k[:students]}\"\n end\n end\n end",
"def grades\n @learn_grades\n end",
"def show\n\t\t@students = Student.where(school_id: @school.id)\n\t\t@group = {\"0\"=>[],\"1\"=>[],\"2\"=>[],\"3\"=>[],\"4\"=>[],\"5\"=>[],\"6\"=>[],\"7\"=>[],\"8\"=>[],\"9\"=>[],\"10\"=>[],\"11\"=>[],\"12\"=>[]}\n\t\t@st = []\n\t\t@students.each do |student|\n\t\t\t@group[student.last_course].push(student.average)\n\t\t\t#p student.average\n\t\tend\n\t\t@group.reject!{ |k,v| !v.any? }\n\t\t@courses = [];\n\t\t@grades = [];\n\t\t@group.each do |k,v|\n\t\t\t@group[k] = added(v);\n\t\t\t@courses.push(k);\n\t\t\t@grades.push(v[0].round(2));\n\t\tend\n\t\t@title = \"Informe del \" + (Time.now.year-1).to_s + \" al \" + (Time.now.year).to_s\n\n\t\t@ids=[]\n\t\t@students.each do |st|\n\t\t\t@ids.push(st.id)\n\t\tend\n\n\t\t@activities = Activity.joins(:students).where(students: {id: @ids})\n\t\t@programs_edu =\tProgram.where(line: \"epc\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_m =\tProgram.where(line: \"n\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_h =\tProgram.where(line: \"h\").joins(:activities).where(activities: {id: @activities})\n\n end",
"def description_hint_grades\n grades = Evaluation::Grade.all\n \"School grades (#{grades.join(', ')}) are assigned and \" \\\n 'displayed with each object.'\n end",
"def index\n @average_grades = AverageGrade.all\n end",
"def index\n @member_grades = MemberGrade.all\n end",
"def grades\n @grade_entry_form = record\n end",
"def show\n setup_more\n @gradebook.mark_invalid(flash[:bad_grades])\n end",
"def display (x)\n x.each do |x|\n puts\"#{x} students\\n\\n\"\n end\nend",
"def display (students)\n students.each do |cohort, num|\n puts \"#{cohort}: #{num}\"\n end\nend",
"def index\n @grade_calcs = GradeCalc.all\n end",
"def detailed\n if (@data.length > 0)\n mygrade = grade || \"\"\n puts \"#{@type}: #{mygrade}\"\n for datum in @data\n puts \"\\t#{datum}\"\n end \n return true\n end\n end",
"def grade(grade)\n roster.each do |k|\n if k[:grade] == grade\n puts \"The following students are in Grade #{grade}: #{k[:students]}\"\n return k[:students]\n end\n end\n end",
"def display(students)\n students.each {|cohort, number_of_students| puts \"#{cohort}: #{number_of_students} students\"}\n end",
"def show \n @average_age = @instructor.average_age\n @students = @instructor.students.sort_by {|student| student.name}\n end",
"def get_grades(student, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#a. create method to return student's grade\n\tschool[:students].each do |s|\n\t\tputs s[:grade] if s[:name] == student\n\tend\nend",
"def print_students\n @students.each do |student|\n puts \" Name:\".ljust(11) + \"-\".center(8) + \"#{student[:name]}\"\n puts \" Cohort:\".ljust(11) + \"-\".center(8) + \"#{student[:cohort]}\"\n puts \"\"\n end\nend",
"def visible_grades\n if generalized_mentor?\n GRADES\n else\n current_grade_index = GRADES.index(grade) || 0\n GRADES[0..current_grade_index]\n end\n end",
"def index\n @criterion_grades = CriterionGrade.all\n end",
"def view_grades\n @course = Course.find(params[:id])\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend",
"def grades(options = {})\n should_include_inactive = options.fetch(:include_inactive_students, false)\n relevant_students = should_include_inactive ? self.students : self.students.active\n GradeLevels.sort relevant_students.flat_map(&:grade).compact.uniq\n end",
"def show\n\t @allenrolls = @course.enrolls\n\n end",
"def summary\n comment = @policy.describe(@grades)\n if (comment)\n comment = \" (#{comment})\"\n else\n comment = \"\"\n end\n mygrade = grade\n if mygrade\n mygrade = \"#{mygrade.round(1)}\"\n else\n mygrade = \"[No grades available]\"\n end\n if ((0 == @percent) || (100 == @percent) || (-100 == @percent)) \n dots = @@dots[@type.length + 1 .. -1]\n puts \"#{@type} #{dots}: #{mygrade}#{comment}\"\n else\n dots = @@dots[@type.length + 9 .. -1]\n percentText = \"#{@percent.round(1)}\"\n if (@percent < 10) \n percentText = \" #{percentText}\"\n end\n puts \"#{@type} #{dots} (#{percentText}%): #{mygrade}#{comment}\"\n end\n end",
"def student_displayer\n print_header\n print_students_list\n print_footer\nend",
"def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end",
"def displayed_grade\n (grade * 4 + 1).to_i\n end",
"def index\n @catgrades = Catgrade.all\n end",
"def grade(name, schoolvar)\n schoolvar[:students].each do |students|\n\t\tif students[:name]==name\n\t\tprint students[:grade]\n\t\tend\n\tend\nend",
"def show\n @gss = @grade_section.students_for_academic_year(params[:year])\n end",
"def display_list(students)\n students.each { |key, value| puts \"#{key}: #{value} students\" }\nend",
"def grades\n @grade_entry_form = GradeEntryForm.find(params[:id])\n end",
"def index\n @grade_sections = GradeSectionHistory.all\n end",
"def displays_students(hash_to_display)\n hash_to_display.each do |key, value|\n puts \"#{key}: #{value} students\"\n end\nend",
"def display_each\n puts \" * #{self.experience} experience at #{self.company_name}\"\n end",
"def index\n @default_fields = DEFAULT_FIELDS\n if current_user.student?\n @grade_entry_forms = GradeEntryForm.where(is_hidden: false).order(:id)\n @assignments = Assignment.where(is_hidden: false).order(:id)\n @marking_schemes = MarkingScheme.none\n #get the section of current user\n @section = current_user.section\n # get results for assignments for the current user\n @a_id_results = Hash.new()\n @assignments.each do |a|\n if current_user.has_accepted_grouping_for?(a)\n grouping = current_user.accepted_grouping_for(a)\n if grouping.has_submission?\n submission = grouping.current_submission_used\n if submission.has_remark? && submission.remark_result.released_to_students\n @a_id_results[a.id] = submission.remark_result\n elsif submission.has_result? && submission.get_original_result.released_to_students\n @a_id_results[a.id] = submission.get_original_result\n end\n end\n end\n end\n\n # Get the grades for grade entry forms for the current user\n @g_id_entries = Hash.new()\n @grade_entry_forms.each do |g|\n grade_entry_student = g.grade_entry_students.find_by_user_id(\n current_user.id )\n if !grade_entry_student.nil? &&\n grade_entry_student.released_to_student\n @g_id_entries[g.id] = grade_entry_student\n end\n end\n\n render :student_assignment_list, layout: 'assignment_content'\n elsif current_user.ta?\n @grade_entry_forms = GradeEntryForm.order(:id)\n @assignments = Assignment.includes(:submission_rule).order(:id)\n render :grader_index, layout: 'assignment_content'\n @marking_schemes = MarkingScheme.all\n else\n @grade_entry_forms = GradeEntryForm.order(:id)\n @assignments = Assignment.includes(:submission_rule).order(:id)\n render :index, layout: 'assignment_content'\n @marking_schemes = MarkingScheme.all\n end\n end",
"def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{student[:hobby]}, Country = #{student[:country]}\".center(80)\n end\n end\nend",
"def grade\n @grade\n end",
"def print_student_list(students)\n puts \"Students:\"\n puts \"----------------\"\n students.each do |student|\n puts \"#{student[:name]}, Cohort: #{student[:cohort]}\"\n end\n puts \"Overall, we have #{students.count} students\"\nend",
"def get_grade(grades)\n sum = 0 # define sum, so that I can add things to it\n grades.each {|grade| sum += grade} # adding each element of the array together\n mean = sum / grades.length # the average of the grades\n case # the letter grade for each mean\n when mean >= 90\n return \"A\" # good job, student\n when mean >= 80\n return \"B\" # pretty good job, student\n when mean >= 70\n return \"C\" # average job, student\n when mean >= 60\n return \"D\" # I've seen better, student\n else\n return \"F\" # Reconsider your life, student\n end # Don't forget your end statements\nend",
"def index\n items_per_page = 20\n if params[:grade]\n @courses = Course.with_grade_level(params[:grade]).paginate(page: params[:page], per_page: items_per_page)\n @grade = GradeLevel.where(id: params[:grade])\n else\n @courses = Course.paginate(page: params[:page], per_page: items_per_page)\n end\n end",
"def show\n\n #if student, show class enrollments/bookings\n @enrollments = @current_user.enrollments.sort_by {\n |enrollment| enrollment['date']\n }\n\n # if instructor show classes that they are teaching\n @classes_teaching = @current_user.classes_teaching\n\n\n end",
"def print_students_list\n\t@students.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]} cohort)\"\n\tend\nend",
"def index\n\t\t@essences = Essence.all\n\t\t# render text: @essences.map { |i| \"#{i.russian}: --- #{i.greek} --- #{i.latin} --- #{i.english} --- #{i.french} --- #{i.german} --- #{i.dutch} --- #{i.spanish} --- #{i.italian} --- #{i.hungarian} --- #{i.croatian} \" }.join(\"<br/>\" )\n\tend",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\"\n end\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def get_grade scores\n average = 0\n scores.each do |num|\n if num < 0 || num > 100\n p \"Please input a list of valid scores (0-100).\"\n else\n average += num\n end\n end\n average /= scores.length\n if average >= 90\n \"A\"\n elsif average >= 80\n \"B\"\n elsif average >= 70\n \"C\"\n elsif average >= 60\n \"D\"\n else\n \"F\"\n end\nend",
"def index\n @assignments = Assignment.all(order: :id)\n if current_user.student?\n # get results for assignments for the current user\n @a_id_results = Hash.new()\n @assignments.each do |a|\n if current_user.has_accepted_grouping_for?(a)\n grouping = current_user.accepted_grouping_for(a)\n if grouping.has_submission?\n submission = grouping.get_submission_used\n if submission.has_result? && submission.get_latest_result.released_to_students\n @a_id_results[a.id] = submission.get_latest_result\n end\n end\n end\n end\n render :student_assignment_list\n elsif current_user.ta?\n render :grader_index\n else\n render :index\n end\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def display_personal_information()\n # Display Personal Information\n puts \"Name: #{ @name } ID: #{ @id }\"\n puts \"Anual income: #{ @anual_income }\"\n average = average()\n puts \"Grade average: #{ average }\"\n end",
"def display_keys\n students.each_key { |key| puts \"- #{key}\" }\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def show_all_students\n Student.all\n end",
"def gradeAll( studentArr, keyString )\n grades = []\n studentArr.each { |studentString |\n grades.push( gradeStudent( studentString, keyString ) )\n }\n grades\n end",
"def display_employees\n\t\t@@name_and_salary.each do |x|\n\t\t\tputs \"Name: #{x[:name]}, Salary: $#{x[:salary]}\"\n\t\tend\n\tend",
"def show\n @courses = @student.courses\n @groups = @student.groups\n end",
"def get_grade(grades)\n\tsum = 0\n\ttotal = grades.length\n\tgrades.each { |x| sum = (sum + x) }\n\taverage = (sum / total)\n\tif average >= 90\n\t\treturn \"A\"\n\telsif average >= 80\n\t\treturn \"B\"\n\telsif average >= 70\n\t\treturn \"C\"\n\telsif average >= 60\n\t\treturn \"D\"\n\telse \n\t\treturn \"F\"\n\tend\nend",
"def displayLettersFound()\n\n @lettersDisplayArr.each do |i| \n print i\n end\n print \"\\n\"\n end",
"def show_students\n print_header\n print_students\n print_footer\nend",
"def show\n school_id = @student.school_id\n @course_selection = []\n @assigned_school = School.find(school_id)\n course_ids = @student.course_ids\n course_ids.each do |id|\n selection_unit = Course.find(id)\n @course_selection << selection_unit\n end\n end",
"def index\n @grade_horarios = GradeHorario.all\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def print_courses\n @learn_courses.each do |course|\n puts course.name.foreground(:yellow)\n end\n end",
"def show\n @gofes = Gofe.all\n @scores = Score.all\n @club_awards = ClubAward.all\n @ab_teams = AbTeam.all\n @external_awards = ExternalAward.all\n @star_golds = StarGold.all\n @star_with_honors = StarWithHonor.all\n @gold_tests = GoldTest.all\n @goe_years = @gofes.pluck(:year).map{|x| x}.uniq.sort\n @star_gold_years = @star_golds.pluck(:year).map{|x| x}.uniq.sort\n end",
"def index\n @grades_tournaments = GradesTournament.all\n end",
"def show\n @course = Course.includes(:teachers, :students).find(params[:id])\n current_user_enrollment = @course.enrollments.where(:user_id => current_user.id).first\n @grade = Grade.new(current_user_enrollment.grade) if current_user_enrollment\n @average_grade = Grade.new(@course.average_gradepoint) if can? :manage, @course\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def get_grade(grades)\n\t@grades = grades\n\t@average = (@grades.inject(:+)/@grades.length)\n\tif @average >= 90\n\t\treturn 'A'\n\telsif @average >= 80\n\t\treturn 'B'\n\telsif @average >= 70\n\t\treturn 'C'\n\telsif @average >= 60\n\t\treturn 'D'\n\telse\n\t\treturn 'F'\n\tend\nend",
"def get_grade(*grades)\r\n\r\n average = grades.sum / grades.size\r\n\r\n case average\r\n when 90..100 then 'A'\r\n when 80..90 then 'B' \r\n when 70..80 then 'C'\r\n when 60..70 then 'D'\r\n when 0..60 then 'F'\r\n else \"Above and beyond! A+\"\r\n end\r\nend",
"def show\n\t\t@assignment_corrected_flag = false\n\t\t@assignment_submitted_flag = false\n\t\tid = params[:id]\n\t\t@assignment = Assignment.find_by_id(id)\n\t\t@grade_records = []\n\t\t@submitted_records = []\n\t\tif student_signed_in?\n\t\t\tstudent_id = current_student.id\n\t\tend\n\t\tif @assignment\n\t\t\t@course = @assignment.course\n\t\t\t@problems = @assignment.problems\n\t\t\tif teaching_assistant_signed_in?\n\t\t\t\t@can_edit = @course.can_edit(current_teaching_assistant)\n\t\t\tend\n\t\t\tif lecturer_signed_in?\n\t\t\t\t@can_edit ||= @course.can_edit(current_lecturer)\n\t\t\tend\n\t\telse\n\t\t\trender ('public/404')\n\t\tend\n\t\t@problems.each do |p|\n\t\t\t@grade_records = @grade_records + \n\t\t\tGrade.where(\"student_id = ? AND problem_id = ?\", student_id, p.id )\n\t\tend\n\t\tif @grade_records.size < @problems.size\n\t\t\t@assignment_corrected_flag = false\n\t\telse\n\t\t\t@assignment_corrected_flag = true\n\t\tend\n\t\t@problems.each do |p|\n\t\t\t@submitted_records = @submitted_records + \n\t\t\tSolution.where(\"student_id = ? AND problem_id = ? AND problem_type = ?\",\n\t\t\tstudent_id, p.id , \"AssignmentProblem\")\n\t\tend\n\t\tif @submitted_records.size < @problems.size\n\t\t\t@assignment_submitted_flag = false\n\t\telse\n\t\t\t@assignment_submitted_flag = true\n\t\tend\n\tend",
"def PrintTable(id,scores)\n @position = 0\n while @position <= (id.length-1) do\n print \"Student Id: #{id[@position]}\\tScore: #{scores[@position]}\\tLetter Grade: \"\n case scores[@position]\n when 0..59.99: print \"F\\n\"\n when 60..69.99: print \"D\\n\"\n when 70..79.99: print \"C\\n\"\n when 80..89.99: print \"B\\n\"\n when 90..100: print \"A\\n\"\n else print \"Problem\"\n end #end of case\n @position = @position + 1\n end #end of while\nend",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def each &block\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end",
"def show\n @unive_score = @university.unive_scores.new\n @academic_score = @university.academic_scores.new\n @party_score = @university.party_scores.new\n @satisfaction_score = @university.satisfaction_scores.new\n @infraestructure_score = @university.infraestructure_scores.new\n @alumni_score = @university.alumni_scores.new\n @admission_score = @university.admission_scores.new\n @graduation_score = @university.graduation_scores.new\n @professor_score = @university.professor_scores.new\n @investment_score = @university.investment_scores.new\n @finantial_score = @university.finantial_scores.new\n end",
"def print_body(students)\n students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort) #{student[:height]} #{student[:hobbies]} #{student[:age]}\".center(35)\n end\nend",
"def index\n @gradeworks_id = params[:idGrade] #No Almacena nada....\n p @gradeworks_id\n @gradeworks = Gradework.all\n @juries = User.users_jury\n @directors = User.users_director\n @students = User.users_student\n @grad_jury = User.jury_gradework(1).joins(:roles).where(roles: {name: \"Jury\"})\n @grad_director = User.jury_gradework(1).joins(:roles).where(roles: {name: \"Director\"})\n @grad_student = User.jury_gradework(1).joins(:roles).where(roles: {name: \"Student\"})\n end",
"def grades\n object.grades.collect do |grade|\n { :grade => grade, :student => grade.student }\n end\n end",
"def each(&block)\n yield @id\n yield @name\n @grades.each(&block)\n yield grade_average\n end",
"def grade_report\n array = []\n frm.table(:class=>\"listHier lines nolines\").rows.each do |row|\n next if row.td(:headers=>\"studentname\").exists? == false\n hash = {}\n hash[:student] = row.td(:headers=>\"\").text\n hash[:assignment] = row.td(:headers=>\"\").text\n hash[:grade] = row.td(:headers=>\"\").text\n hash[:scale] = row.td(:headers=>\"\").text\n hash[:submitted] = row.td(:headers=>\"\").text\n array << hash\n end\n array\n end",
"def enrollment(list)\n\tlist.each do |key, value|\n\t\tputs \"#{key}: #{value} students\"\n\tend\n\tputs \"------------------------\"\nend",
"def get_grade(*grades)\n average = grades.sum / grades.size\n \n case \n when average > 90\n \"A\"\n when average >= 80 && average < 90\n \"B\"\n when average >= 70 && average < 80\n \"C\"\n when average >= 60 && average < 70\n \"D\"\n else\n \"F\"\n end\nend",
"def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Grade\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (did not find instance)\n # @grades = policy_scope(Portal::Grade)\n @portal_grades = Portal::Grade.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_grades }\n end\n end",
"def display_name(hash)\n\thash.each do |cohort,num|\n \t\tputs \"#{cohort}: #{num} students\"\n\tend \nend",
"def index\n @gradeworks = Gradework.all\n @juries = User.users_jury\n @directors = User.users_director\n @students = User.users_student\n end"
] | [
"0.7695495",
"0.7247339",
"0.68063635",
"0.68063635",
"0.68063635",
"0.68063635",
"0.6758233",
"0.6643163",
"0.66415995",
"0.6596063",
"0.6595783",
"0.65084684",
"0.64735466",
"0.64129627",
"0.6410633",
"0.6373399",
"0.63248175",
"0.6307031",
"0.6301125",
"0.6288717",
"0.6262779",
"0.62361115",
"0.6224919",
"0.6190404",
"0.6187129",
"0.61860937",
"0.6140304",
"0.6115034",
"0.61138815",
"0.6113546",
"0.61004406",
"0.6090317",
"0.6063848",
"0.6045288",
"0.60418653",
"0.60379255",
"0.60162306",
"0.6012579",
"0.6011596",
"0.6002079",
"0.59842086",
"0.5983173",
"0.59674627",
"0.5961733",
"0.5942566",
"0.59262514",
"0.59185874",
"0.5902389",
"0.5896581",
"0.5893265",
"0.5869651",
"0.58637357",
"0.58599746",
"0.5852292",
"0.5850448",
"0.58363044",
"0.5822776",
"0.5822776",
"0.5819356",
"0.58140916",
"0.580176",
"0.5794829",
"0.5786099",
"0.5777423",
"0.5777423",
"0.5777423",
"0.57615834",
"0.57594633",
"0.5751158",
"0.5732071",
"0.5729194",
"0.5722921",
"0.57140404",
"0.56980973",
"0.5690359",
"0.56838864",
"0.56583756",
"0.56465995",
"0.5644205",
"0.5641575",
"0.56396675",
"0.563895",
"0.56378615",
"0.5635249",
"0.56323653",
"0.5620904",
"0.5619385",
"0.5619385",
"0.5606608",
"0.5602653",
"0.5600601",
"0.5591555",
"0.558859",
"0.5587592",
"0.5587121",
"0.55832684",
"0.5581286",
"0.557892",
"0.557095",
"0.5568406"
] | 0.6705752 | 7 |
display_grades(db, "Bob") Method to print out the commands | def help
puts "-to add new student: add student"
puts "-to display all students: display students"
puts "-to display all subjects: display subjects"
puts "-to update a grade: update grade"
puts "-to display grades of a student: check grade"
puts "-to quit: done, exit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_grades(database, name)\r\n\tstudent_id = get_student_id(database, name)\r\n\tdisplay_cmd= <<-SQL\r\n\t\tSELECT students.name, subjects.name, grades.grade\r\n\t\tFROM grades\r\n\t\t\tJOIN students\r\n\t\t\t\tON grades.student_id=students.id\r\n\t\t\tJOIN subjects\r\n\t\t\t\tON grades.subject_id=subjects.id\r\n\t\tWHERE student_id=?\r\n\tSQL\r\n\tdisplay = database.execute(display_cmd,[student_id])\r\n\tdisplay.each do |grade|\r\n\t\tputs \"#{grade[0]} scored a #{grade[2]} on #{grade[1]}.\"\r\n\tend\r\nend",
"def print_grades\n @learn_grades.each do |grade|\n puts grade.which_course?.foreground(:yellow) + \": \".foreground(:yellow)\n puts grade.summary\n end\n end",
"def show_grades(grades, format)\n puts 'Assessment\\'s grades'\n puts AssessmentSerializer::serialize_grades(grades, format)\n puts\n end",
"def check_student (db, student_name, final_student)\n\tputs db.execute(\"SELECT * FROM students WHERE name=?;\", [student_name])\n\tputs \"Final Grade: #{final_student[student_name]}\"\nend",
"def display_students(database)\r\n\tstudents = database.execute(\"SELECT * FROM students\")\r\n\tstudents.each do |student|\r\n\t\tputs \"ID: #{student[0]} Name: #{student[1]}\"\r\n\tend\r\nend",
"def display_users(db)\n\tputs \"First name and last name of the users.\"\n\tputs \"--------------------------------------\"\n\tname = db.execute(\"SELECT * FROM users;\")\n\tname.each do |user|\n\t\tputs \"Fisrt name: #{user['first_name']} and last name: #{user['last_name']}. #{ user['is_artist'] == 'true' ? 'This user is an artist.' : 'This user is not an artist.' }\"\n\tend\nend",
"def summary\n comment = @policy.describe(@grades)\n if (comment)\n comment = \" (#{comment})\"\n else\n comment = \"\"\n end\n mygrade = grade\n if mygrade\n mygrade = \"#{mygrade.round(1)}\"\n else\n mygrade = \"[No grades available]\"\n end\n if ((0 == @percent) || (100 == @percent) || (-100 == @percent)) \n dots = @@dots[@type.length + 1 .. -1]\n puts \"#{@type} #{dots}: #{mygrade}#{comment}\"\n else\n dots = @@dots[@type.length + 9 .. -1]\n percentText = \"#{@percent.round(1)}\"\n if (@percent < 10) \n percentText = \" #{percentText}\"\n end\n puts \"#{@type} #{dots} (#{percentText}%): #{mygrade}#{comment}\"\n end\n end",
"def display_students_db\n all_students = @conn.exec(\"SELECT * FROM students_db;\")\n #usp[e exec to pretty much do everything\n all_students.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n puts all_students\n end\n end\nend",
"def display(db)\r\n\tputs \"ID Title Year New? MarketValue System\"\r\n\tputs \"-\" * 75\r\n\tgames = db.execute(\"SELECT * FROM games\")\r\n\tgames.each do |game|\r\n\t\tsys = db.execute(\"SELECT name FROM systems WHERE id=?\", game[2])\r\n\t\tunopened = \"N\" if game[4] == 0\r\n\t\tunopened = \"Y\" if game[4] == 1\r\n\t\tputs \"[#{game[0]}] #{game[1].ljust(25)} #{game[3]} #{unopened.ljust(5)} #{game[5].to_s.ljust(12)} #{sys[0][0]}\"\r\n\tend\t\r\nend",
"def print_grades (roster, final_student)\n\troster.each do |student|\n\t\tputs \"#{student['name']} has these grades: #{student['essay_1']}, #{student['essay_2']}, #{student['midterm_1']}, #{student['midterm_2']}.\"\n\tend\n\tfinal_student.each do |student, grade|\n\t\tputs \"#{student}'s final grade is #{grade}.\"\n\tend\nend",
"def students_list_message\n print \"Students list: \\n______________\\n\"\nend",
"def display_one(db, id)\r\n\tputs \"ID Title Year New? MarketValue System\"\r\n\tputs \"-\" * 75\r\n\tgame_entry = db.execute(\"SELECT * FROM games WHERE id=?\", id)\r\n\tgame = game_entry[0]\r\n\tsys = db.execute(\"SELECT name FROM systems WHERE id=?\", game[2])\r\n\tunopened = \"N\" if game[4] == 0\r\n\tunopened = \"Y\" if game[4] == 1\r\n\tputs \"[#{game[0]}] #{game[1].ljust(25)} #{game[3]} #{unopened.ljust(5)} #{game[5].to_s.ljust(12)} #{sys[0][0]}\"\r\nend",
"def display_entries(db)\n\tentries = db.execute(\"SELECT * FROM books\")\n\tif entries == []\n\t\tputs \"You have zero logged books!\"\n\t\tputs\n\telse\n\t\tentries.each do |book|\n\t \t\tputs \"#{book['id']}. #{book['book_name']} by #{book['author']}\"\n\t \t\tputs \"\tPublished: #{book['year_pubished']}, Reading status: #{book['read']} pages read.\"\n\t \t\tputs \" \tGenre: #{book['genre']}\"\n\t \t\tputs \"\tYour rating: #{book['rating']} out 10.\"\n\t \t\tputs\n\t\tend\n\tend\nend",
"def db_printer(database)\n my_database_printout = database.execute(\"SELECT * FROM wine_cellar\") # Note that you don't need the semicolon!\n puts \"\\nHere is your current wine list:\\n\" + \"=\"*30 + \"\\n\\n\"\n my_database_printout.each {|data_item| puts \"Item No. #{data_item[0]}: #{data_item[1]} -- #{data_item[2]} -- #{data_item[3]} -- #{data_item[4]}\"}\nend",
"def print_climb(climb)\n\tputs \"\"\n puts \"Name: #{climb.name}\"\n puts \"Grade: #{climb.grade}\"\n puts \"Type: #{climb.type}\"\n puts \"URL: #{climb.url}\"\n puts \"\"\n puts \"---------------Description--------------\"\n puts \"\"\n puts \"#{climb.description}\"\n puts \"\"\nend",
"def print_students\n @students.each do |student|\n puts \" Name:\".ljust(11) + \"-\".center(8) + \"#{student[:name]}\"\n puts \" Cohort:\".ljust(11) + \"-\".center(8) + \"#{student[:cohort]}\"\n puts \"\"\n end\nend",
"def display_game(word, guesses, chances)\n puts \"\\n***********************************\"\n puts \"Your word: #{word}\"\n puts \"\\nChances left: #{chances}\"\n puts \"Your guesses: #{guesses_s(guesses)}\"\n puts \"Enter a letter: \"\nend",
"def description_hint_grades\n grades = Evaluation::Grade.all\n \"School grades (#{grades.join(', ')}) are assigned and \" \\\n 'displayed with each object.'\n end",
"def display_score\n current_score_table = TTY::Table.new([\"Name\", \"Total Steps Taken\",\"Current Score\"], [[@name, \"#{@position}/33\", @score]]) \n puts current_score_table.render(:unicode, resize: true, width: 50)\n end",
"def display\n\t\tputs \"#{@guess_line.join(' ')} | #{@incorrect_guesses_count} | #{@misses.join(' ')}\"\n\tend",
"def display_artists(db)\n\tputs \"The artists are:\"\n\tputs \"----------------\"\n\tartists_list = db.execute(\"SELECT * FROM artists;\")\n\tartists_list.each do |artist|\n\t\tputs \"Artist's Name: #{artist['artist_name']} ; Language is #{artist['language']}\"\n\tend\nend",
"def display_the_board(db, name, task, importance)\n\tbboard.each do |bboard|\n\t puts \" \"\n\t puts \"Name: #{bboard['name']}\"\n\t puts \"Task: #{bboard['task']}\"\n\t puts \"Importance: #{bboard['importance']}\"\n\tend\nend",
"def display_score\n puts \"-----#{@name}-----\"\n puts \"Score: #{@score} \"\n puts \"Lives left: #{@lives}\"\n puts \"---------------\"\n end",
"def print_database(artistProfile)\n artistProfile.each do |rapper|\n if rapper.name && rapper.name != \"\"\n puts \"Name: #{rapper.name}\"\n puts \" Hangul: #{rapper.hangul}\"\n if rapper.aka != \"\"\n puts \" As known As: #{rapper.aka}\"\n end\n puts \" Birth Name: #{rapper.full_name}\"\n puts \" Birthday: #{rapper.dob}\"\n puts \" Gender: #{rapper.gender}\"\n if rapper.hometown != \"\"\n puts \" Hometown: #{rapper.hometown}\"\n end\n if rapper.label != \"\"\n puts \" Label: #{rapper.label}\"\n end\n puts \" Position: #{rapper.position}\"\n if rapper.crew != \"\"\n puts \" Member of: #{rapper.crew}\"\n end\n puts \"---------\"\n end\n end\n end",
"def report_card\n puts self.get_gpa\n grades = self.registrations.includes(:course)\n # puts \"Your grades for each class are as follows:\\n\"\n tp grades, {\"Subject\" => {:display_method => lambda{|x| x.course.subject}}}, {\"Grades\" => {:display_method => lambda{|x| numeric(x.grade)}}}\n end",
"def print_menu_options\n puts \"\"\n puts \"-------Main menu-------\".center(50)\n puts \"1. Add Students\"\n puts \"2. Show all students\"\n puts \"3. Show all the students that their names starts with an 'A'\"\n puts \"4. Show all the students that their names have less than 12 characters\"\n puts \"5. Show the students grouped by cohort\"\n puts \"6. Save the students in a file\"\n puts \"7. Load students from the file\"\n puts \"8. Update student information\"\n puts \"9. Exit\"\nend",
"def view_info(db, user_id)\n puts \"Which exercise would you like to view?\"\n exercise = gets.chomp\n until is_existing_exercise(db, exercise) do\n puts \"Invalid exercise. Please retry.\"\n exercise = gets.chomp\n end\n\n results = db.execute(\"SELECT * FROM exercises_users WHERE user_id=? AND exercise_id=?\", [user_id, exercise_id])\n puts \"You last did #{results[0][1]} reps of #{exercise} at #{results[0][2]} pounds\"\nend",
"def print_results(db, athlete_name)\n ath_reps = db.execute 'SELECT athletes.name, repetitions.distance, repetitions.effort, athlete_repetitions.elapsed_time, repetition_sets.date FROM athletes JOIN athlete_repetitions ON athletes.id = athlete_repetitions.athlete_id JOIN repetition_sets ON athlete_repetitions.repetition_set_id = repetition_sets.id JOIN repetitions ON repetition_sets.repetition_id = repetitions.id WHERE athletes.name = (?)', [athlete_name]\n ath_reps.each { |row| p \"#{row[0]} ran #{row[1]}m at #{row[2]}% effort in #{row[3]}s on #{row[4]}\" }\n end",
"def PrintTable(id,scores)\n @position = 0\n while @position <= (id.length-1) do\n print \"Student Id: #{id[@position]}\\tScore: #{scores[@position]}\\tLetter Grade: \"\n case scores[@position]\n when 0..59.99: print \"F\\n\"\n when 60..69.99: print \"D\\n\"\n when 70..79.99: print \"C\\n\"\n when 80..89.99: print \"B\\n\"\n when 90..100: print \"A\\n\"\n else print \"Problem\"\n end #end of case\n @position = @position + 1\n end #end of while\nend",
"def determine_grade\r\n \r\n Console_Screen.cls #Clear the display area \r\n \r\n #To pass the test, the player must correctly answer at least 6 questions\r\n if $noRight >= 3 then\r\n \r\n #Inform the player of the good news and assign a ranking\r\n print \"You correctly answered \" + $noRight.to_s + \" question(s). \"\r\n puts \"You have passed the \\nSuperman Movie Trivia Quiz!\\n\\n\"\r\n\t puts \"You have earned a rank of: FF new fan \" if $noright == 2\r\n puts \"You have earned a rank of: semi fan\" if $noRight == 3\r\n puts \"You have earned a rank of: fan\" if $noRight == 4\r\n puts \"You have earned a rank of: true fan\" if $noRight == 5\r\n print \"\\n\\nPress Enter to continue.\"\r\n \r\n else #The player has failed the quiz\r\n \r\n #Inform the player of the bad news\r\n print \"You missed \" + (6 - $noRight).to_s + \" questions. \"\r\n puts \"You have failed the Final Fantasy Trivia Quiz.\"\r\n puts \"Perhaps you should look at https://finalfantasy.fandom.com/wiki/Final_Fantasy_Wiki before returning to\"\r\n puts \"retake the quiz.\"\r\n\t puts \" do you wish to retake the quiz now? \"\r\n\t\r\n\t #Execute the Quiz class's display_instructions method\r\n SQ.display_instructions\r\n \r\n #Execute the Quiz class's disp_q method and pass it \r\n #arguments representing a question, possible answers and the letter \r\n #of the correct answer\r\n SQ.disp_q(\"What is the name of the Final Fantasy 1 final boss?\",\r\n \"a. Chaos\", \"b. Ben Miller\", \"c. Zemus\", \"d. Vayne\", \r\n \"a\")\r\n \r\n #Call upon the disp_q method and pass it the second question\r\n SQ.disp_q(\"What is the name of Cloud Strife's home town?\",\r\n \"a. Zozo\", \"b. Cornelia\", \"c. Nibelheim\", \"d. Pallet town\", \r\n \"c\")\r\n \r\n #Call upon the disp_q method and pass it the third question\r\n SQ.disp_q(\"In which games do the Mime GOGO appear in?\",\r\n \"a. FF/FF2\", \"b. FF5/FF6\", \"c. FFTA 1&2\", \"d. FF10/FF10-2\", \r\n \"b\")\r\n \r\n #Call upon the disp_q method and pass it the fourth question\r\n SQ.disp_q(\"What is the name of Final fantasy 4's final boss?\",\r\n \"a. SIN\", \"b. Zeromus\", \"c. Necron\", \"d. Chaos\", \r\n \"b\")\r\n \r\n #Call upon the disp_q method and pass it the fifth question\r\n SQ.disp_q(\"Where did Gilgamesh get banished to in FF5?\",\r\n \"a. The Moon\", \"b. Lhusu mines\", \"c. Earth's Core\", \"d. The Void\", \r\n \"d\")\r\n \r\n #Call upon the disp_q method and pass it the sixth question\r\n SQ.disp_q(\"What is the name of the the first two super Bosses in a FF game?\",\r\n \"a. Bahamut,Leviathan\", \"b. Ruby Weapon,Emerald Weapon\", \"c. Zoadark,Yaizmat\", \"d. Omega,Shinryu\", \r\n \"d\")\r\n \r\n #Call upon the disp_q method and pass it the seventh question\r\n SQ.disp_q(\"What is the name of FF9's Zidane Tribal's home planet?\",\r\n \"a. The Moon\", \"b. Gaia\", \"c. Terra\", \"d.earth\", \r\n \"c\")\r\n \r\n #Call upon the disp_q method and pass it the eighth question\r\n SQ.disp_q(\"In which Game did you draw magic from the world and from monsters?\",\r\n \"a. FF2\", \"b. FF 8\", \"c. FF3\", \"d. FF9\", \r\n \"b\")\r\n \r\n #Call upon the disp_q method and pass it the nineth question\r\n SQ.disp_q(\"What is the name Rinoa's Dog in FF8?\",\r\n \"a. Interceptor\", \"b. Red XIII\", \"c. Enkidu\", \"d. Angelo\", \r\n \"d\")\r\n \r\n #Call upon the disp_q method and pass it the tenth question\r\n SQ.disp_q(\"What item Does Cecil have to use against the final Boss in FF4'?\",\r\n \"a. The Excalibur\", \"b. A Flute\", \"c. Friendship\", \"d. CRYSTAL \", \r\n \"d\")\r\n \r\n \r\n #Call upon the Quiz class's determine_grade method to display\r\n #the player's grade and assigned rank\r\n SQ.determine_grade\r\n \r\n #Call upon the Quiz class's display_credits method to thank\r\n #the player for taking the quiz and to display game information\r\n SQ.display_credits\r\n \r\n \r\n\r\n\r\n\t \r\n \r\n\t \r\n\t \r\n end\r\n \r\n\t\r\n\t\r\n Console_Screen.pause #Pause the game\r\n \r\n end",
"def display_subjects(database)\r\n\tsubjects = database.execute(\"SELECT * FROM subjects\")\r\n\tsubjects.each do |subject|\r\n\t\tputs \"ID: #{subject[0]} Subject: #{subject[1]}\"\r\n\tend\r\nend",
"def determine_grade\r\n \r\n Console_Screen.cls #Clear the display area \r\n \r\n #To pass the test, the player must correctly answer at least 3 questions\r\n if $noRight >= 3 then\r\n \r\n #Inform the player of the good news and assign a ranking\r\n print \"You correctly answered \" + $noRight.to_s + \" question(s). \"\r\n puts \"You have passed the \\nSuperman Movie Trivia Quiz!\\n\\n\"\r\n puts \"You have earned a rank of: Good Citizen\" if $noRight == 3\r\n puts \"You have earned a rank of: Side Kick\" if $noRight == 4\r\n puts \"You have earned a rank of: Superhero\" if $noRight == 5\r\n print \"\\n\\nPress Enter to continue.\"\r\n \r\n else #Player has failed the quiz\r\n \r\n #Inform the player of the bad news\r\n print \"You missed \" + (5 - $noRight).to_s + \" questions. \"\r\n puts \"You have failed the Superman Movie Trivia Quiz.\"\r\n puts \"Perhaps you should watch the movies again before returning to\"\r\n puts \"retake the quiz.\"\r\n print \"\\n\\nPress Enter to continue.\"\r\n \r\n end\r\n \r\n Console_Screen.pause #Pause the game\r\n \r\n end",
"def display(dead_man)\n puts @letters_guessed_array.join(\" \")\n puts \"\\n\"\n dead_man.show_wrong_letters unless dead_man.wrong_letters.empty?\n dead_man.description unless dead_man.wrong_guesses == 0\n end",
"def print_menu\n puts \"\"\"\n 1. Input the students\n 2. Show the students\n 9. Exit\n \"\"\"\nend",
"def display_students\n all_students = @conn.exec(\"SELECT * FROM students;\")\n all_students.each do | student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\n end\nend",
"def print_stats_table()\n res = @db.query(\"SELECT * FROM UserStats;\")\n while row = res.fetch_row do\n printf \"%s %s\\n\", row[0], row[1], row[2], row[3]\n end\n end",
"def day_printer(db)\n puts \"Here are your recorded health stats from today (#{$health[0][1]})=\"\n puts \" Steps Walked/Ran: #{$health[0][4]}\"\n puts \" Physical Status: #{$health[0][2]}/10\"\n puts \" Mental Status: #{$health[0][3]}/10\"\n puts \" Ailment: #{$health[0][6]}\"\n puts \" Comments: #{$health[0][5]}\"\nend",
"def show_hand\n puts \"Player Score: #{player.score}: [#{player.dealt.join(\"][\")}]\"\n puts \"Dealer Score: #{dealer.score}: [#{dealer.dealt.join(\"][\")}]\"\n end",
"def game_display\n puts \" \"\n puts \" \"\n puts \"At any time, type 'save' to save and exit\"\n puts \"Guess progress: #{@secret_display}\"\n puts \"Wrong guesses: #{@wrong_guesses}\"\n puts \"Guesses remaining: #{@guess_count}\"\n end",
"def display_users_playlists(db)\n\tputs \"The users name and their playlist name\"\n\tputs \"--------------------------------------\"\n\tusers_playlist = db.execute(\"SELECT first_name,last_name,playlist_name FROM users INNER JOIN playlist USING (playlist_id) ORDER BY users.users_id;\")\n\tusers_playlist.each do |user|\n\t\tputs \"Fisrt name: #{user['first_name']} ; Last name: #{user['last_name']} ; Playlist: #{user['playlist_name']}.\"\n\tend\nend",
"def display\n print_out = $db.execute(\"SELECT Exercise.name, Workouts.date, Workouts.weight FROM Workouts JOIN Exercise ON Exercise.id = Workouts.exercise_id \")\n #print print_out\n puts \"Date: #{print_out[0][1]}\"\n puts \"Exercise: #{print_out[0][0]}\"\n\nend",
"def display_scoreboard\n puts \"The score is\"\n puts \"#{@player_1_name}\"+\" #{@player_1_score}\" \n puts \"#{@player_2_name}\"+\" #{@player_2_score}\"\n puts\n end",
"def print(students)\n students.each do |student|\n puts \"#{student[:name]}:\n likes #{student[:hobby]},\n is from #{student[:country_of_birth]},\n is #{student[:height]}\n and likes #{student[:biscuit]}s\n (#{student[:cohort]} cohort)\"\n puts\n end\nend",
"def detailed\n if (@data.length > 0)\n mygrade = grade || \"\"\n puts \"#{@type}: #{mygrade}\"\n for datum in @data\n puts \"\\t#{datum}\"\n end \n return true\n end\n end",
"def print_students_list\n if @students.length > 0\n print_info_each_student\n else puts \"No students in database\"\n end\nend",
"def print_personal_list(db, name)\r\n\tputs \"Chores for #{name}\"\r\n\tprint_chores = db.execute(\"SELECT chores.complete_by_day, chores.name FROM chores, family WHERE family.name = ? AND chores.family_id = family.id\", [name])\r\n\tprint_chores.each do |x|\r\n\t\tputs \"#{x[0]} : #{x[1]}\"\r\n\tend\r\nend",
"def display_leaderboard\n system(\"clear\")\n puts \"##############################\"\n puts \"# L E A D E R B O A R D \"\n puts \"#-----------------------------\"\n puts \"# | | \"\n puts \"# DATE | SCORE | USERNAME \"\n puts \"#------------|-------|----------\"\n leaderboard_info\n puts \"# \"\n puts \"##############################\" \n any_key\n menu\n end",
"def view_all(db, user_id)\n results = db.execute(\"SELECT exercises.name, exercises_users.reps, exercises_users.weight \n FROM users \n JOIN exercises_users ON users.id = exercises_users.user_id \n JOIN exercises ON exercises_users.exercise_id = exercises.id WHERE users.id = ?\", [user_id])\n results.each do |info_array|\n puts \"#{info_array[0]}:\\t #{info_array[1]} reps\\t #{info_array[2]} pounds\"\n end\nend",
"def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{student[:hobby]}, Country = #{student[:country]}\".center(80)\n end\n end\nend",
"def displayed_grade\n (grade * 4 + 1).to_i\n end",
"def help\n system 'clear'\n puts Rainbow(\"Here is a list of all available student names:\").blue\n puts \"\"\n @studentsArray.sort_by { |x| x[\"name\"] }.each { |x| print x[\"name\"].split.map(&:capitalize).join(' ') + \", \"}\n puts \"\"\n puts \"\"\n main\nend",
"def print_student_list(students)\n puts \"Students:\"\n puts \"----------------\"\n students.each do |student|\n puts \"#{student[:name]}, Cohort: #{student[:cohort]}\"\n end\n puts \"Overall, we have #{students.count} students\"\nend",
"def display_personal_information()\n # Display Personal Information\n puts \"Name: #{ @name } ID: #{ @id }\"\n puts \"Anual income: #{ @anual_income }\"\n average = average()\n puts \"Grade average: #{ average }\"\n end",
"def grade_with_label\n \"Grade: #{grade}\"\n end",
"def display_all_scores\n show_wait_cursor(3)\n all_scores = @score_table.score_table\n say '----------------------'.yellow\n all_scores.each { |s| say 'player:' + all_scores.index(s).to_s.blue + ' score: ' + s.to_s.red }\n say '----------------------'.yellow\n end",
"def show_score\n puts\n @@score.each do |player, score|\n print \"- #{player.capitalize}: #{score} -\"\n end\n puts\n end",
"def displayUpdateInstr\n puts \"Type a letter to execute the corresponding command:\"\n puts \"a - update name\"\n puts \"b - update number\"\n puts \"c - update e-mail address\"\n puts \"d - update relation to you\"\n puts \"e - update city\"\nend",
"def dbtools_usage\n puts \"Available Options for Database Tools Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n# puts \"mssqlc \".light_yellow + \" => \".white + \"MS-SQL Client\".light_red\n# puts \"mssql_login \".light_yellow + \" => \".white + \"MS-SQL Login Bruter\".light_red\n puts \"mysql-fu \".light_yellow + \" => \".white + \"MySQL-Fu Client Tool\".light_red\n puts \"mysql_check \".light_yellow + \" => \".white + \"MySQL Credential Check\".light_red\n puts \"mysql_login \".light_yellow + \" => \".white + \"MySQL Login\".light_red\n puts \"auth_bypass \".light_yellow + \" => \".white + \"MySQL Auth Bypass Exploit (CVE-2012-2122)\".light_red\n puts \"mysql_mof \".light_yellow + \" => \".white + \"Windows MySQL Privileged User to SYSTEM MOF Exploit\".light_red\n puts \"mysql_udf \".light_yellow + \" => \".white + \"Windows MySQL Privileged User to SYSTEM UDF Exploit\".light_red\n print_line(\"\")\nend",
"def display_lifts(db)\n lifting_data = db.execute(\"SELECT * FROM lifting\")\n lifting_data.each do |lifts|\n puts \"On #{lifts['date']} you weighed #{lifts['body_weight']}. These we're your lifts for that day:\"\n puts \"You squatted #{lifts['squats']}lbs \" if lifts['squats'] != \"\"\n puts \"You benched #{lifts['bench_press']} lbs\" if lifts['bench_press'] != \"\"\n puts \"You pressed #{lifts['overhead_press']} lbs\" if lifts['overhead_press'] != \"\"\n puts \"You deadlifted #{lifts['deadlifts']} lbs\" if lifts['deadlifts'] != \"\"\n puts \"You power cleaned #{lifts['power_cleans']} lbs\" if lifts['power_cleans'] != \"\"\n end\nend",
"def print_list(db, current_user)\r\n results = db.execute(\"SELECT * FROM items WHERE user_id = ?\", [current_user])\r\n results.each do |item|\r\n puts \"#{item[1]} x#{item[2]}\"\r\n end\r\nend",
"def display_helper(round, score = [\"-\", \"-\", \"-\", \"-\"], feedback = [\"-\", \"-\", \"-\", \"-\"])\n\t\tputs \"\\nRound #{round}\\n#{score[0]} #{score[1]} #{score[2]} #{score[3]}\" \\\n\t\t \"\\n#{feedback[0]} #{feedback[1]} #{feedback[2]} #{feedback[3]}\"\n\tend",
"def print_voters_who_voted_for_politician\n\tputs \"People & Who they voted for\"\n\tputs $db.execute(SELECT name || ' - ' ||GROUP_CONCAT(first_name|| ' ' ||last_name, ', ')FROM congress_members JOIN votes ON congress_members.id = cotes.politician_id JOIN voters ON voters.id = votes.voter_id GROUP BY name)\n\nend",
"def display_profile_options\n puts \"1. Back to Main Menu\"\n puts \"2. Remove a Beer from My Interests\"\n puts \"3. Refresh Page\"\n puts \"4. Logout\"\n print_line\nend",
"def print_list(db)\t\n\tpresent = db.execute(\"SELECT * FROM personal_gift JOIN purchased ON personal_gift.purchased_id=purchased.id;\")\n\n\tpresent.each do |present|\n\t \tif present['purchased'] == 0\n\t \t\tputs \"You need to buy a #{present['gift']} for #{present['name']}. It costs $#{present['cost']}.\"\n\t \telsif present['purchased'] == 1\n\t \t\tputs \"You bought a #{present['gift']} for #{present['name']}. It cost $#{present['cost']}.\"\n\t\tend\n\tend\nend",
"def displayScore()\n puts \"#{name} has #{@hand.length} cards in their deck\"\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend",
"def display_hand\n hand.each do |card|\n puts \"#{card.value} of #{card.suit}\"\n end\n puts \"#{name} has a #{self.get_hand_score}.\\n\\n\"\n end",
"def print_current_students(students)\n\tstr = \"Currently we have #{students.length} student#{'s' if is_plural?(students.length)}\\n\"\n\tprint str\nend",
"def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end",
"def print_results(name, result, score, separator = \"\\n\")\n print \" \" + name.ljust(24).slice(0, 23) +\n \" Result: \" + result.ljust(10).slice(0, 9) +\n \" Score: \" + score.to_s.ljust(10).slice(0, 9) +\n separator\n end",
"def display_query_sql(users)\n tag.p('SQL:') + tag.code(users.to_sql)\n end",
"def display (students)\n students.each do |cohort, num|\n puts \"#{cohort}: #{num}\"\n end\nend",
"def display_details()\n\t\tputs \"------------------------------\"\n\t\tputs \"User Details\"\n\t\tputs \"#{@first_name} #{@surname} aged '#{@age}'\"\n\t\tputs \"------------------------------\"\n\tend",
"def apt_viewer(db)\n apts = db.execute(\"SELECT * FROM apt_list\")\n apts.each do |apt|\n puts \"\\n\\nApt #{apt['id']}) #{apt['name']}, located at #{apt['address']} is rated #{apt['rating']} because #{apt['comments']}.\\nThe monthly rent is in the range of #{apt['rent_range']} and includes #{apt['amenities']} with an average rush-hour commute time of #{apt['commute']} minutes.\"\n end\nend",
"def grade_display_text(grade)\n (grade && grade.score) || 'N'\n end",
"def print\n $stdout.puts(\"DB #{@context.getDBConnection.toString}\")\n end",
"def print_body(students)\n students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort) #{student[:height]} #{student[:hobbies]} #{student[:age]}\".center(35)\n end\nend",
"def grade(grade)\n roster.each do |k|\n if k[:grade] == grade\n puts \"The following students are in Grade #{grade}: #{k[:students]}\"\n return k[:students]\n end\n end\n end",
"def display\n puts \"Title: #{@title}\"\n puts \"Author: #{@author}\"\n puts \"Price: #{@price}\"\n end",
"def print(students)\n students.each do |student|\n puts \"#{student[:name]}, (#{student [:cohort]} cohort), Place of birth: #{student[:country]}, Favourite hobby: #{student[:hobby]}\"\n end\nend",
"def display_songlist(db)\n\tputs \"The songs are:\"\n\tputs \"--------------\"\n\tsongs = db.execute(\"SELECT * FROM songlist;\")\n\tsongs.each do |song|\n\t\tputs \"SONG ID: #{song['song_no']} SONG NAME: #{song['song_name']}.\"\n\tend\nend",
"def display_board\n system \"clear\"\n puts \"Super Fight Bros. Leaderboard by Combat\"\n header = ['#', 'Player', 'Power', 'Combat']\n rows = parse_players(Superhero.order(combat: :desc).limit(10))\n table = TTY::Table.new header, rows\n puts table.render(:unicode)\n begin \n puts \"Please press M to go back to the menu\"\n end while !input_check(\"M\")\n end",
"def print_final_report\n puts; puts; puts \"=== FINAL DATABASE COUNTS ===\"\n puts; puts end_of_task_report\n puts; puts; puts \"=== BY SCHOOL ===\"\n puts by_school_report\n puts; AssessmentsReport.new.print_report\n end",
"def list(selection)\n\tselection.each_with_index do |student, x|\n\t\tprint x + 1\n\t\tputs \" #{student[:name].center(30)} \" + \" #{student[:cohort].center(25)}\" + \" #{student[:birth].center(20)}\" + \" #{student[:hobby].center(25)}\"\n\tend\nend",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def print_courses\n @learn_courses.each do |course|\n puts course.name.foreground(:yellow)\n end\n end",
"def print_menu\n puts \"Select one of the following options:\"\n puts \"----//--------//------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list of students\"\n puts \"4. Load the list of students\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def print_menu\n puts \"User's Menu\\n-----------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend",
"def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end",
"def user_prompt\n\t\t\tputs \"\\n \\n \\n \\n\"\n\t\t\tputs \"_ _ _ _ ( _ _ _ _ )\"\n\t\t\tdisplay_rows\n\t\tend",
"def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend",
"def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list to a file\"\n puts \"9. Exit\"\nend",
"def display\n print \"Quote ##{id}\\n\"\n print \"Link: #{link}\\n\"\n @quote.each do |item|\n add_user(item[0])\n print \"#{$using_color \\\n ? colorize(@usernames[item[0]], item[0]) \\\n : item[0]} #{item[1]}\\n\"\n end\n end",
"def display_incorrect_guesses\n if @wrong_guesses.empty?\n puts 'No wrong guesses so far.'\n else\n print 'Wrong guesses: '\n @wrong_guesses.each do |letter|\n print \"#{letter} \"\n end\n end\n end",
"def display_character_blah\n \n puts \"Name: #{name}\"\n puts \"Bio: #{description}\"\n end",
"def determine_grade\n\n\tConsole_Screen.cls #clear the display area\n\n\t#to pass the test the player must corretly retype 3 sentences\n\n\tcase \n\n\twhen ($noRight == 10 || $noRight == 9)\n\t\tputs \"Congrats you received an A!\"\n\twhen ($noRight == 8)\n\t\tputs \"You got a B!\"\n\twhen ($noRight == 7)\n\t\tputs (\"Okay, you got a C! Not bad!\")\n\twhen ($noRight == 6)\n\t\tputs (\"You got a D, try harder!\")\n\twhen ($noRight <= 5)\n\t\tputs (\"You got an F bud.\")\n\t\t\n\t\n\n\tend\n\nend",
"def disp\n\t\tputs \"#{@aname} belongs to #{@cuisine} and has #{@ingredients} you can make it by #{@procedure}\"\n\t\t\n\tend",
"def show_list(db)\n\tcurrent_list = db.execute(\"Select * FROM list\")\n\tcurrent_list.each do |row|\n\tputs \"ID: #{row['id']} | #{row['name']} | #{row['gift']} | #{row['price']}\"\n\tend\n\tputs \"---------------------------\"\nend"
] | [
"0.78189224",
"0.72039473",
"0.67393196",
"0.65408653",
"0.6480849",
"0.6253863",
"0.6248736",
"0.62272745",
"0.62171775",
"0.62033147",
"0.61609966",
"0.61529076",
"0.61370504",
"0.61213833",
"0.6031915",
"0.5981624",
"0.5957633",
"0.5948583",
"0.59450686",
"0.59396863",
"0.5912077",
"0.59026337",
"0.5878613",
"0.5873317",
"0.58723134",
"0.5856337",
"0.58396226",
"0.5819734",
"0.5815435",
"0.58128834",
"0.579998",
"0.5783793",
"0.57837206",
"0.5779673",
"0.57795256",
"0.5771417",
"0.5759816",
"0.57421625",
"0.57286096",
"0.5718047",
"0.5706668",
"0.5706263",
"0.5699893",
"0.56955177",
"0.5647929",
"0.5644678",
"0.5644226",
"0.56408083",
"0.56392366",
"0.56368136",
"0.5625913",
"0.56236964",
"0.5620449",
"0.5608779",
"0.56026185",
"0.5598843",
"0.55929255",
"0.55919486",
"0.55791193",
"0.55707026",
"0.55693007",
"0.55666906",
"0.5565593",
"0.55566937",
"0.55492496",
"0.55489033",
"0.5537579",
"0.5534719",
"0.5534424",
"0.5521928",
"0.5500891",
"0.54982007",
"0.54910606",
"0.54883486",
"0.548616",
"0.5479913",
"0.5479252",
"0.5474298",
"0.546009",
"0.5458583",
"0.54565233",
"0.5440968",
"0.54311115",
"0.5417011",
"0.54151183",
"0.5414503",
"0.5414405",
"0.54136693",
"0.54047215",
"0.5399787",
"0.5398597",
"0.5393495",
"0.5393495",
"0.539182",
"0.53907806",
"0.5389948",
"0.53884697",
"0.5388338",
"0.53869593",
"0.53866583"
] | 0.5833031 | 27 |
characters from the combined string. Each word will contain at least one letter. All words will be lower cased. | def count_unique(s1, s2)
(s1 + s2).chars.uniq.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_me(string)\n string = string.split(\" \")\n collection = []\n string.each do |word|\n collection << word.gsub(/[^A-Za-z]/,\"\").chars.sort.join\n end\n collection.join(\" \")\nend",
"def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end",
"def only_alpha(string)\r\n\ts = string.split(\"\")\r\n\tstring1=\"\"\r\n\ts.each do |letter|\r\n\t\tif (letter >= \"a\" && letter <= \"z\") || (letter >= \"A\" && letter <= \"Z\")\r\n\t\t\tstring1 += letter\r\n\t\tend\r\n\tend\r\n\tputs string1\r\nend",
"def join_alphabets(input)\n\toutput = \"\"\n\tinput.split(\"\").each do |letter|\n\t\tif (letter.ord >= 65) && (letter.ord <= 90)\n\t\t\toutput += letter \n\t\tend\n\tend\n\treturn output\nend",
"def solution(string)\n result = \"\"\n string.each_char do |char|\n if char =~ /[A-Z]/\n result += \" #{char}\" \n else\n result += char\n end\n end\n result\nend",
"def staggered_case(words)\n mixed_chars = words.chars.each_with_index.map do |char, index|\n if index.even? && char =~ /[a-zA-Z]/\n char.upcase\n elsif index.odd? && char =~ /[a-zA-Z]/\n char.downcase\n else\n char\n end\n end\n mixed_chars.join\nend",
"def display_word(word, triedchars)\n res = \"\"\n word.split(\"\").each do |char|\n if triedchars.include?(char.upcase) or not char.match(/^[[:alpha:]]$/)\n res += char\n elsif\n res += \"_\"\n end\n end\n res\nend",
"def words(string)\n return [] if string.nil?\n allowed = [' ', 'a-z', 'A-Z', '0-9'] + String::LATIN_MAP.values\n disallowed = ['¿', '¡'] # Add some disallowed chars that cannot be catched. TODO: Improve!\n match = /[^#{allowed.join('')}]/\n string.\n gsub(/\\s+/mu, ' ').\n gsub(/[#{disallowed.join}]/u, '').\n gsub(/#{match}+ /u, ' ').\n gsub(/ #{match}+/u, ' ').\n gsub(/#{match}+$/u, '').\n gsub(/^#{match}+/u, '').\n split(/ /)\n end",
"def basic_letter_parse(letters)\n matching_words = []\n regex = Regexp.new(\"[#{letters}]\").freeze\n @words_collection.each do |word|\n for i in 0..word.length-1 do\n letter = word[i]\n break unless letter =~ regex\n matching_words << word if i == word.length - 1\n end\n end\n matching_words\nend",
"def letters\n self.chars.select { |c| c.match(/[a-z]/i) }.join\nend",
"def words_from_string(string) \t\t\t# downcase returns a lowercase version of a string\n\tstring.downcase.scan(/[\\w']+/)\t\t# scan returns an array of substrings that match a pattern\n\tend",
"def wave(str)\n result = []\n arr = str.dup.chars\n arr.each_with_index do |element, idx|\n if element =~ /[a-zA-Z]/\n arr[idx].upcase!\n result << arr.join\n arr[idx].downcase!\n else next\n end\n end\n result\nend",
"def words_from_string(string)\r\n string.downcase.scan(/[\\w']+/)\r\nend",
"def accum(s)\n\tletters = s.split(\"\")\n accumulated_letters = []\n\n i = 0\n while i < letters.length()\n accumulated_letters.push(letters[i].upcase + (letters[i].downcase * i))\n i += 1\n end\n\n accumulated_letters.join(\"-\")\nend",
"def all_caps(words)\n\t\twords = words.to_s\n\t\tif words.length < 10\n\t\t\tputs \"not 10 chars\"\n\t\telse\n\t\t\tputs words.upcase\n\t\tend\n\tend",
"def solution(string)\n # lowers = string.scan(/[a-z]+[A-Z]/).join\n uppers = string.scan(/[A-Z][^A-Z]+/).join(' ')\n # lowers + \" \" + uppers\n # require 'pry'; binding.pry\n\nend",
"def letters\n the_letters = []\n letter_regex = /[a-z]/i\n chars.each do |character|\n the_letters << character if character.match(letter_regex)\n end\n the_letters.join\n end",
"def staggered_case_not_count_non_alphabetic(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend",
"def borrow(speech)\n answer = []\n speech.split(' ').each do |word|\n word.split('').each do |char|\n ascii = char.ord\n if (ascii >= 97 && ascii <= 122) || (ascii >= 65 && ascii <= 90)\n answer << char.downcase\n end\n end\n end\n answer.join\nend",
"def staggered_case(str)\narray = str.split(\"\")\nneed_upper = true\nresult = []\narray.each do |char|\n if char.match(/[a-zA-Z]/) && need_upper == true\n result.push(char.upcase)\n need_upper = !need_upper\n elsif char.match(/[a-zA-Z]/)\n result.push(char.downcase)\n need_upper = !need_upper\n else result.push(char) \n end\n \nend\nresult.join(\"\")\nend",
"def words_from_string(string) \n string.downcase.scan(/[\\w']+/)\nend",
"def alphanumeric_words\n /([a-zA-Z0-9]*\\w)/\n end",
"def words(string)\n string.downcase.scan(/[\\w']+/)\nend",
"def processed\n self.scan(/[a-z]/i).join.downcase\n end",
"def words(text)\n text.downcase.scan(/[a-z]+/)\nend",
"def staggered_case_opt(string, ignore_non_alpha: true)\n process = true\n\n result = string.chars.map do |char|\n if ignore_non_alpha && char =~ /[a-z]/i\n process ? char.upcase! : char.downcase!\n process = !process\n elsif !ignore_non_alpha\n process ? char.upcase! : char.downcase!\n process = !process\n end\n char\n end\n\n result.join\nend",
"def depunctuate(a_string)\n alphabet = [*\"A\"..\"Z\"] + [*\"a\"..\"z\"]\n result = \"\"\n a_string.length.times do |i|\n if alphabet.include?(a_string[i])\n result << a_string[i]\n end\n end\n result\nend",
"def eval_ele(word)\n\n formWord = []\n word.each_char.with_index do |let, idx|\n if idx == 0\n formWord << word[idx].upcase\n else\n formWord << word[idx].downcase\n end\n end\n\n return formWord.join(\"\")\n\nend",
"def word_cap(string)\n words = string.split(' ')\n words.map! do |word|\n characters = word.chars\n characters[0] = characters[0].upcase\n characters.join(\"\")\n end\n words.join(\" \")\nend",
"def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend",
"def alphabetized(str)\n array = str.chars\n array.delete_if { |x| x =~ /[\\W_]/ }\n array.sort { |a,b| a.downcase <=> b.downcase }.join\nend",
"def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"def solution(string)\n\talphabet = (\"A\"..\"Z\").to_a\n\n\tarr = []\n\tstring.chars.each do |letter|\n\t\tif alphabet.include?(letter)\n\t\t\tarr << \" \"\n\t\t\tarr << letter\n\t\telse\n\t\t\tarr << letter\n\t\tend\n\tend\narr.join\nend",
"def word_cap(str)\n new_words = \n str.downcase.split.map do |word|\n word[0] = (word[0].ord - 32).chr if word[0].ord.between?(97,122)\n word\n end\n new_words.join(\" \")\nend",
"def words_from_string(string)\n\tstring.downcase.scan(/[\\w']+/) #Return a downcase version of a string, scan returns an array of substrings that match a given pattern\nend",
"def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend",
"def word_cap2(str)\n str.split(' ').map { |wrd| wrd[0].upcase + wrd[1..-1].downcase }.join(' ')\nend",
"def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1 if char =~ /[a-zA-Z]/\n #if char =~ /[a-z]/i <--LS\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend",
"def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end",
"def convert_sent sent\n # y = []\n # sent.split(' ').each do |x|\n # y << x.split('')\n # end\n # y\n # sent.split(' ').map(&:chars)\n\n alpha = ('a'..'z').to_a\n\n sent.chars.map(&:downcase).reject{ |x| x == ' ' }.uniq.sort == alpha\n sent.chars.map(&:downcase).reject{ |x| x == ' ' }.uniq.push('x').sort == alpha\n\nend",
"def wave(str)\n words = str.split(\"\")\n result = []\n words.each_with_index do |letter, index|\n if letter != \" \"\n words[index].replace(letter.upcase)\n result << words.join(\"\")\n words[index].replace(letter.downcase)\n end\n end\n result\nend",
"def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end",
"def crunch(str)\n str.split.map do |word|\n word.chars.each_with_object('') do |char, clean_word|\n clean_word << char if char != clean_word[-1]\n end\n end.join(' ')\nend",
"def start_of_word(str,index)\n if str.length > 1\n str.slice(0,index)\n else\n alphabet= (\"a\"..\"z\").to_a\n alphabet_seq = (\"a\"..alphabet[index]).to_a\n alphabet_seq.join\n end\nend",
"def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend",
"def spell_out strings\n strings.downcase.split(\"\").join(\"-\")\nend",
"def staggered_case(string)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if need_upper && char =~ /[a-zA-Z]/\n result += char.upcase\n need_upper = !need_upper\n elsif !need_upper && char =~ /[a-zA-Z]/\n result += char.downcase\n need_upper = !need_upper\n else\n result += char\n end\n end\n result\nend",
"def staggered_case(string)\n process = true\n\n result = string.chars.map do |char|\n if char =~ /[a-z]/i\n process ? char.upcase! : char.downcase!\n process = !process\n char\n else\n char\n end\n end\n\n result.join\nend",
"def split_on_caps(word)\n word.split(/(?=[A-Z])/).join(\" \")\n end",
"def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend",
"def staggered_case_include_non_alpha(string, upcase_or_downcase=\"upcase\")\n # new_array = []\n # string.chars.each_with_index do |char, index|\n # new_array[index] = index.even? ? char.upcase : char.downcase\n # end\n # new_array.join\n result = ''\n need_upper = upcase_or_downcase == \"upcase\"\n string.chars.each do |char|\n result += if need_upper\n char.upcase\n else\n char.downcase\n end\n need_upper = !need_upper\n end\n result\nend",
"def LetterChanges(str)\n filtered = \"\"\n result = \"\"\n\n str.each_char do |i|\n if /[a-yA-Y]/ =~ i\n filtered << i.next\n elsif i == \"z\"\n filtered << \"a\"\n elsif i == \"Z\"\n filtered << \"A\"\n else\n filtered << i\n end\n end\n\n filtered.each_char do |i|\n if /[aeiou]/ =~ i\n result << i.upcase\n else\n result << i\n end\n end\n\n result\nend",
"def best_practice_solution(str)\n result = []\n chars = str.downcase.chars\n chars.each_with_index do |char, idx|\n next if char == \" \"\n result << str[0...idx] + char.upcase + str[idx+1..-1]\n end\n result\nend",
"def filter_repeated_character_strings(arr)\n results = []\n\n index = 0\n arr.each do |word|\n char_index = 0\n main_char = \"\"\n other_char = false\n\n word.chars.each do |char|\n char_index += 1\n\n if char_index == 1\n main_char = char\n end\n if main_char != \"\" && char == main_char\n if char_index == word.length && other_char == false\n results.insert(index, word)\n\n index += 1\n end\n else\n other_char = true\n end\n end\n end\n\n return results\nend",
"def staggered_case(string)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if char =~ /[a-zA-Z]/\n if need_upper\n result << char.upcase\n else\n result << char.downcase\n end\n need_upper = !need_upper \n else\n result << char\n end\n end\n result\nend",
"def ordered_vowel_words(string)\n output_string = []\n string.scan(/\\w+/).each {|word| output_string << word if word_valid?(word) }\n output_string\n (string.split.size == 1 && word_valid?(string) == false) ? \"\" : output_string.join(' '))\nend",
"def staggered_case_1(string)\n\tflag = true\n\tnew_string = string.chars.map do |char|\n\t\tif char =~ /[A-Za-z]/\n\t\t\tif flag\n\t\t\t\tchar.upcase!\n\t\t\telse\n\t\t\t\tchar.downcase!\n\t\t\tend\n\t\t\tflag = !flag\n\t\t\tchar\n\t\telse\n\t\t\tchar\n\t\tend\n\tend\n\tnew_string.join(\"\")\nend",
"def pig_it(string)\n arr = string.split(\" \")\n result = \"\"\n arr.each do |word|\n # Check if word is containing only letters and not special characters\n if word.match? /\\A[a-zA-Z']*\\z/\n result += (word[1..-1] + word[0] + \"ay \")\n else\n result += (word + \" \")\n end\n end\n result[0...-1]\nend",
"def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend",
"def autocomplete(input, dictionary)\n words = Array.new\n dictionary.each do |word|\n if (word.gsub(/[^a-zA-Z]/, '')).downcase.start_with? (input.gsub(/[^a-zA-Z]/, '')).downcase\n words << word\n end\n end\n return words.first(5)\nend",
"def staggered_case(str, first:'', no_alpha:true)\n first_downcase = first == 'downcase' ? true : false\n str.each_char.inject('') do |staggered, letter|\n # do letters\n if /[a-zA-Z]/ =~ letter\n first_downcase = !first_downcase\n if first_downcase\n staggered << letter.upcase\n else\n staggered << letter.downcase\n end\n # ignore no letters\n else\n # consider or not non alpha chars\n no_alpha || first_downcase = !first_downcase\n staggered << letter\n end\n end\nend",
"def staggered_case(string)\n index = 0\n characters = string.split('')\n loop do\n break if index >= characters.size\n if characters[index] =~ /[a-zA-Z]/ && index.even?\n characters[index].upcase!\n elsif characters[index] =~ /[a-zA-Z]/ && index.odd?\n characters[index].downcase!\n end\n index += 1\n end\n characters.join('')\nend",
"def processed_content\n letter_regex = /[a-z0-9]/i\n to_s.scan(letter_regex).join.downcase\n end",
"def words\n @phrase.split(/[^A-Za-z0-9']+/)\n end",
"def alphabetized(s)\n s.scan(/[a-z]/i).sort_by(&:downcase).join\nend",
"def spell_out(string)\n arr = string.downcase.split(\"\")\n arr.join(\"-\")\nend",
"def word_cap3(str)\n str.split.map { |word| word.sub(word[0], word[0].upcase) }.join(\" \")\nend",
"def alphabetized(string)\n string.delete(\"^A-Za-z\").chars.sort_by { |char| char.downcase}.join\nend",
"def get_all_letters_in_array_of_words(array)\n array.join.split(\"\").sort \nend",
"def destructive_uppercase(str)\n letters = (\"a\"..\"z\").to_a\n our_str = str.chars\n x = our_str.select {|x| !letters.include?(x)}\n x.join\nend",
"def combinations\nputs \"Enter text\"\ntext = gets.chomp\nputs text\nwords = text.scan /\\w/\n\n\n\nputs words\nend",
"def reverberate(sent) \n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n\n words.each do |word|\n if word.length < 3 \n new_words << word \n elsif vowels.include?(word[-1].downcase)\n new_words << word + word.downcase\n else\n i = word.length - 1\n while i >= 0 \n if vowels.include?(word[i]) \n new_words << word + word[i .. -1]\n break\n end \n\n i -= 1\n end \n end \n end \n\n new_words.join(' ')\n\nend",
"def autocomplete(input, dictionary)\n results = []\n sanitized_input = input.gsub(/[^A-Za-z]/, '')\n\n dictionary.each do |word|\n break if results.length >= 5\n next unless word.downcase.start_with?(sanitized_input)\n results << word\n end\n results\nend",
"def cap_all_characters(input)\n input.map do |c|\n c.upcase\n end\nend",
"def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend",
"def get_all_letters_in_array_of_words(array)\n array.join.split('').sort\nend",
"def get_letters(word)\n word.encode('UTF-8').downcase.split(\"\")\n end",
"def characterization\n characters.reduce(\"\") {|a,b| a + b.to_s.capitalize}\n end",
"def start_of_word(a)\n return a.chars.first.join\nend",
"def wordprep(word)\n return word.gsub(/\\W/,'').downcase.chars.sort.join\nend",
"def accum2(s)\n s.chars.each_with_index.map do |c, i|\n c.upcase + c.downcase * i\n end.join('-')\nend",
"def staggered_case(string)\n char_array = string.downcase.split(\"\")\n staggered_string = \"\"\n char_array.each_with_index { |char, index|\n if index.even? && char.match?(/[a-zA-Z]/)\n staggered_string += char.upcase\n else\n staggered_string += char\n end\n }\n staggered_string\nend",
"def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\n\tend",
"def staggered_case(string, ignore_non_alphabetic = true)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if char =~ /[a-zA-Z]/ || !ignore_non_alphabetic\n if need_upper\n result << char.upcase\n else\n result << char.downcase\n end\n need_upper = !need_upper \n else\n result << char\n end\n end\n result\nend",
"def translate words\n\tarray = words.split \n\ti = 0\n\ttotal = \"\"\n\twhile i < array.length\n\t\tstring = array[i]\n\t\tif string[0] =~ /[aeiou]/\n\t\t\tresult = string + \"ay\"\n\t\telse\n\t\t\tletters = \"\"\n\t\t\tcounter = 0\n\t\t\tnumberConsanants = 0\n\t\t\twhile counter < string.length\n\t\t\t\tif string[counter] =~ /[aeiou]/\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tletters = letters + string[counter]\n\t\t\t\t\tif string[counter] == 'q' && string[counter+1] == 'u'\n\t\t\t\t\t\tletters = letters + 'u'\n\t\t\t\t\t\tnumberConsanants = numberConsanants + 1\n\t\t\t\t\tend\n\t\t\t\t\tnumberConsanants = numberConsanants + 1\n\t\t\t\tend\n\t\t\t\tcounter = counter + 1\n\t\t\tend\n\t\t\tresult = string.slice(numberConsanants, string.length) + letters + \"ay\"\n\t\tend\n\t\ttotal = total + result\n\t\tif i != array.length - 1\n\t\t\ttotal = total + \" \"\n\t\tend\n\t\ti = i + 1\n\tend\n\ttotal\nend",
"def letters\n # the_letters = []\n letter_regex = /[a-z]/i\n # for i in 0..self.length - 1\n # character = self[i]\n # if (character.match(letter_regex))\n # the_letters << character\n # end\n # end\n\n # self.chars.each do |character|\n # if character.match(letter_regex)\n # the_letters << character\n # end\n # end\n # the_letters.join\n\n # self.chars.select { |c| c.match letter_regex }.join\n\n # self.chars.map{ |c| c.match /[a-zA-Z]/ }.join\n\n self.scan(letter_regex).join\n end",
"def get_matching_chars(possible_word_chars, invalid_word_chars)\n matching_possible_word_chars = []\n possible_word_chars.each do |possible_char|\n if invalid_word_chars.include?(possible_char)\n matching_possible_word_chars << possible_char\n end\n end\n matching_possible_word_chars\n end",
"def missingChars(str)\n\t\n\t# A boolean array to store characters\n\t# present in string.\t\n\n alfabeto = 'abcdefghijklmnopqrstuvxyz' \n arr = alfabeto.split('');\n\n arrstr = str.split('');\n arrmissing = [] \n \n \n\t# Traverse string and mark characters\n\t# present in string.\n\tfor i in 0..arr.length() - 1 do\n if (arrstr.include?(arr[i].downcase) == false) and (arrstr.include?(arr[i].upcase) == false)\n arrmissing.push(arr[i].downcase) \n end \n end \n \n return arrmissing.join();\n\n \n\n\t# Store missing characters in alphabetic\n\t# order.\n\t\nend",
"def get_all_letters_in_array_of_words(array)\n\tn =['cat', 'dog', 'fish']\n\tcharacters = n.map { | animal | animal.chars }\n\tcharacters.flatten.sort\nend",
"def letters_and_digits\n self.to_s.scan(/\\w/).join\n end",
"def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend",
"def non_unique_letters(string)\n string.chars.reduce([]) do |array,letter|\n if string.count(letter) > 1 && array.include?(letter) == false && letter != \" \"\n array << letter\n else\n array\n end\n end\nend",
"def common_chars(array)\n chars = array.shift.chars\n\n chars.select do |char|\n array.all? { |word| word.sub!(char, '') }\n end\nend",
"def separate_letters(word)\n word.chars.partition do |char|\n char.match(/[aeiou]/i)\n end\nend",
"def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend",
"def word_cap(string)\n capped_words =\n string.split.map do |word|\n word.downcase!\n word[0] = word[0].upcase\n word\n end\n capped_words.join(' ')\nend",
"def non_unique_letters(string)\n words = string.split(\"\")\n new_arr = []\n words.each do |char| \n if words.count(char) > 1 && char != \" \"\n new_arr << char\n end\n end \n new_arr.uniq.sort\nend",
"def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend",
"def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end"
] | [
"0.6613564",
"0.65555567",
"0.6545711",
"0.65066826",
"0.64316565",
"0.63898563",
"0.6384395",
"0.6379391",
"0.6372362",
"0.63480985",
"0.63263416",
"0.6314629",
"0.6312543",
"0.63082314",
"0.62610877",
"0.6256241",
"0.62538505",
"0.62426156",
"0.6237041",
"0.6230064",
"0.621835",
"0.6215688",
"0.6209775",
"0.6197864",
"0.61797374",
"0.61719173",
"0.6159541",
"0.6151128",
"0.6148622",
"0.6129455",
"0.61263174",
"0.6125709",
"0.6125709",
"0.6125709",
"0.61197823",
"0.6117677",
"0.6108221",
"0.60972697",
"0.6089181",
"0.60831505",
"0.60736394",
"0.6063763",
"0.60406846",
"0.6038535",
"0.60354775",
"0.6033716",
"0.60274017",
"0.60247856",
"0.6023582",
"0.6021076",
"0.60085964",
"0.60050166",
"0.6004287",
"0.599947",
"0.5997516",
"0.59896815",
"0.5989134",
"0.59889174",
"0.59840953",
"0.598014",
"0.5979799",
"0.59726423",
"0.5971098",
"0.59706604",
"0.5963916",
"0.595702",
"0.595599",
"0.5951787",
"0.5947522",
"0.5942308",
"0.5941951",
"0.59348273",
"0.593477",
"0.5934073",
"0.592843",
"0.59277654",
"0.5924726",
"0.59193474",
"0.59160745",
"0.59136105",
"0.59133756",
"0.59120804",
"0.59118813",
"0.5908685",
"0.59059525",
"0.59057975",
"0.5904422",
"0.5897682",
"0.5897156",
"0.58951575",
"0.5894871",
"0.589353",
"0.5893298",
"0.588994",
"0.58868146",
"0.5883183",
"0.5881051",
"0.5880363",
"0.5880335",
"0.5867291",
"0.58568233"
] | 0.0 | -1 |
predifiend categories in seeds file | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addCategories(filename)\n\t# Open the file with categories\n\tcategoryTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a category description. Iterate through the file and create a classification for each line.\n\tcategoryTypes.each do |curCategoryType|\n\t\tCategory.find_or_create_by( :category_description => curCategoryType.strip )\n\tend\nend",
"def db_seed_categories\n path = Rails.root.join('db','seeds','categories.yml')\n File.open(path) do |file|\n YAML.load_stream(file) do |doc|\n doc.keys.sort.each do |key|\n # puts \"Seeding comparison category structure #{key}\"\n # puts \"Warning this will delete any comparison category <-> question relationships existing for any duplicate categories\"\n attributes = doc[key]\n db_seed_category(attributes)\n end\n end\n end\nend",
"def seed_categories\n category_text = File.read(Rails.root.join('lib', 'seeds', 'categories.csv'))\n category_csv = CSV.parse(category_text, headers: true)\n\n category_csv.each_with_index do |row, index|\n Category.create(\n main_category: row[0],\n sub_category: row[1],\n external_id: index + 1\n )\n end\nend",
"def seed_categories\n ['Shelter', 'Food', 'Health', 'Jobs/Training'].each do |name|\n Category.find_or_create_by(name: name)\n end\nend",
"def addClassifications(filename)\n\t# open the file with classifications\n\tclassificationTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a classification description. Iterate through the file and create a classification for each line.\n\tclassificationTypes.each do |curClassificationType|\n\t\tClassification.find_or_create_by({ :classification_description => curClassificationType.strip })\n\tend\nend",
"def fetchCats(dataDir, minConfidence)\n return NellELoad.allCategories(dataDir, minConfidence, NellE::STRICT_TRAINING_CAT_FILENAMES)\nend",
"def training_parse(file)\n CSV.foreach(file, :encoding => 'iso-8859-1') { |row|\n @category = row[0]\n if @category == '0'\n @training_negatives += 1\n elsif @category == '2'\n @training_neutrals += 1\n else\n @training_positives += 1\n end\n @text = row[5]\n train @category, @text\n }\n population\n end",
"def seed_categories\n template_categories = [\"Toys\",\"Cards\",\"Games\",\"Misc\"]\n template_categories.each do |category|\n Category.create(name: category)\n end\n puts \"created categories\"\nend",
"def load_categories(file)\n categories = IO.readlines(file)\n\n categories.each do |cat|\n cat.strip!\n end\n\n return categories\nend",
"def set_categories\r\n csv = CSV.readlines(File.join('data', 'categories.csv'))\r\n @categories = csv.each_with_object({}) do |(key, val), hsh|\r\n hsh[key] = val\r\n end\r\n\r\n @items.each do |i|\r\n i.category = @categories[i.category]\r\n end\r\nend",
"def generate_categories\n Category.destroy_all\n\n puts 'Generating categories'\n\n Category.create(name: 'photo')\n Category.create(name: 'type')\n # Category.create(name: 'effectiveness')\nend",
"def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end",
"def initial_categories\n category_array = Array.new\n 10.times do\n category_array << Faker::Hacker.noun\n end\n add_additional_titles(category_array)\nend",
"def train(category, text)\n hash = @categories[category.to_sym] ||= Hash.new(0)\n split(text).each{|word| hash[word] += 1 }\n end",
"def handle_categories(category_names)\n return if !self.undergrad? || category_names.nil?\n self.categories = [] # eliminates any previous interests so as to avoid duplicates\n category_array = []\n category_array = category_names.split(',').uniq if category_names\n category_array.each do |cat|\n self.categories << Category.find_or_create_by(name: cat.downcase.strip)\n end\n end",
"def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end",
"def classify_key(data, filename); end",
"def make_catgraph()\n File.open(@catgraph_file, \"w\") do |catgraphf|\n i = 0\n @articles_map.keys.each do |title|\n print \"Count = #{i}\\n\"\n if title =~ /Category:/\n cats = extract_categories(title)\n cats_str = \"\"\n cats.each { |c| cats_str += \" #{c}\" }\n catgraphf.puts(\"#{@articles_map[title]}: #{cats_str}\")\n end\n i=i+1\n end\n end\n end",
"def make_new_category_file(category)\n base_yaml = {}\n base_yaml['websites'] = nil\n write_yaml(category, base_yaml) \\\n unless File.exist?(File.join(base_dir, \"_data/#{category}.yml\"))\n end",
"def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end",
"def test\n rows = Util.get_rows(:file => 'data/vehicles.csv', :n => 3000, :pre_process => true)\n classes = rows.transpose.last\n rows = rows.transpose[0..-2].transpose\n train(rows.first(2000), classes.first(2000))\n \"#{classes.last} classified as #{classify(rows.last)}\"\n end",
"def train(category, data)\n tokenize(data) { |data| @training_model[data][category.to_sym] += 1 }\n end",
"def assign_categories \n if @category_names \n self.categories = @category_names.split(/\\s+/).map do |name|\n Category.find_or_create_by_name(name)\n end\n end\n end",
"def getTrainedClassifier(trainerName,dataDir=\"project1/src/resources/data\")\n # Create Classifier\n classifier = nil\n # Train Classifier \n #@tags.each do |tag|\n Dir[dataDir+\"/*\"].each do |path|\n if path.match(/#{trainerName}\\.yml/)\n classifier = Classifier::Bayes.new(\"programming\",\"travel\",\"other\") if classifier == nil \n contents = YAML::load_file(path)\n contents.each do |content|\n if content.tag.match(/programming/)\n #puts \"Training in programming...\"\n classifier.train_programming content.text \n elsif content.tag.match(/travel/)\n #puts \"Training in travel...\"\n classifier.train_travel content.text\n else\n #puts \"Training in other...\"\n classifier.train_other content.text\n end\n end\n end\n end\n #end \n classifier\n end",
"def generate_category\n category = Category.new\n category[:name] = Faker::Commerce.department\n category[:description] = Faker::Lorem.sentence\n category.save\nend",
"def predict(tokens)\n\n @data.each do |category, counts|\n \n end\n\n predicted_category\n end",
"def seed_file(file, adjective)\n text=File.open(file).read\n text.each_line do |line|\n if Word.where(word: line.chomp).empty?\n Word.create(word: line.chomp, adjective: adjective)\n end\n end\nend",
"def load_data(fileName)\n set = open(fileName, 'r')\n data = []\n set.each_line do |line|\n categories = line.split(' ')\n data.push(categories)\n end\n return data\n end",
"def bootstrap\n create(:category_name => tl(:unassigned_category), \n :category_id => 1)\n end",
"def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end",
"def classify(text)\n choose classifications(text)\n end",
"def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n candidates = candidates_for_name(singularize_name(category.name, category.head), @category_filters)\n if !candidates.empty?\n candidate_set = create_candidate_set(category.name,candidates)\n else\n candidate_set = candidate_set_for_syntax_trees(category.head_trees,@category_filters)\n end\n if candidate_set.empty?\n candidates = candidates_for_name(category.name, @category_filters)\n candidate_set = create_candidate_set(category.name,candidates) unless candidates.empty?\n end\n @category_cache[category] = candidate_set\n end",
"def train(category, text)\n category = category.downcase\n @redis.sadd(CATEGORIES_KEY, category)\n\n count_occurance(text).each do |word, count|\n @redis.hincrby(redis_category_key(category), word, count)\n end\n end",
"def initialize(datafile)\n categoryList = []\n earnedIn = {}\n yearMatch = (/\\d\\d\\d\\d/)\n moneyMatch = (/\\d+,\\d+|NA/)\n categoryMatch = (/^\\s*\\\"+\\s*(.*?)\\s*(?:\\\"+\\s*)/)\n\n f = File.open(datafile)\n begin\n while line = f.gets\n\n if line.upcase =~ (/(ELEMENTARY|HIGH SCHOOL|COLLEGE)/)\n categoryName= line.scan(categoryMatch)[0]\n\n\n #Insert method to scan for year range\n #May need to convert year and earnings to integers rather than floats\n @nilEarn\n 33.times do\n line = f.gets\n year = (yearMatch).match(line).to_s.to_i\n earnings = line.scan(moneyMatch)[1]\n #Deal with non existant data find how to average values sets to previous year's value\n if earnings != \"NA\"\n earnings = earnings.tr(',', '').to_i\n @nilEarn = earnings\n else\n earnings = @nilEarn\n end\n\n earnedIn = earnedIn.merge( year => earnings)\n\n end\n category = Category.new(categoryName, earnedIn)\n categoryList.push(category)\n end\n end\n @categoryList = categoryList\n rescue\n\n ensure\n f.close\n end\n end",
"def grade_categories files\n files.each do |f|\n f[1]['categories'].each do |cat|\n safe_lines = f[1]['total_lines'] - cat[1]['lines_with_error']\n if safe_lines < 0\n safe_lines = 0\n end\n cat_grade = (safe_lines.to_f / f[1]['total_lines'].to_f) * 4\n cat[1] = cat[1].merge({'grade'=>cat_grade.round(1)})\n files[f[0]]['categories'][cat[0]] = cat[1]\n end\n end\n return files\n end",
"def create_items_for(restaurant)\n puts \"================================== Creating Items, Categories, and ItemCategories for #{restaurant.name}\"\n filename = restaurant.slug.gsub(/-\\d+/, '')\n contents = CSV.open \"./db/seed/items/#{filename}-items.csv\", headers: true, header_converters: :symbol\n\n contents.each do |row|\n print \".\"\n title = row[:title]\n description = row[:description]\n category = row[:category]\n price = row[:price]\n image_file_name = row[:image_file_name]\n\n # create category\n category_object = Category.find_or_create_by(title: category, type_of: 'main_menu')\n\n # create item\n item = Item.create!(\n title: title,\n description: description,\n price: price,\n image_file_name: image_file_name,\n restaurant_id: restaurant.id\n )\n \n ItemCategory.create!(category_id: category_object.id, item_id: item.id)\n end\nend",
"def setup_categories # :nodoc:\n [:event, :time, :salutation, :recurrency, :preposition,\n :article, :day, :verb, :name, :number, :interrogation].each do |category|\n @matches[category] = []\n end\n @matches[:guessing] = false\n end",
"def test_feature_for_category\r\n\t\tfeatures = Feature.for_category(categories(:root).id, 99)\r\n\r\n\t\tassert_equal(2, features.length)\r\n\t\tassert_equal(true, features.include?(products(:persian)))\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\r\n\t\tfeatures = Feature.for_category(categories(:livestock).id, 99)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\t\tassert_equal(true, features.include?(products(:optioner)))\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id, 99)\r\n\r\n\t\tassert_equal(3, features.length)\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\t\tassert_equal(true, features.include?(products(:cow3)))\r\n\t\tassert_equal(true, features.include?(products(:optioner))) # inherited from livestock\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\t# check that the correct number is given when the number to return is < the number of\r\n\t\t# results found in the db\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id, 1)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\t# check a blank return\r\n\t\tfeatures = Feature.for_category(categories(:utilities).id, 1)\r\n\r\n\t\tassert_equal(0, features.length)\r\n\tend",
"def load_data\n\t\tFile.open(\"#{@path_to_training}\", \"r\").each_line do |line|\n\t\t\ta = line.split\n\t\t\tadd_movie(a[1].to_i, a[0].to_i, a[2].to_i)\n\t\t\tadd_user(a[0].to_i, a[1].to_i, a[2].to_i)\n\t\tend\n\t\tif File.file?(\"#{@path_to_test}\") then\n\t\t\tFile.open(\"#{@path_to_test}\", \"r\").each_line do |line|\n\t\t\t\ta = line.split\n\t\t\t\t@list_of_test_set << Rating.new(a[0].to_i, a[1].to_i, a[2].to_i)\n\t\t\tend\n\t\tend\n\tend",
"def writeup_classification\n classification_label().split(\"-\").first\n end",
"def preprocess_data(file_name = \"votes-train.csv\")\n classified_data = []\n File.open(file_name, \"r\") do |f|\n f.each_line do |line|\n next if line.chomp.empty?\n partition = line.partition(\",\")\n classified_data << [partition.last.chomp.split(\",\").map(&:to_f), partition.first.to_f]\n end\n end\n classified_data\nend",
"def core_category_candidates(category)\n candidates = []\n singularize_name_nouns(category.name, category.head).each do |phrase|\n candidates.concat(candidates_for_name(phrase, @category_filters))\n\n end\n candidate_set = create_candidate_set(category.name,candidates.uniq)\n end",
"def classifier_from_training( filename )\n classifier = Weka::Classifiers::Meta::AdaBoostM1.new # \n \n # http://weka.sourceforge.net/doc.dev/\n\n # java.lang.String[-P, 100, -S, 1, -I, 10, -W, weka.classifiers.trees.DecisionStump]@28c88600\n\n classifier.use_options(\"-I 100 -S #{ (rand * 10).floor }\")\n #\n # Valid options are:\n # -P <num> Percentage of weight mass to base training on.\n # (default 100, reduce to around 90 speed up)\n # -Q Use resampling for boosting.\n # -S <num> Random number seed. (default 1)\n # -I <num> Number of iterations. (default 10)\n # -D If set, classifier is run in debug mode and may output additional info to the console\n # -W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)\n #\n # Options specific to classifier weka.classifiers.trees.DecisionStump:\n #\n # -D If set, classifier is run in debug mode and may output additional info to the console\n #\n # raise classifier.getOptions.inspect # -I, 100, -K, 0, -S, 1, -num-slots, 1\n training_instances = Weka::Core::Instances.from_arff( filename )\n training_instances.class_attribute = :outcome\n classifier.train_with_instances(training_instances)\nend",
"def set_counts\n @category_counts = {}\n @category_counts.default = 0\n @lines.map do |line|\n category = line.split[0]\n @category_counts[category] += 1\n end\n end",
"def db_seed_ethnicities\n path = Rails.root.join('db','seeds','ethnicities.yml')\n File.open(path) do |file|\n # puts \"Seeding App Ethnicities from #{path}\"\n YAML.load_stream(file) do |doc|\n doc.keys.each do |group|\n # puts \"Seeding ethnicity with group #{group}\"\n names = doc[group]\n names.each do |name|\n db_seed_ethnicity(group, name)\n end\n end\n end\n end\nend",
"def classify_with_all_result(doc)\n result = []\n return nil unless doc\n\n @categories_count.keys().each do |category|\n # log(P(doc|cat))\n document_category = calc_document_category(doc, category)\n\n # log(P(cat)) = log(@categories_count[cat]) - log( @all_category_num )\n category_probability = calc_category_probability(category)\n\n # log(P(cat|doc)) = log(P(doc|cat)) + log(P(cat))\n category_document_probability = document_category + category_probability\n\n result << [category, category_document_probability]\n end\n result\n end",
"def create_category\n puts 'Please enter your category name:'.cyan\n input = STDIN.gets.chomp\n if input.downcase != 'back'\n if find_category(input) #Checking if category exists\n puts 'That category already exists'.red\n create_category\n else\n save_new_category({ category: input, content: [] }) #Writes category to file\n puts 'Successfully added new category'.green\n end\n end\nend",
"def check_categories!\n\n self.categories.map! do |category|\n if (not category.saved?) and loaded_category = Term.get(category.id)\n loaded_category\n else\n category\n end\n end\n\n end",
"def init_recoup # :nodoc:\n setup_categories\n db.load_yaml(File.join(File.dirname(__FILE__), \"corpus.yml\"))\n Matchers.load_default_matchers \n end",
"def get_categories(row)\n categories = []\n cat = at_in(:category1 , row) # should invent some loop here\n categories << cat if cat\n cat = at_in(:category2 , row) # but we only support\n categories << cat if cat\n cat = at_in(:category3 , row) # three levels, so there you go\n categories << cat if cat\n categories\n end",
"def train(words)\n increases = @categories.filter(@name).inject(words)\n @size += increases[@name]\n end",
"def writeup_classification\n classification_label.split(\"-\").first\n end",
"def analyze\n @categories = Violation.unique_categories\n end",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = categories(:first)\r\n end",
"def classy_parse(file)\n CSV.foreach(file, :encoding => 'iso-8859-1') { |row|\n classify(row[5])\n }\n end",
"def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n # from whole name singularized\n candidates = []\n decorated_category = Cyclopedio::Syntax::NameDecorator.new(category, parse_tree_factory: @parse_tree_factory)\n @nouns.singularize_name(category.name, decorated_category.category_head).each do |name_singularized|\n candidates.concat(candidates_for_name(name_singularized,@category_filters))\n end\n candidate_set = create_candidate_set(category.name,candidates)\n return @category_cache[category] = candidate_set if !candidate_set.empty? || @category_exact_match\n # from simplified name\n candidate_set = candidate_set_for_syntax_trees(decorated_category.category_head_trees,@category_filters)\n return @category_cache[category] = candidate_set unless candidate_set.empty?\n # from original whole name\n candidate_set = candidate_set_for_name(category.name, @category_filters)\n @category_cache[category] = candidate_set\n end",
"def calc_document_category(doc, category)\n probability = 0\n\n # log(P(word1|cat)) + log(P(word2|cat)) + ....\n doc.each do |word|\n # log(T(cat, word1)) \n # Additive smoothing\n category_word = Math.log2(@categories_word[category][word] + @additive) \n\n # sum(T(cat, word) + 1))\n all_category_word = Math.log2(@laplace_categories_all_word_count[category])\n\n # log(P(word1|cat)) = log(T(cat, word1) + 1) - log(sum(T(cat, word) + 1))\n prob = category_word - all_category_word\n probability += prob if prob.finite?\n end\n probability\n end",
"def train(categories, text)\n words = @tokenizer.tokenize(text)\n\n [*categories].each do |category|\n self.counter.process(category, words)\n @doc_counter[category] ||= 0\n @doc_counter[category] += 1\n end\n end",
"def load_data(file)\n\t\t@user_set = Hash.new\n\t\t@sim_set = Hash.new\n\t\t@movies = Array.new\n\t\tFile.open(file).each do |line|\n\t\t\tline = line.split(\" \")\n\t\t\tgenerate_movies(line[0]) unless file.include? \"test\"\n\t\t\tgenerate_user_pref(line[0], line[1], line[2])\n\t\tend\n\t\t# generate_predictions unless file.include? \"test\"\n\tend",
"def createCategory(directory, filename, content, category)\n FileUtils.mkdir(directory) unless File.exists?(directory)\n if File.exists?(\"#{directory}/#{filename}\")\n raise \"The file already exists.\"\n else\n parsed_content = \"#{content.sub(\"category:\", \"category: #{category}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{category} was created in '#{directory}'.\"\n end\nend",
"def categories_without_update\n ((fspath + '@categories').read rescue '').lines.\n map { |l| site.page_for l.chomp rescue nil }.\n select { |p| p.is_a? Category }.to_set\n end",
"def training(words, category)\n words.each do |w|\n self.word_count_up(w, category)\n end\n self.category_count_up(category)\n end",
"def load_cookie_categorys\n unless @cookie_categorys\n cookie_category_info = load_json_file(\"data/luxgen/cookie_categorys.data\", \"cid\")\n\n @cookie_categorys = {}\n cookie_category_info.each do |key, value|\n categorys = (@cookie_categorys[key] ||= Set.new)\n\n value['cat'].split(\",\").each do |category|\n categorys.add(category)\n end\n end\n end\n\n @cookie_categorys\nend",
"def runMachineClassifier(trainerName,dataDir=\"project1/src/resources/data\")\n puts \"=============================\"\n puts \"Running Bayes Classifier\"\n puts \" -trainer(#{trainerName})\"\n puts \"=============================\"\n puts \"Training....\"\n classifier = getTrainedClassifier trainerName\n if ( classifier )\n # Classify all other user posts.\n puts \"Begin Classifying...\"\n #@tags.each do |tag| \n Dir[dataDir+\"/*\"].each do |path|\n if File.file?(path)\n begin\n contents = YAML::load_file(path)\n contents.each do |content|\n begin \n classification = classifier.classify content.text \n isMatch = content.tag.downcase.match(classification.downcase) \n puts \" #{isMatch} - [user=#{content.user};url=#{content.url};tag=#{content.tag};classify=#{classification}]\"\n rescue => e\n puts \"[Warning]: Error during classify of Content[user=#{content.user};url=#{content.url};tag=#{content.tag}]\"\n end\n end\n rescue => e\n puts \"[Warning]: Failed to load contents of file '#{path}'.\"\n end\n end\n end \n #end \n else\n raise \"[Error]: Missing Trainer data files. Invalid user '#{trainerName}' specified.\"\n end\n puts \"Done.\" \n end",
"def decision_tree_generate(i, prefix)\n csv_training = \"csv_training_\" + prefix\n csv_test = \"csv_test_\" + prefix\n decision_rules = \"decision_rules_\" + prefix\n decision_results = \"decision_results_\" + prefix\n \n #Generate\n puts \"Generating rules based on training data...\"\n @dt = DecisionTree.new(Constant.new(@c,csv_training).filename(i))\n File.open(Constant.new(@c,decision_rules).filename(i),\"w\") do |f|\n f.puts @dt.get_rules\n end\n \n # Test\n puts \"Testing data on generated rules...\"\n data = CSV.read(Constant.new(@c,csv_test).filename(i))\n data.shift\n correct, count, unmatched = 0, 0, []\n data.each do |d|\n puts d[0..-2].inspect\n puts d[-1].inspect\n begin\n correct += 1 if @dt.eval(d[0..-2]) == d[-1]\n rescue NameError\n unmatched << d\n end\n count += 1\n end\n File.open(Constant.new(@c,decision_results).filename(i),\"w\") do |f|\n f.puts \"Accuracy: %d %d %.4f\" % [correct, count, (correct-0.0)/count]\n f.puts \"Unmatched: \"\n unmatched.each { |u| f.puts u.inspect }\n end\n end",
"def extract_categories(title)\n # First find the article_id\n article_id = get_article_id(title)\n return nil if article_id.nil?\n \n (prefix1, prefix2) = make_path_prefix(article_id)\n fname = @enwiki_dir + \"/\" + prefix1 + \"/\" + prefix2 + \"/#{article_id}.xml\"\n catlist = []\n open(fname).each_line do |line|\n if line =~ /\\[\\[(Category:.*?)\\]\\]/\n # Remove stuff after \"|\" if any\n cat_title = $1.gsub /\\|.*/, ''\n cat_article_id = get_article_id(cat_title)\n catlist.push(cat_article_id) if not cat_article_id.nil?\n end\n end\n return catlist\n end",
"def train(example, category_index, probability = 1)\n example.each do |token|\n @token_counts[category_index][token] += probability\n @total_token_counts[category_index] += probability\n end\n @category_counts[category_index] += probability\n end",
"def food_types(category_name)\n case category_name\n when \"Fruit\"\n Faker::Food.fruit\n when \"Spice\"\n Faker::Food.herb_or_spice\n when \"Ingredient\"\n Faker::Food.ingredient\n when \"Meat\"\n Faker::Food.meat\n when \"Vegetable\"\n Faker::Food.vegetable\n else\n Faker::Product.product\n end\nend",
"def index\n positive = YAML::load_file(\"/home/ubuntu/scrap/app/controllers/rt-polarity-pos.yml\")\n negative = YAML::load_file(\"/home/ubuntu/scrap/app/controllers/rt-polarity-neg.yml\")\n #classifier = Classifier::Bayes.new('Positive','Negative')\n Tweet.each do |tt|\n puts tt.content\n end \n end",
"def make_training_set training_set_size\n sample = $ou.to_a.sample(training_set_size).shuffle\n data_to_csv 'train.csv', sample\nend",
"def categories_for(race)\n case race.name\n when \"Junior Men\", \"Junior Women\"\n [ Category.find_or_create_by(name: race.name) ]\n else\n super race\n end\n end",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = category(:first)\r\n end",
"def categories\n taxonomies.all :conditions => { :classification => :category }\n end",
"def categorize_reports\n \t@reports = Report.all\n \t@reports.each do |report|\n \t\t# Get crime description\n \t\tdescription = report.description\n\n \t\t# Assign crime category based on description\n\t \tcase description\n\t\t\twhen \"118 - Theft - From Motor Vehicle - Petit\"\n\t\t\t\treport.update_attribute(:category, \"Theft From Motor Vehicle\")\n\t\t\twhen \"117 - Theft - From Motor Vehicle - Felony\"\n\t\t\t\treport.update_attribute(:category, \"Theft From Motor Vehicle\")\n\t\t\twhen \"450 - Robbery\"\n\t\t\t\treport.update_attribute(:category, \"Robbery\")\n\t\t\twhen \"254 - Assault\"\n\t\t\t\treport.update_attribute(:category, \"Assault\")\n\t\t\twhen \"262 - Felony Assault\"\n\t\t\t\treport.update_attribute(:category, \"Assault\")\n\t\t\twhen \"200 - Motor Vehicle Theft\"\n\t\t\t\treport.update_attribute(:category, \"Motor Vehicle Theft\")\n\t\t\twhen \"101 - Burglary - Zone 1\"\n\t\t\t\treport.update_attribute(:category, \"Burglary\")\n\t\t\twhen \"102 - Burglary - Zone 2\"\n\t\t\t\treport.update_attribute(:category, \"Burglary\")\n\t\t\twhen \"103 - Burglary - Zone 3\"\n\t\t\t\treport.update_attribute(:category, \"Burglary\")\n\t\t\twhen \"104 - Burglary - Zone 4\"\n\t\t\t\treport.update_attribute(:category, \"Burglary\")\n\t\t\twhen \"105 - Burglary - Zone 5\"\n\t\t\t\treport.update_attribute(:category, \"Burglary\")\n\t\t\twhen \"300 - Rape/Sexual Assault Vic 16 Yr and Older\"\n\t\t\t\treport.update_attribute(:category, \"Rape\")\n\t\t\twhen \"301 - Rape/Sexual Assault Vic 15 Yr and Younger\"\n\t\t\t\treport.update_attribute(:category, \"Rape\")\n\t\t\twhen \"250 - Homicide\"\n\t\t\t\treport.update_attribute(:category, \"Murder\")\n\t\tend\n\n\t\t# Get crime year\n\t\tyear = \"\"\n\t\tif report.date.length == 10\n\t\t\tyear = report.date[6..10]\n\t\tend\n\n\t\t# Update Year column from date\n\t\treport.update_attribute(:year, year)\n\tend\n\n\tredirect_to 'http://localhost:3000/admin'\n\n end",
"def occupations\n model_names = %w( State Metro )\n\n CSV.foreach('db/fixtures/occupations.csv', headers: true) do |row|\n\n census_id = row['census_id']\n geography = row['geography']\n occ_type = row['occ_type']\n occ_salary = row['occ_salary']\n\n\n record = Occupation.where(explainable_id: census_id, occ_type: occ_type, explainable_type: geography)\n\n if record.empty?\n model_names.each do |model_name|\n model = Module.const_get model_name\n if model.name == geography\n geography = model.find(census_id)\n geography.occupations.create(occ_type: occ_type, occ_salary: occ_salary)\n end\n end\n end\n end\nend",
"def db_seed_questions\n path = Rails.root.join('db','seeds','questions.yml')\n File.open(path) do |file|\n # puts \"Seeding App Questions from #{path}\"\n YAML.load_stream(file) do |doc|\n doc.keys.sort.each do |tag|\n # puts \"Seeding question with tag #{tag}\"\n attributes = doc[tag]\n db_seed_question(tag, attributes)\n end\n end\n end\nend",
"def create_awe_test_for(category)\n awe_priority_test = nil\n \n #puts 'CREATE TEST'\n\n if category[:target_priorities][:test_type] == :no_test # NO TEST\n \n #puts 'CREATE NO TEST'\n \n awe_priority_test = Battle::NoTest.new\n category[:target_priorities][:results][0].each do | target |\n awe_priority_test.pushCategoryToPriority(target)\n end\n \n elsif category[:target_priorities][:test_type] == :line_size_test # LINE SIZE TEST\n \n #puts 'CREATE LINE SIZE TEST'\n \n awe_priority_test = Battle::LineSizeTest.new(category[:target_priorities][:test_category])\n category[:target_priorities][:results][0].each do | target |\n awe_priority_test.pushCategoryToPriorityOnSuccess(target)\n end \n category[:target_priorities][:results][1].each do | target |\n awe_priority_test.pushCategoryToPriorityOnFail(target)\n end \n end\n \n awe_priority_test\n end",
"def classify(tokens)\n max_prob, max_category = -1, -1\n\n if tokens.empty? \n # If the example is empty, find the category with the highest prior probability.\n (0..@num_categories - 1).each do |i|\n prior_prob = get_prior_category_probability(i)\n max_prob, max_category = prior_prob, i if prior_prob > max_prob\n end\n else\n # Otherwise, find the category with the highest posterior probability.\n get_posterior_category_probabilities(tokens).each_with_index do |prob, category|\n max_prob, max_category = prob, category if prob > max_prob\n end\n end\n \n return max_category\n end",
"def ctag(category = \"environment\", value = \"test\")\n env = Classification.find_by_name(category) ||\n FactoryGirl.create(:classification, :name => category, :single_value => 1)\n FactoryGirl.create(:classification_tag, :name => value, :parent => env)\n end",
"def classify\n pos_probs = cond_probs(:pos)\n neg_probs = cond_probs(:neg)\n\n # Label the reviews in each polarity folder\n pos_labels = @features[:pos].map { |f| label(f, pos_probs, neg_probs) }\n neg_labels = @features[:neg].map { |f| label(f, pos_probs, neg_probs) }\n\n { pos_labels: pos_labels, neg_labels: neg_labels }\n end",
"def slugified_categories; end",
"def find_category(file)\n file.match(Regexp.new(Regexp.escape(csv_root))) or \n raise AMEEM::Exceptions::Location.new(\"#{file} is not in CSV tree\")\n file.sub(Regexp.new(Regexp.escape(csv_root)),\"\");\n end",
"def train(rows, classes)\n @rows = rows\n @classes = classes\n @table = (rows.transpose + [classes]).transpose\n @cat_probs = Array.new(rows.transpose.size) { Hash.new(0) }\n \n # calculate the sum over all classes the probability of a category value\n # belonging to a class\n \n @classes.uniq.each do |c| # for every class\n rows_for_class = @table.select{|row| row.last == c} # select the rows for that class\n rows_for_class.transpose[0..-2].each_with_index do |row, i|\n next unless row.first.is_a?(String) # if it's not a string, don't do anything\n counts = row.group_by{|x| x} # group by the values\n counts.each_pair do |category, group| \n # the group size will be the count, divide it by the number of rows\n # for that class to get the probability that that category belongs to\n # that class\n @cat_probs[i][category] += group.size / (rows_for_class.size * 1.0)\n end\n end\n end\n end",
"def ffck_categories_detailed()\n ['Pitchoun', 'Poussin 1', 'Poussin 2', 'Benjamin 1', 'Benjamin 2', 'Minime 1', 'Minime 2', 'Cadet 1', 'Cadet 2',\n 'Junior 1', 'Junior 2', 'Senior', 'Veteran 1', 'Veteran 2', 'Veteran 3', 'Veteran +', 'Inconnu']\n end",
"def train texts\n model = Hash.new(0)\n texts.each do |text|\n File.new(text).read.downcase.scan(/[a-z]+/).each do |word|\n model[word] += 1\n end\n end\n return model\nend",
"def create_bulk\n file = File.new(\"features.md\", \"r\")\n while (line = file.gets)\n line = line.chomp.strip.gsub(' ', '_')\n FileUtils.touch \"features/#{line}.feature\"\n FileUtils.touch \"features/step_definitions/#{line}.steps.rb\"\n end\n file.close\n end",
"def train(category, text)\n word_hash = Hasher.word_hash(text, @language, @enable_stemmer)\n return if word_hash.empty?\n category = CategoryNamer.prepare_name(category)\n\n # Add the category dynamically or raise an error\n unless category_keys.include?(category)\n if @auto_categorize\n add_category(category)\n else\n raise CategoryNotFoundError, \"Cannot train; category #{category} does not exist\"\n end\n end\n\n word_hash.each do |word, count|\n @backend.update_category_word_frequency(category, word, count)\n @backend.update_category_word_count(category, count)\n @backend.update_total_words(count)\n end\n @backend.update_total_trainings(1)\n @backend.update_category_training_count(category, 1)\n end",
"def categorize_cell(cdscell, category)\r\n\r\n Category.where.not(name: category.name).each do |cat|\r\n #Only run if the cell is not tagged\r\n cdscell = category.cdscells.find_by(name: \"uncategorized\")\r\n if !cdscell\r\n user.tag(cdscell, :with => \"uncategorized\", :on => :categories)\r\n end\r\n end\r\n \r\n end",
"def set_categories\r\n @categories = Category.where('courses_count > 0').order(:name)\r\n end",
"def word_classification_detail(word)\n\n p \"word_probability\"\n result=self.categories.inject({}) do |h, cat|\n h[cat]=self.word_probability(word, cat); h\n end\n p result\n\n p \"word_weighted_average\"\n result=categories.inject({}) do |h, cat|\n h[cat]=word_weighted_average(word, cat); h\n end\n p result\n\n p \"doc_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=doc_probability(word, cat); h\n end\n p result\n\n p \"text_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=event_probability(word, cat); h\n end\n p result\n\n end",
"def make_new_category\n\n puts \"Pick a category name\"\n print \"> \"\n\n category_name = $stdin.gets.chomp\n\n CSV.open('categories.csv', 'a+') do |csv_file|\n csv_file << [category_name]\n end\n\n category = category_name\n link = \"#{category}.csv\"\n\n CSV.open(link, 'wb') do |csv|\n csv << [\"question\", \"answer\"]\n end\n\n new_qa(category_name)\n\nend",
"def initialize(options = {})\n options = {:num_categories => 2,\n :prior_token_count => 0.0001}.merge(options)\n\n @num_categories = options[:num_categories]\n @prior_token_count = options[:prior_token_count]\n @prior_category_counts = options[:prior_category_counts] || Array.new(@num_categories) { rand }\n @category_names = options[:category_names] || (0..num_categories-1).map(&:to_s).to_a\n \n # `@token_counts[category][token]` is the (weighted) number of times we have seen `token` with this category.\n @token_counts = Array.new(@num_categories) do\n Hash.new { |h, token| h[token] = 0 }\n end\n \n # `@total_token_counts[category]` is always equal to `@token_counts[category].sum`.\n @total_token_counts = Array.new(@num_categories, 0)\n \n # `@category_counts[category]` is the (weighted) number of training examples we have seen with this category.\n @category_counts = Array.new(@num_categories, 0)\n end",
"def save_categories #metodo para registrar en la tabla intermedia muchos a muchos\n \n return category_articles.destroy_all if category_elements.nil? || category_elements.empty?\n category_articles.where.not(category_id: category_elements).destroy_all\n \n #si no viene como arreglo------------------------------------------------------------------\n #recibiremos del form las categorias 1,2,3\n #convertirlo en un arreglo separado por comas\n #categories_array = category_elements.split(\",\")\n #iterar el arreglo\n #guardar cada parte del arreglo como un registro diferente\n #categories_array.each do |category_id|\n # CategoryArticle.find_or_create_by(article: self, category_id: category_id) #CategoryArticle en singular y mayus igual que la tabla\n #end\n #este bloque guarda cada elemento del arreglo en la tabla intermedia muchos a muhcos categoryarticles\n #si viene como arreglo------------------------------------------------------------------\n category_elements.each do |category_id|\n CategoryArticle.find_or_create_by(article: self, category_id: category_id)\n end\n end",
"def category(num=(0...round.categories.count).to_a.sample)\n round.categories[num]\n end",
"def save\n ::Classifier.dataset.delete\n\n @classifiers.each do |section, reference_values|\n ::Classifier.create(\n section: section.to_s,\n reference_values: JSON.generate(reference_values)\n )\n end\n end",
"def assign_category(categories_id)\n categories_id = [categories_id] if categories_id.is_a?(Integer)\n rescue_extra_data\n categories_id.each do |key|\n term_relationships.where(:term_taxonomy_id => key).first_or_create!\n end\n update_counters(\"categories\")\n end",
"def create_detentions\n @students.each do |student|\n next if student[:detention].to_i.zero?\n\n name = student[:name].split(' ').map(&:downcase).join('_')\n file_path = \"#{__dir__}/../#{ENV['DETENTIONS_PATH']}/#{name}\"\n File.open(file_path, 'w') { |f| f.puts(student[:detention]) }\n end\n end",
"def add_categories(collection)\n\tcategory = \"\"\n\tcollection[\"results\"][\"collection1\"].each do |article|\n\t\tif article[\"category\"] == \"\"\n article[\"category\"] = category\n else\n category = article[\"category\"]\n end\n\tend\nend",
"def refine_food(food) \n case food[\"type\"]\n when /coffee/i\n food[\"category\"] = \"coffee\"\n when /bar/i\n food[\"category\"] = \"bar\"\n when /thai/i\n food[\"category\"] << \"thai\"\n food[\"type\"] = \"thai restaurant\"\n when /indian|curry/i\n food[\"category\"] << \"indpak\"\n when /french|france/i\n food[\"category\"] << \"french\"\n food[\"type\"] =\"french restaurant\"\n when /ital(ian|y)/i\n food[\"category\"] << \"italian\"\n food[\"type\"] = \"italian restaurant\"\n when /fish|seafood/i\n if (food[\"type\"] =~ /chips/i)\n then food[\"category\"] << \"fishnchips\"\n else\n food[\"category\"] << \"seafood\"\n food[\"type\"] = \"fish restaurant\"\n end\n end\n return food\n end",
"def categories_as_strings= (new_categories)\n categories.clear\n\n new_categories.split(/\\s*, \\s*/).each do |title|\n cat =Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end",
"def set_categories\n @categories = Category.order(:name).pluck(:name, :id)\n end"
] | [
"0.71271574",
"0.6698336",
"0.66660666",
"0.6639025",
"0.6382471",
"0.61727256",
"0.58482426",
"0.58374375",
"0.5787874",
"0.5777432",
"0.554145",
"0.5506012",
"0.5501003",
"0.5486468",
"0.547899",
"0.54252803",
"0.5384935",
"0.537921",
"0.5344382",
"0.5343918",
"0.5332457",
"0.53262407",
"0.53099936",
"0.5300962",
"0.52976704",
"0.52871644",
"0.52810967",
"0.52738804",
"0.5248632",
"0.52357954",
"0.5222544",
"0.5214013",
"0.51862425",
"0.51850504",
"0.5184378",
"0.5176926",
"0.5176601",
"0.51763064",
"0.51618636",
"0.5161055",
"0.5150292",
"0.5138432",
"0.51295227",
"0.51206034",
"0.5105973",
"0.509921",
"0.50932664",
"0.5089076",
"0.5087956",
"0.5084333",
"0.50779986",
"0.5076601",
"0.50752157",
"0.50719315",
"0.50690705",
"0.505892",
"0.5053814",
"0.50442106",
"0.5043182",
"0.50407857",
"0.5031037",
"0.5029271",
"0.5028364",
"0.49976283",
"0.49957255",
"0.49922884",
"0.49839848",
"0.49823964",
"0.49808902",
"0.49716336",
"0.49656397",
"0.49587128",
"0.49569556",
"0.49415204",
"0.4941022",
"0.49095947",
"0.48884994",
"0.4877461",
"0.4875624",
"0.48741648",
"0.48702633",
"0.48687944",
"0.48673788",
"0.48610133",
"0.4849084",
"0.48464292",
"0.4845439",
"0.483968",
"0.4835272",
"0.48335534",
"0.48281226",
"0.48279348",
"0.48240113",
"0.4823596",
"0.47991395",
"0.47977605",
"0.47875932",
"0.4781937",
"0.47751218",
"0.47732207",
"0.47629815"
] | 0.0 | -1 |
=> "fiiiissshhhhhh" O(n log n) | def dominant_octopus(array)
return array if array.length <= 1
midpoint = array.length / 2
sorted_left = dominant_octopus(array.take(midpoint))
sorted_right = dominant_octopus(array.drop(midpoint))
merge(sorted_left, sorted_right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sluggish_octopus\n # O(N^2)\n longest_fish = \"\"\n Fishes.each do |fish1|\n Fishes.each do |fish2|\n longest_fish = fish2 if fish2.length > fish1.length\n end\n end\n longest_fish\nend",
"def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend",
"def solution(str)\n str << \"_\" if str.length % 2 != 0\n str.chars.each_slice(2).map(&:join)\nend",
"def longest_substring_which_contains_two_unique_characters(string)\n longest = ''\n current = ''\n hash = Hash.new(0)\n\n string.split('').each do |s|\n current += s\n\n if hash[s] > 0\n hash[s] += 1\n else\n hash[s] += 1\n if hash.size > 2\n longest = longest.length > current.length ? longest : current\n # binding.pry\n pair = hash.min_by{|k,v| v}\n hash.delete(pair[0])\n\n current = current[1..-1]\n else\n current += s\n end\n end\n end\n\n longest\nend",
"def solution(string) # \"ABCA\",\n # TIME O(N) + O(N) = O(2N) ~~ O(N)\n # SPACE O(N)\n\n array = string.split(\"\") # w[A B C A], O(N)\n array_exist = [] # [B C]\n array.each do |s| # O(N), N= 1000_000\n if array_exist.include?(s)\n array_exist.delete(s)\n else\n array_exist.push(s)\n end\n end\n array_exist[0]\nend",
"def solution(s)\n s = s.split ''\n return 'Empty String' if s.uniq.length == 1\n\n i = 1\n while i <= s.length\n if s[i - 1] == s[i]\n s.delete_at i - 1\n s.delete_at i - 1\n i = 0\n end\n i += 1\n end\n\n s.length <= 0 ? 'Empty String' : s.join\nend",
"def compress_str(str)\n res = \"\"\n count = 0\n (0...str.length - 1).each do |idx|\n if str[idx] != str[idx + 1]\n if count > 0\n sub_res = (count + 1).to_s + str[idx]\n res += sub_res\n else\n res += str[idx]\n end\n count = 0\n else\n count += 1\n end\n end\n if count > 0\n sub_res = (count + 1).to_s + str[-1]\n res += sub_res\n else\n res += str[-1]\n end\n return res\nend",
"def compress_str(str)\n res = \"\"\n count = 0\n (0...str.length - 1).each do |idx|\n if str[idx] != str[idx + 1]\n if count > 0\n sub_res = (count + 1).to_s + str[idx]\n res += sub_res\n else\n res += str[idx]\n end\n count = 0\n else\n count += 1\n end\n end\n if count > 0\n sub_res = (count + 1).to_s + str[-1]\n res += sub_res\n else\n res += str[-1]\n end\n return res\nend",
"def encode_repeating(my_string)\r\n i = 0\r\n j = 0\r\n letter = my_string[i]\r\n while i < my_string.length\r\n j += 1 while my_string[j + 1] == letter\r\n if j - i >= 2\r\n my_string[(i + 1)..j] = (j - i + 1).to_s\r\n end\r\n additional = 0\r\n additional = 1 if j > i\r\n i += 1 + additional\r\n j = i\r\n letter = my_string[i]\r\n end\r\n return my_string\r\nend",
"def compress_str(string)\n\n result = \"\" #[a]\n i = 0\n \n while i < string.length\n counter = 1\n while string[i] == string[i + 1]\n counter += 1\n i += 1\n end\n \n result += counter.to_s if counter > 1\n result += string[i]\n i += 1\n end\n result\nend",
"def longest_unique_substring_memoize str\n return str if str.length <= 2\n len = str.length\n memoize = Array.new(len+1) { Array.new(len+1) }\n\n #setup memoize\n memoize[0][0] = ''\n\n j = 1\n while j <= len\n memoize[0][j] = ''\n j += 1\n end\n\n j = 1\n while j <= len\n memoize[j][0] = ''\n j += 1\n end\n #setup middle cells\n\n i = 1\n while i <= len\n memoize[i][i] = str[i-1]\n i+=1\n end\n\n j = 2\n i = 1\n\n # puts memoize.inspect\n\n while i < len+1\n while j < len+1\n memoize[i][j] = if str[i-1..j-1].split('').uniq.length > 2\n find_string_with_max_lenght([memoize[i][j-1], memoize[i-1][j]])\n else\n find_string_with_max_lenght([str[i-1..j-1], memoize[i][j-1], memoize[i-1][j]])\n end\n j +=1\n end\n i += 1\n j = i+1\n end\n\n return memoize[len-1][len]\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def crunch(string)\n index = 0\n str_text = ''\n while index <= string.length - 1\n str_text << string[index] unless string[index] == string[index + 1]\n index += 1\n end\n str_text\nend",
"def sluggish(fish)\n longest_fish = \"\"\n i = 0\n while i < fish.length\n j = i + 1\n while j < fish.length\n longest_fish = fish[j] if longest_fish.length <= fish[j].length\n j += 1\n end\n i += 1\n end\n longest_fish\nend",
"def crunch(string)\n array = string.chars\n no_repeats = []\n no_repeats.push(array[0])\n for i in 0..(array.size - 1)\n no_repeats.push(array[i+1]) if array[i] != array[i+1]\n end\n\n no_repeats.join\nend",
"def crunch(str)\n i = 0\n crunch_text = ''\n while i <= str.length\n crunch_text << str[i] unless str[i] == str[i + 1]\n i += 1\n end\n crunch_text\nend",
"def string_compress(string)\n original=string\n i=0\n while(i<string.length)\n j=i\n while (string[i]==string[j])\n j+=1\n end\n string[i..j-1]=\"#{string[i]}#{(j-i)}\"\n i+=2\n end\n return original if string.length>original.length \n return string\n \nend",
"def compress_str(str)\n\n new = []\n count = 1\n\n (0..str.length-1).each do |i|\n if str[i] == str[i+1]\n count += 1\n elsif str[i] != str[i+1]\n if count > 1\n new << count.to_s + str[i]\n count = 1\n else \n new << str[i]\n end\n end\n end\n new.join(\"\")\nend",
"def RunLengthII(str)\n\tstr_copy = str.split(\"\")\n\tlastChar = str_copy.shift\n\tresult = \"\"\n\tcount = 1\n\tstr_copy.each do |char|\n\t\tif char != lastChar\n\t\t\tresult << \"#{count}#{lastChar}\"\n\t\t\tlastChar = char\n\t\t\tcount = 1\n\t\telse\n\t\t\tcount += 1\n\t\tend\n\tend\n\n\tresult += \"#{count}#{str_copy[-1]}\"\n\treturn result\nend",
"def char_concat(word)\n (1..word.length/2).map {|i| word[i - 1] + word[-i] + i.to_s}.join\nend",
"def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend",
"def compress_string(string)\n str = ''\n start = 0\n (0..string.length).each do |i|\n next if string[start] == string[i]\n\n str << string[start] << (i - start).to_s\n start = i\n end\nend",
"def most_frequent_bigram(str)\n n, hash, res, ct = str.length, Hash.new(0), \"\", 0\n (0...n).each do |i|\n break if i + 2 > n\n w = str[i..(i + 1)]\n hash[w] += 1\n if(ct < hash[w])\n ct = hash[w]\n res = w\n end\n end\n res\nend",
"def compress_str(str)\n new_str = ''\n count = 1\n (0..str.length - 1).each do |i|\n if str[i + 1] == str[i]\n count += 1\n else\n new_str << count.to_s if count > 1\n new_str << str[i]\n count = 1\n end\n end\n new_str\nend",
"def distinct_subseq_ii(s)\n alphabets = ('a'..'z').to_a\n dict = Array.new(27, 0)\n mod = 10 ** 9 + 7\n total = 1\n s.chars.each do |char|\n index = alphabets.index(char) + 1\n combo = total * 2 - dict[index]\n dict[index] = total # if 'c' ever appears again, it will clash with the current combos.\n total = combo < 0 ? 0 + mod : combo % mod\n end\n total - 1 # subtract empty string\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char| \n if hash[char]\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend",
"def crunch(str)\n new_string = ''\n counter = 0\n while counter <= str.length - 1\n new_string << str[counter] unless str[counter] == str[counter + 1]\n counter += 1\n end\n new_string\nend",
"def solution(str)\n str+=\"_\" if str.length.odd?\n res = []\n index = 0\n while index < str.length\n res << str[index .. index+1]\n index+=2\n end\n res\nend",
"def crunch(str)\n counter = 0\n result = ''\n while counter < str.length\n result << str[counter] unless str[counter] == result[-1]\n counter += 1\n end\n result\nend",
"def compress_str(str)\n\n new = \"\"\n count = 1\n\n (0..str.length-1).each do |i|\n if str[i] == str[i+1]\n count += 1\n elsif str[i] != str[i+1]\n if count > 1\n new += count.to_s + str[i]\n count = 1\n else \n new += str[i]\n end\n end\n end\n new\nend",
"def rampant_repeats(str, hash)\n\n new_str = \"\"\n\n str.each_char { |char| new_str += char * ( hash[char] || 1) }\n\n new_str\n\nend",
"def repeatedString(s, n)\n s.count('a') * (n / s.size) + s[0, n % s.size].count('a')\nend",
"def find_subs(string)\n result = []\n arr = string.chars\n arr.each_index do |outer_idx|\n (arr.size - outer_idx).times do |inner_idx|\n result << arr[outer_idx..(inner_idx + outer_idx)].join\n end\n end\n result\nend",
"def rampant_repeats(str, hash)\n n_str = ''\n str.each_char do |char|\n if hash.has_key?(char) \n n_str += char * hash[char]\n else\n n_str += char\n end\n end\n n_str\nend",
"def repeatedString(s, n)\n char_array = s.split('')\n count_of_a_in_string = 0\n char_array.each do |letter|\n if letter == \"a\"\n count_of_a_in_string += 1\n end\n end\n\n factor = n/s.length()\n reminder = n % s.length()\n count_of_a_in_final_string = factor * count_of_a_in_string\n\n reminder.times do |index|\n count_of_a_in_final_string += 1 unless s[index] != \"a\"\n end\n count_of_a_in_final_string\nend",
"def compress_str(str)\n compress = \"\"\n i = 0\n while i < str.length\n char = str[i]\n count = 0\n while char == str[i]\n count += 1\n i += 1\n end\n if count < 2\n compress += char\n else\n compress += count.to_s + char\n end\n end\n\n compress\nend",
"def s_th(string)\r\n th_ify = string.chars.map { |x| x == \"s\" ? 'th' : x }\r\n return th_ify.join\r\nend",
"def repeatedString(s, n)\n count = s.count(\"a\")\n rep = (n / s.length)\n if n % s.length != 0\n short_s = s.slice(0, n % s.length)\n return (count * rep) + short_s.count(\"a\")\n else\n return (count * rep)\n end\n \nend",
"def compress_str(str)\n new_str = \"\"\n\n i = 0\n while i < str.length\n char = str[i]\n count = 0\n while char == str[i]\n count += 1\n i += 1\n end\n\n if count > 1\n new_str += count.to_s + char\n else\n new_str += char\n end\n end\n\n new_str\nend",
"def crunch(string)\n crunched = []\n chars = string.split('') \n chars.each_with_index do |c,i|\n if i == 0\n crunched << c\n elsif chars[i-1] != c\n crunched << c\n end\n end\n crunched.join\nend",
"def compress_str(str)\n compressed_str = \"\"\n c = 0\n (0...str.length).each do |i|\n c += 1\n if str[i] == str[i+1]\n next\n end\n compressed_str += c.to_s if c > 1 \n compressed_str += str[i]\n c = 0\n end\n compressed_str\nend",
"def crunch(string)\n string.gsub(/(.)\\1+/, '\\1')\nend",
"def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char|\n if hash.key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char \n end\n end\n new_str\nend",
"def 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 f(s)\n uniq_char = s.chars.uniq.join('')\n # split_array = s.scan(uniq_char)\n # [split_array.length > 1 ? uniq_char : s,split_array.length]\nend",
"def compress_str(str)\n compressed = \"\"\n count = 1\n (0..str.length-1).each do |idx|\n if str[idx] == str[idx+1]\n count += 1\n else\n if count == 1\n compressed += str[idx]\n else\n compressed += count.to_s + str[idx]\n count = 1\n end\n end\n end\n return compressed\nend",
"def first_anagram?(str1, str2)\r\n possible = str1.split(\"\").permutation.to_a #O(n!)\r\n possible.map! {|ele| ele.join(\"\")} #O(n)\r\n possible.include?(str2) #O(n)\r\nend",
"def encode_repeating(my_string)\n return nil if my_string.nil?\n return my_string if my_string.length <= 1\n\n i = 0\n j = 0\n k = 0\n while j <= i && i < my_string.length\n k = i\n if my_string[i] != my_string[i + 1]\n my_string[j] = my_string[i]\n\n else\n counter = 1\n while my_string[i] == my_string[i + 1]\n i += 1\n counter += 1\n end\n\n if counter == 2\n my_string[j] = my_string[k]\n my_string[j + 1] = my_string[k]\n else\n my_string[j] = my_string[k]\n my_string[j + 1] = counter.to_s\n end\n j += 1\n end\n j += 1\n i += 1\n end\n\n my_string[j...my_string.length] = \"\"\n return my_string\nend",
"def solve(s)\n new_str = ''\n s.each_char do |char|\n if new_str[-1] != char\n new_str += char\n end\n end\n return new_str\nend",
"def repeatedString(s, n)\n # First approach times out\n # s = s * ((n/s.length)+1)\n # p s[0..n-1].count('a')\n a_count = s.count('a')\n times_to_repeat = ((n/s.length))\n num_a_in_string = a_count * times_to_repeat\n leftover = (n%(s.length))\n num_a_in_string += s[0..leftover-1].count('a') if leftover >= 1\n p num_a_in_string\nend",
"def num_distinct(s, t)\n len = t.size\n prefix = [1] + [0]*len # => [1, 0, 0, 0, 0, 0, 0] will happen\n s.chars.each do |char|\n len.downto(1) {|i| prefix[i]=prefix[i-1]+prefix[i] if t[i-1]==char}\n end\n p prefix\n prefix[-1]\nend",
"def sluggish(array)\n i = 0\n longest_fish = \"\"\n while i < array.length\n n = 0\n while n < array.length\n if longest_fish.length < array[n].length\n longest_fish = array[n]\n end \n n+= 1\n end \n i += 1 \n end \n return longest_fish\nend",
"def rampant_repeats(str, hash)\n new_str = \"\"\n str.each_char do |char|\n if hash.has_key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend",
"def repeatedSubstring(n, m)\n for i in 1..(m.length * 2)\n n = n * i\n if n.include?(m)\n return i\n end\n end\n -1\nend",
"def folding_cipher(string)\n alpha = ('a'..'z').to_a\n reverse = alpha.reverse\n\n string.split('').map do |ch|\n idx = alpha.index(ch)\n reverse[idx]\n end.join('') \nend",
"def repeatedString(s, n)\n len = s.length\n times = n / len\n nb = times * s.count('a')\n\n last = s[0..(n % len)]\n nb += last.count('a') if len != 1\n nb\nend",
"def compress_str(str)\n curr = str[0]\n new_str = \"\"\n len = 1\n (1..(str.length - 1)).each do |i|\n if str[i] == str[i - 1]\n len += 1\n else\n new_str += compressed(str[i - 1], len)\n len = 1\n end\n end\n new_str += compressed(str[-1], len)\nend",
"def fourth_anagram?(str1, str2) # O(n)\n hash = Hash.new(0) # 1\n str1.each_char {|char| hash[char] += 1} # n\n str2.each_char {|char| hash[char] -= 1} # n\n\n hash.values.all?(0) # n\n\nend",
"def staggered_case(string)\n staggered = []\n string.chars.each_with_index do |char, index|\n if index.odd?\n staggered << char.downcase\n else\n staggered << char.upcase\n end\n end\n staggered.join\nend",
"def staggered_case(string)\n chars = string.chars.map(&:downcase)\n n = 0\n m = 0\n\n results = []\n\n chars.size.times do\n if n.even? && chars[m] =~ /[A-Za-z]/\n results << chars[m].upcase\n n += 1\n m += 1\n elsif chars[m] =~ /[A-Za-z]/\n results << chars[m]\n n += 1\n m += 1\n else\n results << chars[m]\n m += 1\n end\n end\n\n results.join\nend",
"def rampant_repeats(str, hash)\n (str.split(\"\").map do |char| \n if hash.keys.include?(char)\n char * hash[char] \n else\n char\n end\n end).join(\"\")\nend",
"def solution(sentence)\n return sentence.split.reverse.join(\" \")\nend",
"def repeatedString(s, n)\n num_a = s.count(\"a\")\n if num_a == 0\n return 0\n end\n slen = s.length\n total = num_a*(n/slen)\n total += s[0...n%slen].count(\"a\")\nend",
"def smash(words)\n sentence = \"\"\n words.each do |w|\n sentence = sentence + \"#{w} \"\n end\n sentence[0..-2]\nend",
"def compress(string) \n result = \"\"\n count = 0\n\n (0..(string.length - 2)).each do |i|\n count += 1\n if(string[i] != string[i + 1])\n result << \"#{string[i]}#{count}\"\n count = 0\n end\n end\n\n (result.length < string.length) ? result : string\n end",
"def rampant_repeats(str, hash)\n str.chars.map { |c| hash.key?(c) ? c * hash[c] : c }.join\nend",
"def second_anagram?(str_1, str_2)\n temp = str_2.split(\"\") \n str_1.each_char.with_index do |char, i| #O(n) **\n temp_idx = temp.find_index(char) #O(n*log(n)) ** (need to check this!)\n return false if temp_idx.nil?\n temp.slice!(temp_idx) #O(n)\n end \n temp.join(\"\") == \"\"\nend",
"def compress(str)\n compressed = ''\n chars = str.split('')\n idx = 0\n\n while idx <= chars.length-1\n streak = 1\n char = chars[idx]\n while chars[idx] == chars[idx+1]\n streak += 1\n idx+= 1\n end\n idx += 1\n if streak > 1\n compressed += char + streak.to_s\n else\n compressed += char\n end\n end\n compressed\nend",
"def uniq_subs(word)\n subs = {}\n word.length.times do |i|\n (i...word.length).each do |j|\n if !subs[str[i..j]]\n subs[str[i..j]] = str[i..j]\n end\n end\n end\nend",
"def compress_str(str)\n compressed = \"\"\n\n i = 0\n while i < str.length\n char = str[i] \n count = 0\n while char == str[i]\n count += 1\n i += 1\n end\n\n compressed += count.to_s + char\n end\n \n\n compressed\nend",
"def n_squared(fish)\n long_boi = \"\"\n fish.each_with_index do |fish1, idx1|\n fish.each_with_index do |fish2, idx2|\n if idx2 > idx1\n long_boi = fish2 if fish2.length > fish1.length\n end\n end\n end\n long_boi\nend",
"def uniq_chars(str)\n # O(n) with hashmap\n tally = Hash.new(0)\n str.each_char { |chr| tally[chr] += 1 }\n tally.none? { |_, v| v > 1 }\nend",
"def compress str \n comp = ''\n currChar = str[0]\n i = 1\n count = 1\n\n while i < str.length\n if str[i] == currChar\n i += 1\n count += 1\n else\n comp += \"#{currChar}#{count}\"\n count = 0\n currChar = str[i]\n i += 1\n end\n end\n comp += \"#{currChar}#{count+1}\"\n \n str.length > comp.length ? comp : str\nend",
"def rampant_repeats(str, hash)\n (str.split(\"\").map do |char| \n if hash.keys.include?(char)\n # if hash.has_key?(char)\n char * hash[char] \n else\n char\n end\n end).join(\"\")\nend",
"def lps(s)\n return \"\" if s.empty?\n longest = [0,0]\n s.chars.each_with_index do |ch, idx|\n for i,j in [[idx, idx + 1], [idx, idx]]\n until s[i] != s[j]\n break if i < 0 || j >= s.length\n longest = [i,j] if longest[1] - longest[0] < j - i\n i -= 1\n j += 1\n end\n end\n end\n s[longest[0]..longest[1]]\nend",
"def repeatedString(s, n)\n s.count('a') * n.div(s.size) + s.slice(0,n.remainder(s.size)).count('a')\nend",
"def longest_non_repeating_substring(string)\n rep = 0\n hash = {}\n\n string.split('').each_with_index do |s, index|\n if hash[s]\n rep = rep > hash.size ? rep : hash.size\n hash = {}\n else\n hash[s] = true\n end\n end\n\n [rep, hash.size].max\nend",
"def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend",
"def rampant_repeats(s, h)\n s.chars.map do |c|\n if h[c]\n c * h[c]\n else\n c\n end\n end.join(\"\")\nend",
"def fifth_anagram?(str1, str2) # .295 O(n)\n h = Hash.new(0)\n str1.each_char { |c1| h[c1] += 1}\n str2.each_char { |c1| h[c1] -= 1}\n h.value?(0)\nend",
"def squeeze(string)\n new_string = []\n string.chars.each_with_index do |char, index|\n unless string[index] == string[index+1]\n new_string << char\n end\n end\n new_string.join()\nend",
"def first_uniq_char(s)\n hash_table = {}\n (0..s.length-1).each do |i|\n if hash_table.include? (s[i])\n hash_table[s[i]] = hash_table[s[i]] + 1\n else\n hash_table[s[i]] = 1\n end\n end\n\n (0..s.length-1).each do |i|\n if hash_table[s[i]] == 1\n return i\n end\n end\n return -1\nend",
"def n_twice (str, n)\n\tstr[0...n] + str[(str.length - n)..(str.length)]\nend",
"def hipster(sentence)\n vowels = ['a', 'e', 'i', 'o', 'u']\n sentence.split.map do |word|\n idx = word.length - 1\n while idx >= 0 \n if vowels.include?(word[idx])\n word = word[0...idx] + word[idx + 1..-1]\n break\n end\n idx -= 1\n end\n word\n end.join(\" \")\nend",
"def RunLength(str)\n\t new_str = []\n\t str = str.downcase.split('')\n\t hash = Hash.new(0)\n\t str.each do |k, v|\n\t \thash[k] += 1\n\t end\n\t \n\t hash.to_a.each do |a|\n\t \tnew_str.push(a.reverse.join)\n\t end\n\t new_str.join\nend",
"def longest_repeated_substring(input)\r\n len = input.size / 2 # Max size is half total length, since strings cannot overlap\r\n len = 255 if len > 255\r\n while len > 0\r\n # Find all substrings of given length\r\n sub_strings = {}\r\n for i in 0...input.size-len\r\n sub_str = input[i..i+len]\r\n \r\n if not sub_strings.has_key?(sub_str)\r\n # Add to list, track end pos for overlaps\r\n sub_strings[sub_str] = i+len \r\n elsif sub_strings[sub_str] < i\r\n # First non-overlapping match ties for longest\r\n return sub_str \r\n end\r\n end\r\n \r\n len -= 1\r\n end\r\n \r\n nil\r\nend",
"def most_frequent_bigram(str)\n new_array =[]\n new_arr = []\n hash = {}\n hash = Hash.new {|k, v| hash[k] = 0}\n new_str = str.split(\"\")\n (0...new_str.length).each do |i0|\n (i0...new_str.length).each do |iz|\n pair = new_str[i0..iz]\n new_array << pair\n end\n end\n\n new_array.each do |combined|\n if combined.length == 2\n new_arr << combined \n end\n end\n \n new_arr.each do |pairs| \n hash[pairs] += 1\n end\n \n hash.each {|k, v| return k.join(\"\") if v == hash.values.max}\n\n \nend",
"def compress_str(str)\n comp_str = \"\"\n (0..str.length - 1).each do |i|\n if str[i + 1] != nil\n if str[i] == str[i+1]\n if comp_str[-1] == str[i]\n # add one on the existing\n val = comp_str[-2].to_i + 1\n comp_str[-2] = val.to_s\n else\n comp_str += \"2\"+str[i]\n end\n else\n if comp_str[-1] != str[i]\n comp_str += str[i]\n end\n end\n else\n if comp_str[-1] != str[i]\n comp_str += str[i]\n end\n end\n end\n return comp_str\nend",
"def encrypt (s,n)\n result = nil\n if n <= 0\n result = s\n end\n n.times do\n i = 0\n odds = []\n evens = []\n result ||= s\n result.chars.each do\n odds.push(result[i+1])\n evens.push(result[i])\n i += 2\n end\n result = odds.join + evens.join\n end\n return result\nend",
"def compress_str(str)\n new_char = str.split(\"\") \n answer = \"\" \n count = 1\n i = 0\n while i < new_char.length \n if new_char[i] == new_char[i+1] \n count += 1\n elsif new_char[i] != new_char[i +1] && new_char[i] != new_char[i - 1]\n answer += new_char[i]\n else\n answer += count.to_s + new_char[i] \n count = 1\n end\n i += 1\n end\n answer\nend",
"def StringReduction(str)\n until str.split(\"\").uniq.length == 1\n str = str.sub(/ab|ba/, \"c\").\n sub(/ac|ca/, \"b\").\n sub(/cb|bc/, \"a\")\n end\n str.size \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 sherlock(str)\n str_len = str.length\n str_arr = str.split('')\n substrings_count = {}\n result = 0\n str_arr.each_with_index do |alpha, index|\n n = str_len - index\n n.times do |pos|\n ss = str_arr[index..(index+pos)].sort.join('')\n substrings_count[ss] = substrings_count[ss] ? substrings_count[ss]+1 : 1\n end\n end\n\n substrings_count.each do |key, val|\n result = result + ((val*(val-1))/2) if val > 1\n end\n result\nend",
"def encode_repeating(my_string)\n puts my_string\n\n if my_string == \"\" || my_string == nil || my_string.length == 0\n return my_string\n end\n\n\n new_arr = []\n hash = {}\n i = 0\n while i < my_string.length\n\n char = my_string[i]\n print char\n\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n\n i += 1\n\n end\n\n puts hash\n\n\n hash.each do |k, v|\n if v <= 2\n v.times do\n new_arr << k\n end\n elsif v > 2\n new_arr << k\n new_arr << v\n end\n end\n\n puts new_arr\n puts new_arr.join\n\n my_string = new_arr.join\n return my_string\n # raise NotImplementedError\nend",
"def uniq_subs(string)\n hash = {}\n\n i = 0\n while i < string.length\n j = i + 1\n while j <= string.length\n hash[string[i...j]] = true unless hash[string[i...j]]\n j += 1\n end\n i += 1\n end\n\n return hash.keys\nend",
"def rule2(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if (newstr[index..index+5].uniq.length==1)\n newstr[index..index+5] = newstr[index]\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end",
"def encode_repeating(my_string)\n # return if nil or empty\n return if (my_string == nil || my_string.length == 0)\n\n entering_index = 0 # this is where characters will get replaced\n examining_index = 0 # this is where the current character is getting examined and counted\n length = my_string.length\n while examining_index < length # all n characters will be examined\n temp = my_string[examining_index] # current character\n count = 1 # current character count\n while my_string[examining_index+1] == temp && examining_index < length\n examining_index += 1 # increment index\n count += 1 # increment current character count\n end\n # update at entering_index on seeing the subsequent character changing\n if count > 2 # enter the current character followed by it's count\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n my_string[entering_index] = count.to_s\n entering_index += 1\n elsif count == 2 # enter the current character twice\n count.times do\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n else # count == 1, enter the current character once\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n examining_index += 1 # move to next character\n end\n\n # delete trailing characters in the string.\n count = length - entering_index\n count.times do # worst case: delete n-2 number of characters\n my_string.slice! entering_index # trim the string\n end\n return\nend",
"def fifth_anagram?(str1, str2)\n\n counter = Hash.new(0)\n str1.each_char.with_index do |char, idx| #O(n)\n counter[char] += 1 \n counter[str2[idx]] -= 1\n end\n\n counter.values.all? { |v| v == 0 } #O(n)\n\nend",
"def staircase(n)\n str = ' ' * n \n 1.upto(n) do |i|\n str[-i] = '#'\n puts str\n end \n\nend"
] | [
"0.6302133",
"0.61150056",
"0.6113979",
"0.6094597",
"0.60698813",
"0.6040881",
"0.6017755",
"0.59926057",
"0.59926057",
"0.59700644",
"0.59689933",
"0.59623057",
"0.59617096",
"0.5959393",
"0.5949651",
"0.5927208",
"0.5918272",
"0.59065807",
"0.58962685",
"0.5892384",
"0.5891293",
"0.58764315",
"0.58729154",
"0.5870409",
"0.58692485",
"0.5862093",
"0.58553094",
"0.5844751",
"0.5844206",
"0.5841287",
"0.58358335",
"0.58297455",
"0.5826948",
"0.5808714",
"0.5800106",
"0.57887435",
"0.5781337",
"0.57798165",
"0.5778144",
"0.5778046",
"0.5777748",
"0.5754802",
"0.5751557",
"0.57499534",
"0.5743199",
"0.57305276",
"0.5725801",
"0.5725236",
"0.57221544",
"0.57203484",
"0.57155895",
"0.5710348",
"0.5708714",
"0.5705563",
"0.5700338",
"0.56983054",
"0.56963754",
"0.5694283",
"0.56915337",
"0.5679648",
"0.5673368",
"0.5666014",
"0.5659697",
"0.5659585",
"0.5657348",
"0.5652256",
"0.5651658",
"0.5650884",
"0.5648246",
"0.5636966",
"0.5636833",
"0.56364566",
"0.5636305",
"0.563585",
"0.56350774",
"0.56235003",
"0.5622819",
"0.56199527",
"0.56187",
"0.5617309",
"0.561194",
"0.5602341",
"0.55992913",
"0.55907464",
"0.5584982",
"0.55849487",
"0.55793273",
"0.55761343",
"0.55744946",
"0.55736774",
"0.55718684",
"0.55676246",
"0.556551",
"0.5561313",
"0.5560706",
"0.5558502",
"0.5556709",
"0.55563784",
"0.5554857",
"0.5552296",
"0.5552206"
] | 0.0 | -1 |
wraps a span if inspector option is set to all | def wrap_span(translation, translation_key)
# put the inspector class if inspector is all and the key doesn't belongs to translation_center
if TranslationCenter::CONFIG['inspector'] == 'all' && translation_key.name.to_s.split('.').first != 'translation_center'
"<span class='tc-inspector-key' data-locale='#{I18n.locale}' data-type='#{translation_key.status(I18n.locale)}' data-id='#{translation_key.id}'> #{translation} </span>".html_safe
else
translation
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def span?; end",
"def format_as_span_html(name, attr, body); end",
"def wrap_span(translation, translation_key)\n # put the inspector class if inspector is all and the key doesn't belongs to translation_center\n if TranslationCenter::CONFIG['inspector'] == 'all' && translation_key.name.to_s.split('.').first != 'translation_center'\n \"<span class='tc-inspector-key' data-type='#{translation_key.status(I18n.locale)}' data-id='#{translation_key.id}'> #{translation} </span>\".html_safe\n else\n translation\n end\n end",
"def _wrapped_spans(object_name,method,options={})\n\t\ts = \"<span class='label'>#{options[:label_text]||method}</span>\\n\"\n\t\tvalue = if options[:value]\n\t\t\toptions[:value]\n\t\telse\n\t\t\tobject = instance_variable_get(\"@#{object_name}\")\n\t\t\tvalue = object.send(method)\n\t\t\tvalue = (value.to_s.blank?)?' ':value\n\t\tend\n\t\ts << \"<span class='value'>#{value}</span>\"\n\tend",
"def span_start; end",
"def default_html_wrapper_element\n :span\n end",
"def html_span(*args, &block)\n html_tag(:span, *args, &block)\n end",
"def wrap_in_spans(**options)\n safe_join(options.fetch(:value, []).map { |v| content_tag(:span, html_escape(v)) })\n end",
"def span_wrap tag, text\n \"<span class='#{tag}' markdown='1'>#{text}</span>\"\nend",
"def as_span_libelle\n self.in_span(:class => 'libelle')\n end",
"def span(&block)\n span = Appdash::Span.new(self)\n return span unless block\n\n begin\n block.call(span)\n ensure\n span.flush\n end\n end",
"def span_start=(_); end",
"def span\n measure\n @span\n end",
"def have_span(operation_name = anything)\n Tracing::Matchers::HaveSpan.new(operation_name)\n end",
"def span(stylename, content)\n %Q(<text:span text:style-name=\"#{stylename}\">#{ERB::Util.h(content)}</text:span>)\n end",
"def textilize\n\t\tunless self.blank?\n\t\t RedCloth.new(self, [:filter_styles, :no_span_caps]).to_html\n\t\telse\n\t\t \"\"\n\t end\n\tend",
"def end_style\n \"</span>\"\n end",
"def have_spans(n = anything)\n Tracing::Matchers::HaveSpans.new(n)\n end",
"def parse_span_html; end",
"def show_spans\r\n spans = Document.new(self).get_spans\r\n puts \"There are #{spans.length} spans\"\r\n index = 1\r\n spans.each do |l|\r\n puts \"span: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" class: #{l.className}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def handling_amount_label\n\t $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-handlingamtlbl\")), __method__)\n\tend",
"def add_style(style)\n '<span style=\"' + style + '\">' + self + \"</span>\"\n end",
"def start_span attrs\n if attrs['class'] == 'caps'\n @nospan = true\n else\n @output << \"%\"\n @output << add_attributes(attrs) if add_attributes(attrs)\n end\n end",
"def span(name, identifier=nil, &block)\n define_method(name) do\n return platform.span_text_for identifier.clone unless block_given?\n self.send(\"#{name}_element\").text\n end\n define_method(\"#{name}_element\") do\n return call_block(&block) if block_given?\n platform.span_for(identifier.clone)\n end\n define_method(\"#{name}?\") do\n return call_block(&block).exists? if block_given?\n platform.span_for(identifier.clone).exists?\n end\n alias_method \"#{name}_span\".to_sym, \"#{name}_element\".to_sym\n end",
"def emit_empty_span(colspan)\n div :class => \"column span-#{colspan}\" do\n nbsp\n end\n end",
"def active_span\n raise NotImplementedError\n end",
"def simple_format_span(text, html_options={}, options={})\n text = '' if text.nil?\n text = text.dup\n start_tag = tag('span', html_options, true)\n text = sanitize(text) unless options[:sanitize] == false\n text = text.to_str\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text.html_safe.safe_concat(\"</span>\")\n end",
"def thru_redcloth aInline = false\n red = RedCloth.new self\n\n if aInline\n red.lite_mode = true\n red.hard_breaks = false\n red.no_span_caps = true\n end\n\n red.to_html\n end",
"def wrap(html); end",
"def wrap(html); end",
"def to_html\n %(<span class=\"ricsvn_string\" >#{self}</span>)\n end",
"def emit_text_span(colspan, textline, text_class=nil, options_hash={})\n div :class => \"column span-#{colspan}\" do\n if text_class || options_hash.length > 0\n if text_class\n options_hash[:class] = text_class\n end\n span options_hash do\n text(textline)\n end\n else\n text(textline)\n end \n end\n end",
"def with_span(span)\n Context.with(CONTEXT_SPAN_KEY, span) { |s| yield s }\n end",
"def slider_span(ref, options = {})\n options['data-set-from-slider'] = ref\n content_tag(:span, '', options)\n end",
"def wrap\n @text\n end",
"def wraps?; @wraps; end",
"def span_elements(identifier)\n platform.spans_for(identifier.clone)\n end",
"def this_span\n get_span @span_id\n end",
"def clearing_span\n\t\tcontent_tag(:span, '', :class => 'clear')\n\tend",
"def remove_spans_wo_attrs(env)\n node = env[:node]\n\n node.replace(node.inner_html) if node.element? && node.name == 'span' && node.attr('style').blank?\n end",
"def with_span(span)\n Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }\n end",
"def bob_left_span\n raw '<div class=\"row\">' \\\n ' <div class=\"large-8 medium-6 small-12 columns\">'\n end",
"def with_span(span)\n Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }\n end",
"def holding_location_span(location, holding_id)\n content_tag(:span, location,\n class: 'location-text',\n data: { location: true, holding_id: })\n end",
"def wrapped_by_paragraph; end",
"def span_tag(class_name, token)\n \"<span class='#{class_name}'>#{token}</span>\"\n end",
"def format_as_block_html(name, attr, body, indent); end",
"def render\n tag.div(children, class: \"badge #{label_class}\") + computed_visibility_notice\n end",
"def wrap_text\n return @wrap_text\n end",
"def default_html_wrapper_element\n @default_html_wrapper_element ||= :span\n end",
"def span_with_id(span_id, options = {})\r\n if options && options[:index] then\r\n span(:id => span_id.to_s, :index => options[:index]).text\r\n else\r\n span(:id, span_id).text\r\n end\r\n end",
"def with_span(\n name,\n type = nil,\n subtype: nil,\n action: nil,\n context: nil,\n include_stacktrace: true,\n trace_context: nil,\n parent: nil,\n sync: nil\n )\n unless block_given?\n raise ArgumentError,\n 'expected a block. Do you want `start_span\\' instead?'\n end\n\n return yield nil unless agent\n\n begin\n span =\n start_span(\n name,\n type,\n subtype: subtype,\n action: action,\n context: context,\n include_stacktrace: include_stacktrace,\n trace_context: trace_context,\n parent: parent,\n sync: sync\n )\n result = yield span\n span&.outcome ||= Span::Outcome::SUCCESS\n result\n rescue\n span&.outcome ||= Span::Outcome::FAILURE\n raise\n ensure\n end_span\n end\n end",
"def to_s\n \"Span(name:#{@name},sid:#{@id},tid:#{@trace_id},pid:#{@parent_id})\"\n end",
"def current_span\n agent&.current_span\n end",
"def non_recording_span(span_context)\n Span.new(span_context: span_context)\n end",
"def raw\n parse_span(@type, @text, @options)\n end",
"def apply_wrap!(opt)\n super(opt, WRAP_FORMATS)\n end",
"def apply_wrap!(opt)\n super(opt, WRAP_FORMATS)\n end",
"def apply_wrap!(opt)\n super(opt, WRAP_FORMATS)\n end",
"def _wrapped_yes_or_no_spans(object_name,method,options={})\n\t\tobject = instance_variable_get(\"@#{object_name}\")\n\t\ts = \"<span class='label'>#{options[:label_text]||method}</span>\\n\"\n\t\tvalue = (object.send(\"#{method}?\"))?'Yes':'No'\n\t\ts << \"<span class='value'>#{value}</span>\"\n\tend",
"def places_of_interest\n capture_haml do\n haml_tag :div, class: 'poi' do\n expander\n bar\n end\n end\n end",
"def membergroups_style_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Style/\"), __method__)\n end",
"def subtotal_amount_label\n\t $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-subttlamtlbl\")), __method__)\n\tend",
"def on_start(span)\n # noop\n end",
"def end_span(span = nil)\n agent&.end_span(span)\n end",
"def span_with_id(span_id)\n span(:id, span_id).text\n end",
"def context_with_span(span, parent_context: Context.current)\n parent_context.set_value(CURRENT_SPAN_KEY, span)\n end",
"def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end",
"def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end",
"def in_span name, skip_frames: 0, sampler: nil\n span = start_span name, skip_frames: skip_frames + 1, sampler: sampler\n begin\n yield span\n ensure\n end_span span\n end\n end",
"def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end",
"def node\n Component.span\n end",
"def node\n Component.span\n end",
"def parse_span_extensions; end",
"def format_as_indented_block_html(name, attr, body, indent); end",
"def codespan(code)\n \"{{#{code}}}\"\n end",
"def enclose(*) end",
"def start_span(span)\n @@spans.push(span)\n end",
"def inner_text; end",
"def inner_text; end",
"def emit_text_span_strong(colspan, textline, text_class=nil, options_hash={})\n if text_class\n options_hash[:class] = text_class\n end\n div :class => \"column span-#{colspan}\" do\n strong options_hash do\n text(textline)\n end\n end\n end",
"def hidden_span_if(condition, options = {}, &block)\n hidden_tag_if(:span, condition, options, &block)\n end",
"def decorate!; end",
"def decorate!; end",
"def wrap_text=(value)\n @wrap_text = value\n end",
"def map_wrapping\n widget_wrapping\n end",
"def export spans\n each { |delegate| delegate.export spans }\n nil\n end",
"def span_descendents(e)\n ns = Nokogiri::XML::NodeSet.new(Nokogiri::XML::Document.new)\n e.element_children.inject(ns) do |descendents, c|\n if HTML_INLINE_ELEMS.include?(c.name)\n descendents << c\n descendents += span_descendents(c)\n end\n descendents\n end\n end",
"def active_span\n scope = scope_manager.active\n scope.span if scope\n end",
"def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, sampling_hint: nil, with_parent: nil, with_parent_context: nil)\n span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, sampling_hint: sampling_hint, with_parent: with_parent, with_parent_context: with_parent_context)\n with_span(span) { |s| yield s }\n ensure\n span.finish\n end",
"def tooltip_markup(markup)\n content_tag :span, markup.html_safe\n end",
"def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)\n span_context = with_parent&.context || active_span_context(with_parent_context)\n if span_context.valid?\n Span.new(span_context: span_context)\n else\n Span.new\n end\n end",
"def visibility\n self.public? ? \"<span class='sc-badge bg-success text-success'>Public</span>\".html_safe : \"<span class='sc-badge bg-danger text-danger'>Private</span>\".html_safe\n end",
"def wrap\r\n result = child.respond_to?(:each) ? \"(#{child})\" : child.to_s\r\n end",
"def gamestop_orders_label\n # unit_test_no_generate: gamestop_orders_label, span.className(create_ats_regex_string(\"ats-gsorderslbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-gsorderslbl\")), __method__)\n end",
"def wrap( content )\n content\n end",
"def addendum_element(options = {})\n addendum = options.delete :addendum\n if addendum\n @template.content_tag :span, addendum, :class => 'addendum'\n else\n ''\n end\n end",
"def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, with_parent: nil, with_parent_context: nil)\n span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, with_parent: with_parent, with_parent_context: with_parent_context)\n with_span(span) { |s, c| yield s, c }\n rescue Exception => e # rubocop:disable Lint/RescueException\n span.record_error(e)\n span.status = Status.new(Status::UNKNOWN_ERROR,\n description: \"Unhandled exception of type: #{e.class}\")\n raise e\n ensure\n span.finish\n end",
"def call_number_span\n %(<span class=\"link-text\">#{I18n.t('blacklight.holdings.browse')}</span>\\\n <span class=\"icon-bookslibrary\"></span>)\n end"
] | [
"0.7098346",
"0.6849896",
"0.62820774",
"0.6148056",
"0.6100718",
"0.6035346",
"0.5988859",
"0.5985079",
"0.5972015",
"0.5919117",
"0.5876541",
"0.57759917",
"0.5760505",
"0.568273",
"0.5648857",
"0.5648627",
"0.5646561",
"0.56354374",
"0.5634116",
"0.54959905",
"0.548071",
"0.54455477",
"0.53920126",
"0.5370398",
"0.5291453",
"0.52725416",
"0.52428114",
"0.5237718",
"0.52008575",
"0.52007455",
"0.52007455",
"0.5192982",
"0.51853573",
"0.518239",
"0.51750743",
"0.5173281",
"0.5171616",
"0.5159756",
"0.51461375",
"0.5140993",
"0.5140567",
"0.5140128",
"0.5113921",
"0.51138896",
"0.5108128",
"0.5085446",
"0.50843143",
"0.5081466",
"0.50643784",
"0.50624776",
"0.50521165",
"0.5045096",
"0.5041306",
"0.5039713",
"0.50286126",
"0.5021442",
"0.5001822",
"0.49920318",
"0.49920318",
"0.49920318",
"0.49850827",
"0.49842134",
"0.49822912",
"0.4979404",
"0.49770883",
"0.49736443",
"0.49709636",
"0.49660438",
"0.49562296",
"0.49562296",
"0.49170738",
"0.4903704",
"0.48951495",
"0.48951495",
"0.48813394",
"0.48760587",
"0.4868328",
"0.48663303",
"0.4860057",
"0.48546228",
"0.48546228",
"0.48543411",
"0.48466018",
"0.48407578",
"0.48407578",
"0.48357803",
"0.48242837",
"0.4813073",
"0.48103034",
"0.48094836",
"0.47985265",
"0.47878778",
"0.47866917",
"0.47857606",
"0.47786856",
"0.47738612",
"0.47616398",
"0.47499204",
"0.47494382",
"0.4749012"
] | 0.6274524 | 3 |
make sure the complete key is build using the options such as scope and count | def prepare_key(key, options)
complete_key = key
# if a scope is passed in options then build the full key
complete_key = options[:scope].present? ? "#{options[:scope].to_s}.#{complete_key}" : complete_key
# add the correct count suffix
if options[:count].present? && options[:count] == 1
complete_key = "#{complete_key}.one"
elsif options[:count].present? && options[:count] != 1
complete_key = "#{complete_key}.other"
end
complete_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_master_key=(_arg0); end",
"def require_master_key=(_arg0); end",
"def reserve_key(key); end",
"def require_master_key; end",
"def require_master_key; end",
"def possible_keys(key); end",
"def rekey_as_needed; end",
"def flexible_key; end",
"def rekey_limit=(_arg0); end",
"def rekey_limit; end",
"def key_variants; end",
"def key=(key); end",
"def key=(_arg0); end",
"def key=(_arg0); end",
"def key=(_arg0); end",
"def openid_consumer_complete hash = {}\n #params[:openid_complete] = 1\n openid_consumer hash.update :only_path => !!hash[:only_path]\n end",
"def initialize(key)\n key ||= Apicasso::Key.new\n cannot :manage, :all\n cannot :read, :all\n key.scope&.each do |permission, klasses_clearances|\n build_permissions(permission: permission, clearance: klasses_clearances)\n end\n end",
"def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end",
"def api_key=(_arg0); end",
"def api_key=(_arg0); end",
"def api_key=(_arg0); end",
"def num_key_fields() 1 end",
"def if_needs_rekey?; end",
"def max_key_width=(_arg0); end",
"def key; @opts['key'] end",
"def running_key_params\n params.require(:running_key).permit(:user_id, :input, :group_length, :page_number, :line, :book_id)\n end",
"def build=(_arg0); end",
"def valid_build hash\n attrs = { project_id: project.id, branch: 'master' }.merge(hash)\n Build.create! attrs\n end",
"def missing_keys; end",
"def resident_key=(_arg0); end",
"def generate_key; end",
"def build; end",
"def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end",
"def needs_rekey?; end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def has_key(key, pos= 0, len= -1)\n end",
"def key_types=(_arg0); end",
"def key_params\n params.require(:key).permit(:name, :value)\n end",
"def key_data; end",
"def key_data; end",
"def complete?\n keys.all?(&:complete?)\n end",
"def build\n @values.fetch('ai.application.build') { \n @values['ai.application.build'] = nil\n }\n end",
"def long_key\n {'EXP'=>'Experimental Assay','MODEL'=>'Modelling Analysis'}[key]\n end",
"def apikey_params\n params.require(:apikey).permit(:api_key, :count, :user_id)\n end",
"def build!\n end",
"def build\n # use guard clauses to a) avoid nested ifs b) early identify invalid values\n raise ArgumentError, \"`a` must be a Fixnum\" unless dirty.fetch(:a).is_a? Fixnum\n\n # #tap will guarantee, that a hash is returned\n {}.tap do |h|\n h[:a] = dirty.fetch(:a) # a mandatory parameter, will raise a KeyError on violation\n h[:b] = dirty.fetch(:b, 2) # optional, with 2 as the default\n h[:c] = dirty.fetch(:c) if dirty.has_key? :c # optional, no default\n end\n end",
"def key_skill; end",
"def check_write_key!\n fail ArgumentError, 'Write key must be initialized' if @write_key.nil?\n end",
"def create_key\n if @house.find_room(:garden).inventory.include?(\"shovel\") && (@level == 0)\n @house.create_item(\"key\", \"It's a key, but what's it for?\", 10)\n @house.find_room(:garden).inventory << \"key\"\n @house.last_move_message = \"You dug up a key in the garden! What's it for?\"\n @level+=1\n end\n end",
"def key_params\n params.require(:key).permit(:key, :note, :data_type)\n end",
"def include_key?(key)\n\t\t\ttrue\n\t\tend",
"def set_key_file(opts)\n opts = check_params(opts,[:keys])\n super(opts)\n end",
"def chargeable_unit_properties_with_autobuild\n chargeable_unit_properties_without_autobuild || build_chargeable_unit_properties\n end",
"def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end",
"def initialize(key, desc, opts = {})\n super(key, desc, opts)\n @commands = {}\n @required = opts.fetch(:required, !opts.has_key?(:default))\n @usage_value = opts.fetch(:usage_value, key.to_s.gsub('_', '-').upcase)\n end",
"def confirm_newkeys; end",
"def validate_build\n end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def build_file_into_master_hash(master_hash, key, source_file)\r\n\t\tentries = grab_and_hashify(source_file, SIZE_OF_HASH_BLOCKS)\r\n\t\tif(!entries.blank?)\r\n\t\t\tmaster_hash.merge({ key.to_sym => entries })\r\n\t\telse\r\n\t\t\tmaster_hash.delete(key.to_sym)\r\n\t\t\tmaster_hash\r\n\t\tend\r\n\tend",
"def keygens; end",
"def key_id=(_arg0); end",
"def update!(**args)\n @key = args[:key] if args.key?(:key)\n @token_groups = args[:token_groups] if args.key?(:token_groups)\n end",
"def search_new_key(key)\n _key = key\n if get_file(key).present?\n (1..999).each do |i|\n _key = key.cama_add_postfix_file_name(\"_#{i}\")\n break unless get_file(_key).present?\n end\n end\n _key\n end",
"def add_required_keys\n required_hash.delete('Details') unless json_data['Details'].present?\n self.final_hash = merge_required ? required_hash.with_indifferent_access.merge(json_data) : json_data\n end",
"def build\r\n end",
"def build\r\n end",
"def key=(_); end",
"def key=(_); end",
"def create(key, options)\n build_status_api.post(@commit.hash, key, options).tap do |m|\n m.revision = @commit.hash\n m.repo_keys = @commit.repo_keys\n end\n end",
"def update!(**args)\n @keymaster_key_type = args[:keymaster_key_type] if args.key?(:keymaster_key_type)\n @serialized_verification_key = args[:serialized_verification_key] if args.key?(:serialized_verification_key)\n @serialized_verification_keyset = args[:serialized_verification_keyset] if args.key?(:serialized_verification_keyset)\n end",
"def update!(**args)\n @keymaster_key_type = args[:keymaster_key_type] if args.key?(:keymaster_key_type)\n @serialized_verification_key = args[:serialized_verification_key] if args.key?(:serialized_verification_key)\n @serialized_verification_keyset = args[:serialized_verification_keyset] if args.key?(:serialized_verification_keyset)\n end",
"def key_length(name); end",
"def build_params\n params.require(:build).permit(:repo_id, :status)\n end",
"def can_build?\n length > 1\n end",
"def expanded_key(key) # :nodoc:\n return validate_key(key.cache_key.to_s) if key.respond_to?(:cache_key)\n\n case key\n when Array\n if key.size > 1\n key = key.collect{|element| expanded_key(element)}\n else\n key = key.first\n end\n when Hash\n key = key.sort_by { |k,_| k.to_s }.collect{|k,v| \"#{k}=#{v}\"}\n end\n\n validate_key(key.respond_to?(:to_param) ? key.to_param : key)\n end",
"def required_keywords; end",
"def test_modifyingfile\n keys = []\n names = []\n 3.times {\n k = mkkey\n #h[:ensure] = :present\n #h.retrieve\n keys << k\n names << k.name\n }\n assert_apply(*keys)\n keys.clear\n\n @catalog.clear(true)\n @catalog = nil\n\n newkey = mkkey\n #newkey[:ensure] = :present\n names << newkey.name\n assert_apply(newkey)\n\n # Verify we can retrieve that info\n assert_nothing_raised(\"Could not retrieve after second write\") {\n newkey.provider.prefetch\n }\n\n assert(newkey.provider.exists?, \"Did not see key in file\")\n end",
"def build\n end",
"def verify_key; end",
"def verify_key; end",
"def _key(*args); args.hash; end",
"def build_status(key, options = {})\n build_statuses_resource.find(key, options)\n rescue Tinybucket::Error::NotFound\n nil\n end",
"def check_or_create_for!(hash, key)\n hash[key] = \"\" unless hash.include?(key)\n end",
"def extra_keys(options, recall = T.unsafe(nil)); end",
"def run\n super\n # create permutations\n additional_keywords = _get_option('additional_keywords').delete(' ').split(',')\n additional_keywords << _get_entity_name\n\n permutations = additional_keywords.map { |k| generate_permutations(k) } # generate permutations\n permutations << additional_keywords\n permutations.flatten!\n\n valid_buckets = bruteforce_buckets(permutations)\n _log \"Found #{valid_buckets.size} valid buckets.\"\n return if valid_buckets.empty?\n\n valid_buckets.each { |v| create_entity(v) }\n end",
"def simple_chore_params\n params.require(:simple_chore).permit(:name, :completed)\n end",
"def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end",
"def build_key(preview_json, key)\n key += preview_json['key'] if preview_json['key'] && !key.ends_with?(preview_json['key'])\n key\n end",
"def credential_key_params\n params.require(:credential_key).permit(:credential_id, :key, :value)\n end",
"def extra_keys(options, recall={})\n generate_extras(options, recall).last\n end",
"def key_set?\n !attributes['key'].nil?\n end",
"def ensure_complete_key(hash)\n keys_as_strings = hash.keys.map(&:to_s)\n missing = value_column_names - keys_as_strings\n extra = keys_as_strings - value_column_names\n\n missing = missing.select do |missing_column_name|\n column = @low_card_model.columns.detect { |c| c.name.to_s.strip.downcase == missing_column_name.to_s.strip.downcase }\n if column && column.default\n the_default = column.default\n the_default = type_cast(column, the_default)\n hash[column.name] = the_default\n false\n else\n true\n end\n end\n\n if missing.length > 0\n raise LowCardTables::Errors::LowCardColumnNotSpecifiedError, \"The following is not a complete specification of all columns in low-card table '#{@low_card_model.table_name}'; it is missing these columns: #{missing.join(\", \")}: #{hash.inspect}\"\n end\n\n if extra.length > 0\n raise LowCardTables::Errors::LowCardColumnNotPresentError, \"The following specifies extra columns that are not present in low-card table '#{@low_card_model.table_name}'; these columns are not present in the underlying model: #{extra.join(\", \")}: #{hash.inspect}\"\n end\n\n hash\n end",
"def key_attrs\n @key_attrs ||= {}\n end",
"def scope_options; end",
"def scope_options; end",
"def add_key_data(key_data_); end"
] | [
"0.6185478",
"0.6185478",
"0.5928056",
"0.5750648",
"0.5750648",
"0.5669566",
"0.5653811",
"0.5534185",
"0.54608905",
"0.53779304",
"0.5377498",
"0.53765714",
"0.5315928",
"0.5315928",
"0.5315928",
"0.53034055",
"0.5301031",
"0.52843225",
"0.5276526",
"0.5276526",
"0.5276526",
"0.5247935",
"0.5206769",
"0.52037066",
"0.5201699",
"0.51928794",
"0.5186738",
"0.51575834",
"0.51380503",
"0.5130321",
"0.5113963",
"0.5107278",
"0.5105549",
"0.51002806",
"0.50996333",
"0.50972503",
"0.50941104",
"0.50939596",
"0.5093674",
"0.5093674",
"0.5089616",
"0.5079495",
"0.5067631",
"0.5047867",
"0.50252295",
"0.50251466",
"0.502266",
"0.50113976",
"0.50043166",
"0.5003356",
"0.49922687",
"0.49849406",
"0.49830136",
"0.4982586",
"0.49695155",
"0.49666387",
"0.49616495",
"0.49562138",
"0.49562138",
"0.49562138",
"0.49562138",
"0.49562138",
"0.49538705",
"0.49499246",
"0.49473882",
"0.4942806",
"0.4940175",
"0.49381924",
"0.49242938",
"0.49242938",
"0.4920556",
"0.4920556",
"0.49185914",
"0.49078524",
"0.49078524",
"0.49054077",
"0.48982596",
"0.4896074",
"0.48946056",
"0.48926115",
"0.4890229",
"0.48900872",
"0.4888875",
"0.4888875",
"0.48803312",
"0.48784807",
"0.4877889",
"0.48743063",
"0.48654073",
"0.48646846",
"0.4864516",
"0.48638543",
"0.48577744",
"0.485309",
"0.48503962",
"0.4849764",
"0.48482946",
"0.48482403",
"0.48482403",
"0.48480335"
] | 0.69126046 | 0 |
Returns +true+ if +self+ subtypes +other+. A UnionType subtypes another type if all the values in the union are subtypes of +other+. This has the effect of deferring dealing with unions on the rhs of a relation into the Type class. There may be better ways of doing this. | def <=(other)
@types.all? do |t|
t <= other
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind_of?(other)\n super || object.kind_of?(other)\n end",
"def evaluate_subtype?(other, type_bindings = nil, same_parameter_types = false)\n raise NotImplementedError\n end",
"def contains?(other_type)\n if !(kind_of_class <= other_type.kind_of_class)\n return false\n end\n\n modules_included = other_type.kind_of_modules.all? do |m|\n kind_of_class <= m ||\n kind_of_modules.any? { |self_m| self_m <= m }\n end\n if !modules_included\n return false\n end\n\n other_type.messages.all? do |m|\n responds_to_duck_message?(m)\n end\n end",
"def kind_of?(other)\n super || __getobj__.kind_of?(other)\n end",
"def subtype?(t1, t2)\n return true if t1 == t2\n fclass(t2) # Check existance of class t2\n return fclass(t1).descendant_of?(t2)\n end",
"def same_types?(other)\n types == other.types\n end",
"def is_or_is_descendant_of?(other)\n other == self || is_descendant_of?(other)\n end",
"def eql?(other)\n self.equal?(other) ||\n (self.class.eql?(other.class) &&\n self.datatype.eql?(other.datatype) &&\n self == other)\n end",
"def is_or_is_descendant_of?(other)\n (other == self) or is_descendant_of?(other)\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def joinable?(other)\n kind_of?(other.class) || other.kind_of?(self.class)\n end",
"def include?(singleton_type)\n if singleton_type.is_union_type?\n raise AssertionError.new(\"Union type can never be included in union type\")\n end\n\n @types.include?(singleton_type)\n end",
"def is_or_is_ancestor_of?(other)\n other == self || is_ancestor_of?(other)\n end",
"def comparable?(other)\n kind_of?(other.class) || other.kind_of?(self.class)\n end",
"def match(other)\n return @type.match(other)\n end",
"def is_or_is_ancestor_of?(other)\n (other == self) or is_ancestor_of?(other)\n end",
"def superset_of?( other_collection )\n other.all? {|e| self.include? e }\n end",
"def ==(other)\n if other.equal?(self)\n true\n elsif other.is_a?(Set) || other.is_a?(Array)\n other.size == size && other.all? { |e| include?(e) }\n else\n false\n end\n end",
"def union?(*types)\n tm = types.map { |t| wrap(t) }\n ->(o) { tm.map { |t| t.call(o) }.any? }\n end",
"def same_kind?(other)\n other.ordered_tree && other.ordered_tree.base_class == tree.base_class\n end",
"def ===(other)\n return false unless self.type == other.type\n return true\n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def is_a?(other)\n if other == Mongoid::Boolean || other.class == Mongoid::Boolean\n return true\n end\n super(other)\n end",
"def proper_subset?(other_set)\n requires_set(other_set, __method__)\n return false if self == other_set\n return false unless self.subset?(other_set) && self.length < other_set.length\n true\n end",
"def isUnionType(obj)\n return obj.kind_of? FFI::Union\n end",
"def commensurate?(other)\n s = self.base.unit.map{ |u| u.type }.uniq\n o = other.base.unit.map{ |u| u.type }.uniq\n (s - o).empty? && (o - s).empty?\n end",
"def extends?(type)\n @supertype && @supertype.type_of?(type) && @supertype\n end",
"def eql?(other)\n other.class == self.class && other.members.eql?(self.members)\n end",
"def like?(other)\n if other.respond_to?(:simplified)\n @simplified == other.simplified\n else\n @simplified == Type.simplified(other)\n end\n end",
"def eql?(other)\n\t\tif other.kind_of?(self.class)\n\t\t\t@a.eql?(other.a) && @b.eql?(other.b)\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def contained?(other)\n other.contains?(self)\n end",
"def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end",
"def is_or_is_descendant_of?(other)\n record == other || is_descendant_of?(other)\n end",
"def eql?(other)\n other.is_a?(self.class) && self == other\n end",
"def eql?(other)\n other.is_a?(self.class) && self == other\n end",
"def superset?(other_set)\n requires_set(other_set, __method__)\n other_set.subset?(self)\n end",
"def is_or_is_sibling_of?(other)\n (other == self) or is_sibling_of?(other)\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def include_one_of?(other)\n unless other.collect {|string| true if self.include_string? string}.compact.blank?\n return true\n else\n return false\n end\n end",
"def matches_type? value, expected_type: type\n case expected_type\n # Raw class types\n when Array\n case expected_type.length\n when 0\n return value.is_a?(Array)\n when 1\n return value.all?{ |v| matches_type?(v, expected_type: expected_type[0]) }\n else\n return expected_type.zip([value].flatten(1)).all?{ |t, v| matches_type?(v, expected_type: t) }\n end\n else\n value.is_a?(expected_type)\n end\n end",
"def eql?(other)\n\t\tother = other.value if other.is_a? self.class\n\t\treturn value.eql?(other)\n\tend",
"def all_subtype\n all_type_inheritance_as_supertype.map(&:subtype)\n end",
"def eql?(other)\n self.class == other.class && self == other\n end",
"def eql?(other)\n self.class.equal?(other.class) && value == other.value\n end",
"def eql?(other)\n self.class.equal?(other.class) && value == other.value\n end",
"def check_subtype(x, y, &recursively_check_subtype)\n raise NotImplementedError\n end",
"def conflict?(other)\n return false unless self.class == other.class\n self.eql?(other) && self != other\n end",
"def == other\n\t\tcase other when FalseClass, self.class\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def is_on_union?\n for battler in $game_party.actors\n return true if battler.union_members.include?(self)\n end\n return false\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n self._name.eql?(other._name) &&\n self._type.eql?(other._type) &&\n self._klass.eql?(other._klass)\n end",
"def factor?(other)\n s = self.base.unit.map{ |u| [u.type] * u.power }.flatten\n o = other.base.unit.map{ |u| [u.type] * u.power }.faltten\n (s - o).empty?\n end",
"def eql?(other)\n self.class == other.class and self == other\n end",
"def eql?(other)\n (self.class == other.class) && car.eql?(other.car) && cdr.eql?(other.cdr)\n end",
"def ===(other)\n other.is_a?(self)\n end",
"def ==(other)\n\tother_units = units_for_other(other)\n\tif @units and other_units\n\t (@units == other_units) and super(other)\n\telsif @units or other_units\n\t false\n\telse\n\t super(other)\n\tend\n end",
"def other?\n @streams.any? { |stream| stream.is_a? OtherStream }\n end",
"def expand(union_type)\n if not union_type.is_union_type?\n raise AssertionError.new(\n \"Cannot expand with non-union type: #{union_type}\")\n end\n\n is_expanded = false\n\n for type in union_type\n is_expanded = is_expanded | add(type)\n end\n\n return is_expanded\n end",
"def eql?(other)\n self.class == other.class && self == other\n end",
"def eql?(other)\n self.class == other.class && self == other\n end",
"def eql?(other)\n self.class == other.class && self == other\n end",
"def eql?(other)\n self.class == other.class && self == other\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def accepts?(other)\n true\n end",
"def eql?(other)\n return false unless self.class.eql?(other.class)\n instance_variables.map do |var|\n instance_variable_get(var).eql?(other.instance_variable_get(var))\n end.all?\n end",
"def eql?(other)\n if equal?(other)\n return true\n end\n\n unless other.kind_of?(self.class)\n return false\n end\n\n cmp?(other, :eql?)\n end",
"def eql?(other)\n other.is_a?(AggregateGraph) ? super : false\n end",
"def nullable?\n subtype.nullable?\n end",
"def subset_of?( other_collection )\n all? {|e| other_collection.include? e }\n end",
"def eql?(other)\n if equal?(other)\n return true\n end\n\n unless other.instance_of?(self.class)\n return false\n end\n\n cmp?(other, :eql?)\n end",
"def eql?(other)\n other.class == self.class\n end",
"def contains_all?(other)\n (other & self) == self\n end",
"def eql?(other)\n other.instance_of?(self.class) && self == other\n end",
"def =~( other )\n\t\tunless other.is_a?( Arrow::AcceptParam )\n\t\t\tother = self.class.parse( other.to_s ) rescue nil\n\t\t\treturn false unless other\n\t\tend\n\n\t\t# */* returns true in either side of the comparison.\n\t\t# ASSUMPTION: There will never be a case when a type is wildcarded\n\t\t# and the subtype is specific. (e.g., */xml)\n\t\t# We gave up trying to read RFC 2045.\n\t\treturn true if other.type.nil? || self.type.nil?\n\n\t\t# text/html =~ text/html\n\t\t# text/* =~ text/html\n\t\t# text/html =~ text/*\n\t\tif other.type == self.type\n\t\t\treturn true if other.subtype.nil? || self.subtype.nil?\n\t\t\treturn true if other.subtype == self.subtype\n\t\tend\n\n\t\treturn false\n\tend",
"def ==(other)\n case other\n when Literal\n self.value.eql?(other.value) &&\n self.language.eql?(other.language) &&\n self.datatype.eql?(other.datatype)\n when String\n self.plain? && self.value.eql?(other)\n else false\n end\n end",
"def eql?(other)\n if ! other.is_a?(self.class)\n false\n else\n [@mean, @variance] == [other.mean, other.variance]\n end\n end",
"def is_or_is_ancestor_of?(other)\n same_scope?(other) && other.is_or_is_descendant_of?(record)\n end",
"def eql?(other)\n instance_of?(other.class) &&\n left.eql?(other.left) &&\n right.eql?(other.right)\n end",
"def java_kind_of?(other)\n return true if self.kind_of?(other)\n return false unless self.respond_to?(:java_class) && other.respond_to?(:java_class) &&\n other.kind_of?(Module) && !self.kind_of?(Module) \n return other.java_class.assignable_from?(self.java_class)\n end",
"def ==(other)\n return true if equal?(other)\n return false unless other.class == self.class\n return true if these_fields_are_equal(other)\n\n false\n end",
"def is_on_union?\n for battler in $game_troop.enemies\n return true if battler.union_members.include?(self)\n end\n return false\n end",
"def ==(other)\n super || other.class == self.class && other.value == value\n end",
"def polymorphic?\n @polymorphic == true || !@as.nil?\n end",
"def eql?(other)\n return true if other.equal?(self)\n instance_of?(other.class) && to_ary.eql?(other.to_ary)\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def conforms_to?(type1, type2)\n get_cls = ->(type){\n if type.is_a?(TyParam)\n find_class('Object')\n else\n find_class(type.name)\n end\n }\n cls1, cls2 = get_cls[type1], get_cls[type2]\n return cls1 == cls2 || cls1.subclass_of?(cls2, self)\n end",
"def look_same_as?(other)\n return nil unless other.kind_of?(self.class)\n (name == other.name) and (definition == other.definition)\n end",
"def eql?(other)\n other.class == self.class && self == other\n end",
"def eql?(other)\n return true if equal?(other)\n instance_of?(other.class) && cmp?(other, :eql?)\n end",
"def eql?(other)\n\t if other.zero?\n\t\t@value.zero?\n\t elsif other.respond_to?(:units)\n\t\tif other.respond_to? :value\n\t\t @units.eql?(other.units) and @value.eql?(other.value)\n\t\telse\n\t\t other == self\n\t\tend\n\t else\n\t\t@units.nil? and @value.eql?(other)\n\t end\n\tend",
"def eql?(other)\n other.kind_of?(MIME::Type) and self == other\n end",
"def ==(other)\n if other.class == self.class\n other.results == self.results\n elsif other.class <= Array\n other == self.results\n else\n false\n end\n end",
"def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end",
"def ensure_no_subtractions(other)\n bools = map do |elem|\n case elem\n when String\n other.include?(elem)\n when Hash\n match = other.find { |e|e.is_a?(Hash) && e.keys[0] == elem.keys[0] }\n if match\n elem.values.any? ? elem.values[0].ensure_no_subtractions(match.values[0]) : true\n else\n false\n end\n end\n end\n bools.all?\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class && super(o)\n end",
"def =~(other)\n case other\n when VectorType then equalish_vec4(other)\n when Numeric then equalish_scalar(other)\n else false\n end\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def ==(other)\n self.class == other.class\n end",
"def has_etype?(etype)\n mask_for_etype = self.class.mask_from_etype(etype)\n return (self.mask & mask_for_etype).eql?(mask_for_etype)\n end",
"def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::DateTime\n return super unless other.valid?\n self.object == other.object\n when Literal::Time, Literal::Date\n false\n else\n super\n end\n end"
] | [
"0.6656991",
"0.6471581",
"0.60800517",
"0.60759646",
"0.5913035",
"0.58639884",
"0.5717553",
"0.56524837",
"0.5639843",
"0.55951434",
"0.54245025",
"0.5378488",
"0.5363163",
"0.5337256",
"0.53275406",
"0.5321028",
"0.5317216",
"0.53049093",
"0.52971166",
"0.52787286",
"0.52780914",
"0.5262358",
"0.5260665",
"0.52525073",
"0.52155536",
"0.51864237",
"0.5183252",
"0.5162572",
"0.51397604",
"0.51176673",
"0.5107987",
"0.5077445",
"0.50759554",
"0.50521886",
"0.50521886",
"0.5033412",
"0.5030453",
"0.50282836",
"0.50258446",
"0.5018913",
"0.49942964",
"0.49860573",
"0.49837866",
"0.49816284",
"0.49816284",
"0.4980082",
"0.4977155",
"0.49702066",
"0.49681598",
"0.49664503",
"0.4962772",
"0.49419245",
"0.49259293",
"0.49230653",
"0.49226418",
"0.4919466",
"0.49138784",
"0.49081922",
"0.49081922",
"0.49081922",
"0.49081922",
"0.49070752",
"0.49070752",
"0.48948646",
"0.4880373",
"0.48769635",
"0.48768127",
"0.48723078",
"0.48692656",
"0.48658854",
"0.48652473",
"0.48566332",
"0.48521572",
"0.48510733",
"0.484256",
"0.4840851",
"0.48264033",
"0.48255634",
"0.48232734",
"0.48208258",
"0.48201266",
"0.48200166",
"0.48152223",
"0.48144323",
"0.48123872",
"0.48091236",
"0.48048526",
"0.48028818",
"0.4794245",
"0.4783673",
"0.47766668",
"0.47761762",
"0.47734144",
"0.4755896",
"0.474982",
"0.47452387",
"0.4732142",
"0.4730863",
"0.47296754",
"0.47256204"
] | 0.53596807 | 13 |
You can't proxy nil or false, so remove those possibilities if they're in the type. | def proxy_simplify
ts = @types.dup.delete_if do |t|
t.is_a? NominalType and
(t.klass == NilClass or t.klass == FalseClass)
end
if ts.length == @types.length
then self
else if ts.length == 1
then ts.to_a[0]
else UnionType.new(ts)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_types; end",
"def typecast_value_boolean(opts={});true;end",
"def skip_conversion?(obj, attr, value)\n value.nil? || !obj.class.attributes.key?(attr)\n end",
"def nonregular_type; end",
"def generic?; true; end",
"def object_type?\n !value_type?\n end",
"def proxy_type\n super\n end",
"def allowed?() raise NotImplementedError end",
"def proxy_as_optional(model, var)\n proxy_as(model, var, true)\n end",
"def unsafe_munge(value)\n # downcase strings\n if value.respond_to? :downcase\n value = value.downcase\n end\n\n case value\n when *BooleanProperty.values_for_true\n :true\n when *BooleanProperty.values_for_false\n :false\n else\n fail \"expected a boolean value, got #{value.inspect}\"\n end\n end",
"def proxy_exclusion\n super\n end",
"def strict_value_coercions; end",
"def polymorphic?\n false\n end",
"def polymorphic?\n false\n end",
"def boolify(val)\n\nend",
"def polymorphic(true_or_false = true)\n @expected_options[:polymorphic] = true_or_false\n self\n end",
"def custom?\n self.type.blank?\n end",
"def supports_is_true?\n false\n end",
"def attr_get_boolean(attr_type, strict = true)\n #This is a stub, used for indexing\n end",
"def non_polymorphic_collection?(param0 = T.unsafe(nil)); end",
"def set_proxy_type(opts)\n opts = check_params(opts,[:types])\n super(opts)\n end",
"def lenient_value_coercions; end",
"def test_NilClass_InstanceMethods_Or\n\t\tassert_equal(false, nil | false)\n\t\tassert_equal(true, nil | 99)\n\tend",
"def convert_nil_to_false\n self.is_admin = false unless self.is_admin == true\n return true\n end",
"def plain_old_ruby_object\n\t\treturn false\n\tend",
"def proxy(return_type); end",
"def dummy?\n @type.nil?\n end",
"def residential_proxy?; end",
"def residential_proxy?; end",
"def builtin_type?\n\t\tfalse\n\tend",
"def attr_bool_accessor *symbols\n attr_accessor *symbols\n symbols.each { |sym| alias_method \"#{sym}?\", sym }\n remove_method *symbols\n end",
"def unknown?; false; end",
"def unknown?; false; end",
"def nullify(bool)\n bool ? bool : nil\n end",
"def without_typecast\n dup.without_typecast!\n end",
"def revert_type_literal_internal( type, ruby_type )\n return :boolean, :default_size => 1 if ruby_type == :boolean\n\n method = \"revert_#{db.database_type}_type\"\n specific_type = send( method, type ) if respond_to?( method, true )\n\n specific_type || revert_generic_type( type ) || ruby_type\n end",
"def respond_to_missing?(*_args); super; end",
"def using_proxy?\n default_proxy.instance_variable_get(:@is_proxy_class) || false\n end",
"def undistinguish\n distinguish(:no)\n end",
"def proxy?\n false\n end",
"def inverse_type; end",
"def unmodify_nilclass; end",
"def primitive?\n false\n end",
"def primitive?\n false\n end",
"def option(criteria = T.unsafe(nil)); end",
"def nil?; false; end",
"def applicable?\n true\n end",
"def proxy_set?; end",
"def allowed?; true end",
"def person?\n !!self.person\n end",
"def person?\n !!self.person\n end",
"def explicit?; end",
"def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end",
"def to_bool() false end",
"def fix_boolean(node)\n node.children.map! do |child|\n if child.is_a?(AST::Node) &&\n child.type == :coerce_b\n child.children.first\n else\n child\n end\n end\n end",
"def valid?(type, value, type_name = nil)\n if value.is_a? type\n return true\n elsif !!value == value && type == TrueClass #check for boolean\n return true\n else\n raise \"Error: #{type_name || type.name} was excepted. #{value.class.name} was recieved\"\n end\n end",
"def mixed?\n return false\n end",
"def respond_to_missing?(*several_variants)\n super\n end",
"def no_proxy?\n !!@no_proxy\n end",
"def legitimate_proxy?; end",
"def patch_policy_booleans_if(hash)\n return hash unless @check_waterfall\n\n hash.transform_values! do |value|\n case value\n when true\n value.define_singleton_method(:dig) { |*_keys| true }\n when false\n value.define_singleton_method(:dig) { |*_keys| false }\n when 'maybe'\n value.define_singleton_method(:dig) { |*_keys| 'maybe' }\n else\n patch_policy_booleans_if(value)\n end\n\n value\n end\n end",
"def refute_respond_to(obj, meth, msg = T.unsafe(nil)); end",
"def default?; return !explicit?; end",
"def none?\n fail NotImplementedError\n end",
"def single_value?\n raise NotImplementedError\n end",
"def can_be_undone?\n true\n end",
"def can_have_value?\n return false\n end",
"def can_construct_from_id_alone?(properties)\n super && @restricted_to_types && @restricted_to_types.length == 1\n end",
"def cast_types; end",
"def optional; end",
"def attr_set_boolean(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def writable_real?() end",
"def method_missing(method, *args, &block)\n return super(method, *args, &block) unless method.to_s =~ /^is_.+\\?$/\n\n self.class.class_eval do\n define_method(method) do |*args, &block|\n false\n end\n end\n\n self.send(method, *args, &block)\n end",
"def null?; false end",
"def global_proxy_exclusion\n super\n end",
"def optional_type\n @only_power = false\n @only_light = false\n if params.has_key? 'power' and not params.has_key? 'light' then\n @only_power = true\n elsif params.has_key? 'light' and not params.has_key? 'power' then\n @only_light = true\n end\n end",
"def proxy(*value)\n @proxy = value if value && !value.empty?\n\n return @proxy if @proxy\n\n superclass.respond_to?(:proxy) ? superclass.proxy : nil\n end",
"def type; nil end",
"def type; nil end",
"def polymorphic_marker?\n @options[:polymorphic] || (target_class == Object)\n end",
"def sos_piedra?() raise NotImplementedError end",
"def dynamic?; end",
"def allow_nat\n super\n end",
"def should_skip_based_on?(old_type)\n if old_type != CURRENT_TYPE_TO_REPLACE\n return true\n end\n\n false\nend",
"def typed?\n type != :object\n end",
"def Bool(arg)\n !!arg\nend",
"def magical?\n fail NotImplementedError\n end",
"def special=(isSpecial)\n if isSpecial == true or isSpecial == \"true\" or isSpecial == 1\n self.override = true\n elsif isSpecial == false or isSpecial == \"false\" or isSpecial == 0\n self.override = false\n end\n end",
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end",
"def polymorphic?\n !!@options[:polymorphic]\n end",
"def __proxy_loaded__\n !!defined?(@proxy_result)\n end",
"def new_simplification_rules_for_conjunction\n end",
"def kind_of?(p0) end",
"def none?; end",
"def none?; end",
"def none?; end",
"def is_real?\n real?\n end",
"def builtin_type?\n\t\ttrue\n\tend",
"def boolean\n map ->(primitive) { primitive.to_bool }\n end",
"def respond_to_missing?(*)\n true\n end"
] | [
"0.60454077",
"0.60138047",
"0.586154",
"0.5804956",
"0.58021206",
"0.580121",
"0.57736146",
"0.57269555",
"0.5706746",
"0.5681425",
"0.5674773",
"0.56521684",
"0.56374043",
"0.56374043",
"0.5634711",
"0.56346625",
"0.56327087",
"0.5608932",
"0.5591604",
"0.55645496",
"0.5531238",
"0.5497784",
"0.54812276",
"0.5476787",
"0.5472826",
"0.5429675",
"0.5424075",
"0.5412618",
"0.5412618",
"0.5397988",
"0.53761905",
"0.5371198",
"0.5371198",
"0.53691024",
"0.53512776",
"0.5339238",
"0.53309506",
"0.53307456",
"0.53254735",
"0.53218156",
"0.53081375",
"0.5298961",
"0.5289226",
"0.527813",
"0.5276411",
"0.52681214",
"0.5255768",
"0.5246303",
"0.5243301",
"0.5240734",
"0.5240734",
"0.52283454",
"0.52240384",
"0.5220726",
"0.52179265",
"0.52110183",
"0.5206995",
"0.52068216",
"0.51937926",
"0.5186713",
"0.5184318",
"0.51734126",
"0.5172765",
"0.5171879",
"0.5168438",
"0.51590246",
"0.5156665",
"0.51486486",
"0.5145318",
"0.5144807",
"0.5143249",
"0.51420647",
"0.5138842",
"0.51332253",
"0.5116329",
"0.51111454",
"0.510481",
"0.5104677",
"0.5104677",
"0.5103173",
"0.50973994",
"0.5096432",
"0.5094456",
"0.5092399",
"0.5087608",
"0.50854284",
"0.5067485",
"0.50642705",
"0.50531626",
"0.5047805",
"0.5040505",
"0.50358975",
"0.50347614",
"0.5034045",
"0.5034045",
"0.5034045",
"0.5033852",
"0.5029133",
"0.5028631",
"0.50259274"
] | 0.6163261 | 0 |
Creates a new UnionType that is the union of all the types in +type+. The initializer is private since UnionTypes should be created via the UnionTypeof method. | def initialize(types)
@types = Set.new(types)
super()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_union_tc(id, name, discriminator_type, *members)\n return CORBA::TypeCode::Union.new(id.to_s.freeze, name.to_s, nil, discriminator_type, members)\n end",
"def union_memberships(type)\n rebuild_artifacts unless defined?(@union_memberships)\n @union_memberships.fetch(type.name, [])\n end",
"def union_memberships(type)\n rebuild_artifacts unless defined?(@union_memberships)\n @union_memberships.fetch(type.name, [])\n end",
"def expand_return_type(union_type)\n expand(union_type)\n return self\n end",
"def remove!(union_type)\n if union_type.is_singleton?\n raise AssertionError.new(\"Union type expected\")\n else\n @types.delete_if do |type|\n union_type.include?(type)\n end\n end\n end",
"def initialize(type)\n unless type.is_a?(GraphQL::EnumType)\n raise \"expected type to be a GraphQL::EnumType, but was #{type.class}\"\n end\n\n @type = type\n @values = {}\n\n all_values = type.values.keys\n\n all_values.each do |value|\n str = value.dup\n all_values.each do |v|\n str.define_singleton_method(\"#{v.downcase}?\") { false }\n end\n str.define_singleton_method(\"#{value.downcase}?\") { true }\n str.freeze\n const_set(value, str) if value =~ /^[A-Z]/\n @values[str] = str\n end\n\n @values.freeze\n end",
"def possible_types(type)\n if type.kind.interface?\n schema.possible_types(type)\n elsif type.kind.union?\n type.possible_types\n end\n end",
"def struct_union_construct(base_type, member_list)\n con_hash = {'.type' => base_type['.type'].clone} # struct or union \n con_hash['.members'] = []\n\n member_list.each do |member|\n member_name = member[0] # identifier\n member_type = member[1] # chained hash\n\n con_hash['.members'].push([member_name, member_type])\n end\n\n return con_hash\nend",
"def struct_union_construct(base_type, member_list)\n con_hash = {'.type' => base_type['.type'].clone} # struct or union \n con_hash['.members'] = []\n\n member_list.each do |member|\n member_name = member[0] # identifier\n member_type = member[1] # chained hash\n\n con_hash['.members'].push([member_name, member_type])\n end\n\n return con_hash\nend",
"def union(label, type)\n raise Syntax, \"Invalid union argument.\" unless label.respond_to?(:to_label) and !label.dummy?\n Label.new label.to_i, type, label.immediate? ? nil : :code\n end",
"def expand(union_type)\n if not union_type.is_union_type?\n raise AssertionError.new(\n \"Cannot expand with non-union type: #{union_type}\")\n end\n\n is_expanded = false\n\n for type in union_type\n is_expanded = is_expanded | add(type)\n end\n\n return is_expanded\n end",
"def singleton_type\n if !is_singleton?\n raise AssertionError.new(\n \"Union type is not singleton (found #{@types.size} types)\")\n end\n\n return @types.first\n end",
"def get_types(type)\n result = []\n types = TYPE_CONVERSION_TREE[type]\n if types\n result += types\n types.each do |t|\n result |= get_types(t)\n end\n end\n result\n end",
"def init_type(type = nil)\n return @init_type ||= _super_init_type unless type\n raise ArgumentError, \"Unknown init type '#{type}'. Must be #{INIT_TYPES.join_terms('or', encapsulate: \"'\")}.\" unless INIT_TYPES.include?(type)\n @init_type = type\n end",
"def initialize(type = TYPES[:empty])\n @type = type\n end",
"def union(query)\n union_context = QL::QueryContext.new(self)\n union_context.register_query(query)\n union_context = QL.to_query(query, union_context)\n\n @last_query_context.union(union_context)\n self\n end",
"def revert_type_literal( type, ruby_type )\n\n case type\n when /\\(\\s*(\\d+)\\s*\\)/\n size = $1.to_i\n when /\\(([\\s\\d,]+)\\)/\n size = $1.split( ',' ).map{ |x| x.to_i }\n end\n\n type, opts = revert_type_literal_internal( type, ruby_type )\n\n opts ||= {}\n\n default_size = opts.delete( :default_size )\n\n if size and size != default_size\n opts[ :size ] = size\n end\n\n [ type, opts ]\n end",
"def struct_union_declare(base_type, declarator_list)\n basetype = base_type.clone\n declare_array = []\n\n declarator_list.each do |elem| \n current = elem[1]\n\n if !current.nil?\n while current.has_key?('.subtype') \n current = current['.subtype']\n end\n current['.subtype'] = basetype\n data = elem[1].clone\n else\n data = basetype\n end\n identifier = elem[0].clone\n declare_array.push([identifier, data])\n end\n\n return declare_array\nend",
"def of_type(type)\n options[:type] = type\n self\n end",
"def proxy_simplify\n ts = @types.dup.delete_if do |t|\n t.is_a? NominalType and\n (t.klass == NilClass or t.klass == FalseClass)\n end\n if ts.length == @types.length\n then self\n else if ts.length == 1\n then ts.to_a[0]\n else UnionType.new(ts)\n end\n end\n end",
"def add(type)\n merge(type.registry.minimal(type.name))\n nil\n end",
"def struct_union_declare(base_type, declarator_list)\n basetype = base_type.clone\n declare_array = []\n \n declarator_list.each do |elem| \n current = elem[1]\n\n if !current.nil?\n while current.has_key?('.subtype') \n current = current['.subtype']\n end\n current['.subtype'] = basetype\n data = elem[1].clone\n else\n data = basetype\n end\n identifier = elem[0].clone\n declare_array.push([identifier, data])\n end\n\n return declare_array\nend",
"def k_union!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 57 )\n\n\n\n type = K_UNION\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 481:3: 'union'\n match( \"union\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 57 )\n\n\n end",
"def add_tlv(type, value = nil, replace = false, compress=false)\n\n\t\t# If we should replace any TLVs with the same type...remove them first\n\t\tif (replace)\n\t\t\teach(type) { |tlv|\n\t\t\t\tif (tlv.type == type)\n\t\t\t\t\tself.tlvs.delete(tlv)\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\n\t\tif (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GROUP)\n\t\t\ttlv = GroupTlv.new(type)\n\t\telse\n\t\t\ttlv = Tlv.new(type, value, compress)\n\t\tend\n\n\t\tself.tlvs << tlv\n\n\t\treturn tlv\n\tend",
"def add(type)\n if !type.registry.equal?(self)\n merge(type.registry.minimal(type.name))\n end\n nil\n end",
"def |(type)\n if type.is_a?(Class) && type <= Struct || type.is_a?(Sum)\n Sum.new(self, type)\n else\n super\n end\n end",
"def array_of(type)\n new_class = Class.new(TypedArray)\n new_class.set_element_type(type)\n new_class\n end",
"def cast_type_literal(type)\n type_literal(:type=>type)\n end",
"def add(type)\n @value << type\n @value = @value.uniq\n end",
"def type2type(type)\n case type\n when :char, :int8\n Fiddle::TYPE_CHAR\n when :uchar, :uint8\n -Fiddle::TYPE_CHAR\n when :short, :int16\n Fiddle::TYPE_SHORT\n when :ushort, :uint16\n -Fiddle::TYPE_SHORT\n when :int, :int32\n Fiddle::TYPE_INT\n when :uint, :uint32\n -Fiddle::TYPE_INT\n when :bool\n Fiddle::TYPE_INT\n when :long\n Fiddle::TYPE_LONG\n when :ulong\n -Fiddle::TYPE_LONG\n when :long_long, :int64\n Fiddle::TYPE_LONG_LONG\n when :ulong_long, :uint64\n -Fiddle::TYPE_LONG_LONG\n when :float\n Fiddle::TYPE_FLOAT\n when :double\n Fiddle::TYPE_DOUBLE\n when :size_t\n Fiddle::TYPE_SIZE_T\n when :string, :pointer\n Fiddle::TYPE_VOIDP\n when :void\n Fiddle::TYPE_VOID\n else\n raise \"unknown type #{type}\"\n end\n end",
"def type=(new_type)\n self[:type_flags] = (flags | TYPES[new_type])\n end",
"def minimal(type, with_aliases: true)\n type = validate_type_argument(type)\n\n result = Registry.new\n type.copy_to(result)\n if with_aliases\n new_type = result.get(type.name)\n aliases_of(type).each do |name|\n result.create_alias(name, new_type)\n end\n end\n result\n end",
"def initialize(type)\n @type = type\n end",
"def initialize(type)\n @type = type\n end",
"def add_type(type)\n\n # does nothing, types are differentiated by the 'typ' column\n end",
"def resolve(type)\n types[type] || build_type(type)\n end",
"def type(type)\n select { |node| node.type.equal?(type) }\n end",
"def type=(type)\n allowed_values = [\"STRING\", \"BOOLEAN\", \"DECIMAL\", \"INTEGER\", \"DATE_TIME\", \"REFERENCE\", \"COMPLEX\"]\n if type && !allowed_values.include?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{allowed_values}.\"\n end\n @type = type\n end",
"def type=(type)\n raise ArgumentError, \"Invalid Type (#{type}), use: #{VALID_TYPES*' '}\" if type && !VALID_TYPES.include?(type.to_sym)\n super\n end",
"def type=(type)\n raise ArgumentError, \"Invalid Type (#{type}), use: #{VALID_TYPES*' '}\" if type && !VALID_TYPES.include?(type.to_sym)\n super\n end",
"def add_tlv(type, value = nil, replace = false)\n\t\ttlv = nil\n\n\t\t# If we should replace any TLVs with the same type...remove them first\n\t\tif (replace)\n\t\t\teach(type) { |tlv|\n\t\t\t\tif (tlv.type == type)\n\t\t\t\t\tself.tlvs.delete(tlv)\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\n\t\tif (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GROUP)\n\t\t\ttlv = GroupTlv.new(type)\n\t\telse\n\t\t\ttlv = Tlv.new(type, value)\n\t\tend\n\n\t\tself.tlvs << tlv\n\n\t\treturn tlv\n\tend",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def type(type)\n select { |node| node.type == type }\n end",
"def patterns_for_type(type_)\n @mutex.synchronize do\n typedata_ = @types[type_]\n typedata_ ? typedata_.dup : []\n end\n end",
"def add(type)\n @list << type\n self\n end",
"def build_parse ctxt, parent, opts={}, &block\n nonterminal_common_build_parse(UnionParse, ctxt, parent, opts, &block)\n end",
"def add_type( type )\n hash = type.hash\n raise \"upps #{hash} #{hash.class}\" unless hash.is_a?(::Integer)\n was = types[hash]\n return was if was\n types[hash] = type\n end",
"def unary_union\n raise Error::UnsupportedOperation, \"Method Geometry#unary_union not defined.\"\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"random\", \"hash\", \"client\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def typecaster_for(type)\n typecaster = TYPECASTER_MAP[type]\n typecaster.new if typecaster\n end",
"def initialize(type=nil)\n @type = type\n end",
"def dup_type_class(type_class)\n type_name = type_class.graphql_name\n Class.new(type_class) do\n # This won't be inherited like other things will\n graphql_name(type_name)\n\n if type_class.kind.fields?\n type_class.fields.each do |_name, field_defn|\n dup_field = field_defn.dup\n dup_field.owner = self\n add_field(dup_field)\n end\n end\n end\n end",
"def build_types\n proper_type_names.each do |type|\n klass = type.to_s.camelize\n struct_attrs = struct_attributes_for(:type, type)\n attributes = attributes_for(:type, type)\n defaults = defaults_for(:type, type)\n types = types_for(:type, type)\n\n self.module_eval <<-EOS, __FILE__, __LINE__ + 1\n class #{klass} < Struct.new('#{klass}'#{struct_attrs})\n def attributes() @@attributes = #{attributes.inspect} end\n def defaults() @@defaults = #{defaults.inspect} end\n\n def initialize\n super\n attributes.each do |attribute|\n send(\\\"\\#{attribute}=\", Bitcoin::Protocol.lookup(defaults[attribute]))\n end\n instance_eval(&block) if block_given?\n end\n\n # evaluated after initialization so it can reflect upon its own values\n def types() @@types = #{types.inspect} end\n\n def bytesize\n @bytesize ||= attributes.each.inject(0) do |acc, attr|\n acc += BtcProto::Binary.size_of(types[attr], self)\n end\n end\n\n def load(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names & [types[a]]\n send(\"\\#{types[a]}=\", BtcProto.class_for(:type, types[a]).load(buf))\n else\n send(\"\\#{types[a]}=\", buf.send(\"read_\\#{types[a]}\"))\n end\n end\n end\n\n def dump(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names.include?(types[a])\n send(a).dump(buf)\n else\n buf.send(\"write_\\#{types[a]}\", send(a))\n end\n end\n end\n\n def self.load() new.load end\n def self.dump(buf) new.dump end\n end\n EOS\n\n type_classes.merge!(type => Bitcoin::Protocol.const_get(klass))\n end\n\n Types.mappings = type_classes\n end",
"def type(type)\n types.each { |t| return t if t.id =~ /^#{Regexp.escape(type)}$/}\n nil\n end",
"def set_type(v)\n self.type = v\n self\n end",
"def initialize(*params)\n raise RuntimeError, \"Attempt to create tuple type with non-type param\" unless params.all? { |p| p.is_a? Type }\n @params = params\n @array = nil # emphasize initially this is a tuple, not an array\n @cant_promote = false\n @ubounds = []\n @lbounds = []\n super()\n end",
"def add_type(type)\n\n # nothing to be done\n end",
"def add_type(type)\n\n # nothing to be done\n end",
"def add_type(type)\n\n # does nothing, types are differentiated by the 'typ' column\n end",
"def register( type )\n @types ||= Array.new\n @types << type\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def extract_base_type(type)\n if type.base_type\n extract_base_type(type.base_type)\n else\n type\n end\n end",
"def type=(type)\n if type && !VALID_TYPES.include?(type.to_sym)\n raise ArgumentError, \"Invalid Type (#{type}), use: #{VALID_TYPES*' '}\"\n end\n write_attr :type, type\n end",
"def each_type(&block)\n if block_given?\n @types.each_value(&block)\n self\n else\n @types.values\n end\n end",
"def bitcast_to(type)\n ConstantExpr.from_ptr(C.LLVMConstBitCast(self, type))\n end",
"def include?(singleton_type)\n if singleton_type.is_union_type?\n raise AssertionError.new(\"Union type can never be included in union type\")\n end\n\n @types.include?(singleton_type)\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Paragraph\", \"Character\", \"Table\", \"List\"])\n if type.to_i == 0\n unless validator.valid?(type)\n raise ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n else\n @type = validator.allowable_values[type.to_i]\n end\n end",
"def add_type(mod) #:nodoc:\n @t[mod] ||= Type.new(mod)\n end",
"def type=(type)\n if type && !VALID_TYPES.include?(type.to_sym)\n raise ArgumentError, \"Invalid Type (#{type}), use: #{VALID_TYPES*' '}\"\n end\n write_attr :type, type\n end",
"def type=(type)\n Munson.register_type(type, self)\n munson.type = type\n end",
"def type=(type)\n if type && !VALID_TYPES.include?(type.to_sym)\n raise ArgumentError, \"Invalid Type (#{type}), use: #{VALID_TYPES*' '}\"\n end\n super\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n unless validator.valid?(type) || type.empty?\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def zunion(*args, **_arg1); end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['string', 'number', 'boolean', 'date', 'address', 'country', 'email', 'url', 'image', 'signature', 'barcode', 'combined'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n unless validator.valid?(type)\n fail ArgumentError, %Q'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def register_type(type, &block)\n register CastWhenType.new(type, &block)\n end",
"def add_types(type, arr)\n lst = @shared[type]\n arr.each{ |t| lst.push(t) if !lst.include?(t) }\n end",
"def union_all!\n @union_all = true if recursive?\n end",
"def build_singleton0(type_name); end",
"def type_class(type)\n TYPES[type]\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['String', 'Number', 'Date'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def type=(type)\n @type = type\n\n setOption('type', @type)\n end",
"def initialize(type, &block)\n @state = OpenStruct.new(type: type)\n\n self.instance_eval(&block) if block_given?\n end",
"def union! newFA\n end",
"def type( type, *allowed_defaults )\n @@types ||= Hash.new\n @@types[type] = self\n Caty::OptionConstructor.register(type)\n @allowed_defaults = allowed_defaults\n end",
"def mutate!(type)\n set_type(type)\n end",
"def build_user_type(user_type)\n #\n # instantiate the user type if not already exists\n self.send(\"#{user_type}\")\n # \n # #\n # # roles_users_options for caregivers\n # # checkboxes for existence of caregivers\n # if user_type =~ /^senior$/\n # self.subscriber_is_user = subscribed_for_self? # (subscriber_is_user.nil? || [\"1\", true].include?(subscriber_is_user))\n # \n # elsif user_type =~ /^subscriber$/\n # self.subscriber_is_caregiver = caregiving_subscriber? # (!subscriber_is_caregiver.nil? && [\"1\", true].include?( subscriber_is_caregiver))\n # \n # elsif user_type =~ /^caregiver/\n # _index = user_type[-1..-1].to_i\n # _existing = self.send(\"no_caregiver_#{_index}\") # check existing value\n # self.send(\"no_caregiver_#{_index}=\", ( _user.blank? || [\"1\", nil, true].include?(_existing) || _user.nothing_assigned? ))\n # #\n # # role options will be instantiated when called\n # end\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def type\n compile! unless @compiled\n [@type].flatten\n end",
"def unregister_type\n types_list.delete self\n end",
"def compile_type_list(types)\n if Hash === types.last\n @types = types.pop\n end\n\n transform_simple_types(types)\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Agreement\", \"CreditMemo\", \"DownPayment\", \"Miscellaneous\", \"Progress\", \"Standard\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def initialize(type, clean = true)\n @type = type\n @clean = clean\n end",
"def resolve_type(type)\n (@udts ||= {})[type] ||= begin\n sql = <<-sql\n SELECT st.name AS storage_type\n FROM systypes s, systypes st\n WHERE s.type = st.type\n AND st.name NOT IN ('longsysname', 'nchar', 'nvarchar', 'sysname', 'timestamp')\n AND s.name = '#{type}'\n sql\n\n select_one(sql, \"Field type for #{type}\")['storage_type'].strip\n end\n end",
"def new\n # Create a new member_type instance that will be used in the form:\n @member_type = MemberType.new;\n end",
"def type=(type)\n validate_type_values(type)\n @type = type\n end",
"def union (*data) \n\tunion_ = [] \n\tdata.each{\n\t\t|elm| \n\t\telm.each{\n\t\t\t|elme| \n\t\t\tunion_.push(elme)\n\t\t}\n\t} \n\treturn union_\nend",
"def resolve(type)\n resolve_hash(@typedefs, type)\n end",
"def union\n @grpc.union\n end",
"def initialize(type)\n @type = type\n @word_array = []\n end"
] | [
"0.537518",
"0.52013594",
"0.52013594",
"0.50309217",
"0.49575335",
"0.48586595",
"0.4812013",
"0.48092037",
"0.48092037",
"0.4775044",
"0.46384695",
"0.46366718",
"0.4561177",
"0.4559883",
"0.45568106",
"0.45401376",
"0.4507513",
"0.4429114",
"0.44120076",
"0.4387188",
"0.43658662",
"0.43363822",
"0.43311766",
"0.42806804",
"0.42755085",
"0.42702445",
"0.42357743",
"0.4200982",
"0.41948965",
"0.41747662",
"0.41517365",
"0.41439414",
"0.41405877",
"0.41405877",
"0.4135256",
"0.4106513",
"0.40988314",
"0.4086182",
"0.40761426",
"0.40761426",
"0.4053886",
"0.40438765",
"0.4027637",
"0.4021726",
"0.4015412",
"0.40087935",
"0.4006702",
"0.40037397",
"0.4003728",
"0.39876053",
"0.39719105",
"0.39700702",
"0.39694014",
"0.39653775",
"0.39628002",
"0.39530683",
"0.3946409",
"0.3946409",
"0.39322007",
"0.39295542",
"0.3928573",
"0.3924879",
"0.39054528",
"0.39041147",
"0.3903826",
"0.3884917",
"0.38833192",
"0.38826415",
"0.38697496",
"0.38681042",
"0.38601276",
"0.3855465",
"0.3853344",
"0.38469845",
"0.38348633",
"0.38333136",
"0.38245595",
"0.3818243",
"0.3813035",
"0.38084638",
"0.38033146",
"0.3801226",
"0.3797234",
"0.37915736",
"0.3790995",
"0.37896755",
"0.37856647",
"0.37822828",
"0.37822828",
"0.3781333",
"0.37768817",
"0.37713808",
"0.37712836",
"0.3770429",
"0.3767907",
"0.37578365",
"0.37477797",
"0.3741586",
"0.373965",
"0.3728064",
"0.37260786"
] | 0.0 | -1 |
DELETE /hookups/1 DELETE /hookups/1.xml | def destroy
@hookup = Hookup.find(params[:id])
@hookup.destroy
respond_to do |format|
format.html { redirect_to(hookups_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_hook(id)\n delete(\"/hooks/#{id}\")\n end",
"def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete_webhook(id)\n make_json_api_request :delete, \"v2/#{account_id}/webhooks/#{id}\"\n end",
"def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @trigger = Trigger.find(params[:id])\n @trigger.destroy\n\n respond_to do |format|\n format.html { redirect_to(triggers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trigger = Trigger.find(params[:id])\n @trigger.destroy\n\n respond_to do |format|\n format.html { redirect_to(triggers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hook = Hook.find(params[:id])\n @hook.destroy\n respond_with(@hook)\n end",
"def delete_webhook(target_url)\n Uploadcare::Webhook.delete(target_url)\n end",
"def delete_webhooks_by_name room_name, hook_name\n # We can't delete webhooks by name; we have to use IDs. First we look up\n # the IDs, then we use them to delete the hooks.\n webhooks_response = self.get_webhooks room_name\n webhooks = webhooks_response.parsed_response['items']\n webhooks_to_delete = webhooks.find_all { |wh| wh['name'] == hook_name }\n webhooks_to_delete.each do |webhook|\n self.delete_webhook_by_id room_name, webhook['id']\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete_webhook_config(id, name=nil)\n\t\tputs \"Attempting to delete configuration for webhook id: #{id}.\"\n\n\t\tif @api_tier == 'premium'\n\t\t\t@uri_path = \"#{@uri_path}/all/#{name}/webhooks/#{id}.json\"\n\t\telse\n\t\t\t@uri_path = \"#{@uri_path}/webhooks/#{id}.json\"\n\t\tend\n\n\t\tresponse = @twitter_api.make_delete_request(@uri_path)\n\n\t\tif response == '204'\n\t\t\tputs \"Webhook configuration for #{id} was successfully deleted.\"\n\t\telse\n\t\t\tputs response\n\t\tend\n\n\t\tresponse\n\tend",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete_webhook\n # find the next sprint using that webhook, and recreate webhook in that sprint.user's name\n # delete webhook if no other sprint is using that webhook\n if webhook\n webhook.sprints.count > 1 ? webhook.sprints.where.not(user: user)[0].post_webhook : webhook.destroy\n end\n user.delete_wh_by_sprint(self)\n end",
"def destroy\n @listener = Listener.find(params[:id])\n @listener.destroy\n\n respond_to do |format|\n format.html { redirect_to(listeners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @click_to_talk = ClickToTalk.find(params[:id])\n @click_to_talk.destroy\n\n respond_to do |format|\n format.html { redirect_to(click_to_talks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @add_on = AddOn.find(params[:id])\n @add_on.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_ons_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n @alert_trigger_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_alert_trigger_types_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end",
"def delete(params = {})\n http_helper.send_delete_request(\"#{@url_prefix}/#{get_webhook_id!(params)}\", params)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @alphasignup = Alphasignup.find(params[:id])\n @alphasignup.destroy\n\n respond_to do |format|\n format.html { redirect_to(alphasignups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @update = Update.find_by_permalink(params[:id])\n @update.destroy\n\n respond_to do |format|\n format.html { redirect_to(updates_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end",
"def destroy\n @bottle = Bottle.find(params[:id])\n @bottle.destroy\n\n respond_to do |format|\n format.html { redirect_to(bottles_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end",
"def destroy\n @upgrade = Upgrade.find(params[:id])\n @upgrade.destroy\n\n respond_to do |format|\n format.html { redirect_to(upgrades_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notifier.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifiers_url, :notice => 'Kennisgever is succesvol ontkoppeld.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inbound_email_log = InboundEmailLog.find(params[:id])\n @inbound_email_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(inbound_email_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to(admin_badges_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted badge: #{@badge.name}\")\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy\n @users_hacktag = UsersHacktag.find(params[:id])\n @users_hacktag.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_hacktags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @installation = Installation.find(params[:installation_id]) \n @onpost = Onpost.find(params[:id])\n @onpost.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @conversation = Conversation.find(params[:id])\n\n desc = @conversation.topic\n add_event( EVENT_DELETE_CONVERSATION, desc[0,150], EVENTSOURCE_USER, session[:user_id], session[:user_name], nil)\n\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_conversations_path(@pad)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy\n @probe = Probe.find(params[:id])\n @probe.destroy\n\n respond_to do |format|\n format.html { redirect_to(probes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_webhook(repo, hook_id, options = {})\n boolean_from_response :delete, \"#{Repository.path repo}/hooks/#{hook_id}\", options\n end",
"def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def remove(domain, action)\n fail Mailgun::ParameterError('Domain not provided to remove webhook from') unless domain\n fail Mailgun::ParameterError('Action not provided to identify webhook to remove') unless action\n @client.delete(\"domains/#{domain}/webhooks/#{action}\").to_h['message'] == 'Webhook has been deleted'\n rescue Mailgun::CommunicationError\n false\n end",
"def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @echo = Echo.find(params[:id])\n @echo.destroy\n\n respond_to do |format|\n format.html { redirect_to(echoes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blogger = Blogger.find(params[:id])\n @blogger.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bloggers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(alerts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subscription_fu_log = SubscriptionFuLog.find(params[:id])\n @subscription_fu_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_fu_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @update_log = UpdateLog.find(params[:id])\n @update_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(update_logs_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @hops_addition = HopsAddition.find(params[:id])\n @hops_addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(hops_additions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @groups_happening = GroupsHappening.find(params[:id])\n @groups_happening.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_happenings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_referrals_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @email_tracker = EmailTracker.find(params[:id])\n @email_tracker.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_trackers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vip_email.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_emails_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip email: #{@vip_email.email}\")\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 @hack_tag_follow = HackTagFollow.find(params[:id])\n @hack_tag_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(hack_tag_follows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vip_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_services_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip service: #{@vip_service.name}\")\n end",
"def destroy\n @lift = Lift.find(params[:id])\n @lift.destroy\n\n respond_to do |format|\n format.html { redirect_to(lifts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offpost = Offpost.find(params[:id])\n @offpost.destroy\n\n respond_to do |format|\n format.html { redirect_to(offposts_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @check = Check.find(params[:id])\n @check.destroy\n\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @backup = Backup.find(params[:id])\n @backup.destroy\n\n respond_to do |format|\n format.html { redirect_to(backups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_gamecall\n update_gamecall = Gamecall.find_by(id: self.gamecall_tag)\n update_gamecall.destroy if update_gamecall\n end",
"def destroy\n @flat_happening = FlatHappening.find(params[:id])\n @flat_happening.destroy\n\n head :no_content\n end",
"def destroy\n @installation = Installation.find(params[:installation_id]) \n @eat = Eat.find(params[:id])\n @eat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @check = Check.find(params[:id])\n @check.destroy\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @post328 = Post328.find(params[:id])\n @post328.destroy\n\n respond_to do |format|\n format.html { redirect_to(post328s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @poll = Poll.find_by_admin_key(params[:key])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(polls_url) }\n format.xml { head :ok }\n end\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend",
"def destroy\n @bitpay_webhook.destroy\n respond_to do |format|\n format.html { redirect_to bitpay_webhooks_url, notice: 'Bitpay webhook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pbx = Pbx.find(params[:id])\n @pbx.destroy\n\n respond_to do |format|\n format.html { redirect_to(pbxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(referrals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(referrals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end",
"def destroy\n @alert_email = AlertEmail.find(params[:id])\n @alert_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(alert_emails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @administration_email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_email_templates_url) }\n format.xml { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(action, **args); end",
"def unregister_webhook\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\treturn if self.add_on.nil? # Can't do it without a token!\n\t\t\t\t\treturn if self.oauth_token.nil? # Can't do it without a token!\n\n\t\t\t\t\turi = URI.parse(\"#{self.add_on.jive_url}/api/core/v3/webhooks/#{self.webhook_id}\")\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\n\t\t\t\t\trequest = Net::HTTP::Delete.new(uri.request_uri)\n\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest[\"Authorization\"] = \"Bearer #{self.oauth_token.access_token}\"\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Need 2XX status code\n\t\t\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\t\t\terrors[:base] << \"#{request.inspect} => #{response.body}\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\ttrue\n\t\t\t\tend",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def destroy\n @user_addon = UserAddon.find(params[:id])\n @user_addon.destroy\n\n respond_to do |format|\n format.html { redirect_to([:scaffold, user_addons_url]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @action_log = ActionLog.find(params[:id])\n @action_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end"
] | [
"0.66563874",
"0.6259569",
"0.6164094",
"0.6144415",
"0.6017475",
"0.60122293",
"0.59824574",
"0.59824574",
"0.5970387",
"0.5937535",
"0.58757156",
"0.5859602",
"0.5791331",
"0.5747852",
"0.5727907",
"0.57187104",
"0.5715497",
"0.5710771",
"0.56989694",
"0.5691974",
"0.5685529",
"0.56846976",
"0.56839395",
"0.5677731",
"0.5674513",
"0.56732595",
"0.5666055",
"0.5660998",
"0.56573695",
"0.5648167",
"0.56345975",
"0.56312394",
"0.56284016",
"0.5620832",
"0.56207466",
"0.56151724",
"0.55911565",
"0.55749863",
"0.557174",
"0.55675423",
"0.5563205",
"0.5561091",
"0.5561091",
"0.55595",
"0.5557333",
"0.55465645",
"0.5543736",
"0.55371076",
"0.5527248",
"0.5522916",
"0.5522238",
"0.55207473",
"0.5512305",
"0.5507488",
"0.5507357",
"0.550181",
"0.54926527",
"0.54902065",
"0.5483864",
"0.54826504",
"0.548117",
"0.5478852",
"0.54765326",
"0.5472351",
"0.54717475",
"0.54703075",
"0.54570234",
"0.5454236",
"0.5452227",
"0.5451874",
"0.54460156",
"0.54438525",
"0.5441826",
"0.5439963",
"0.54393876",
"0.54322135",
"0.5431216",
"0.5427937",
"0.5426515",
"0.5425212",
"0.5425212",
"0.5425212",
"0.5425212",
"0.5424602",
"0.54239315",
"0.5422213",
"0.54199064",
"0.54197663",
"0.54125446",
"0.54125446",
"0.5412042",
"0.5411565",
"0.54114217",
"0.54073197",
"0.54056686",
"0.5400896",
"0.5397785",
"0.53973174",
"0.5395681",
"0.5394129"
] | 0.7322159 | 0 |
method put def update unless user_signed_in? flash[:notice] = "You have to sign in first!" redirect_to new_user_registration_path else end end | def comment
Hookup.where(:user_id => params[:user_id], :challenge_id => params[:challenge_id]).update_attribute(:u,:c)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profil mis à jour\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n @user=User.find(params[:id])\n if @user.update_attributes(params[:user])\n sign_in @user\n redirect_to @user , :notice => \"Profile Updated\" #, notice: \"User was successfully updated\" }\n else render 'edit'\n\n end\n end",
"def update\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile Updated!\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n sign_in @user\n flash[:success]= \"Profile Updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n @user = User.find(params[:id])\n\n unless current_user_or_admin\n flash[:warning] = 'Not signed in correctly'\n redirect_to root_url\n else\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n # byebug\n current_user.update(registration_params)\n redirect_to root_path\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n authorize! :update, @user\n respond_to do |format|\n if @user.update(user_params)\n sign_in(@user == current_user ? @user : current_user, :bypass => true)\n format.html { redirect_to @user, notice: 'Your profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n@user = User.find(params[:id])\n respond_to do |format|\n if @user.update(user_params)\n sign_in @user\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # required for settings form to submit when password is left blank\n if params[:user][:password].blank?\n params[:user].delete(\"password\")\n params[:user].delete(\"password_confirmation\")\n end\n\n @user_id = current_user.id\n @user = User.find(@user_id)\n if @user.is_new_user == true\n if @user.update_attributes(user_params)\n @user.not_new_user\n flash[:success] = '謝謝您,資料已經更新'\n\n old_user = User.find(@user_id)\n sign_in(old_user, :bypass => true)\n\n redirect_to user_path(@user)\n else\n render :edit\n end\n else\n @user.update_with_password(user_params)\n sign_in(@user, :bypass => true)\n end\n\n # email_changed = @user.email != params[:user][:email]\n # first_time = @user.sign_in_count == 1\n\n # successfully_updated = if !first_time\n # @user.update_with_password(user_params)\n # else\n # @user.update_attributes(user_params)\n # end\n\n # if successfully_updated\n # # Sign in the user bypassing validation in case his password changed\n # # sign_in @user, :bypass => true\n # # redirect_to root_path\n # else\n # # render \"edit\"\n # end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n sign_in @user\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # no need to assign @user because that is done with :correct_user in the before_filter\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:success] = 'User was successfully updated.'\n # flash is a hash- the expression below sets key ':success' to value 'Welcome...'\n # in layouts/application.html.erb flash.each do |key,value| uses this key,value pair as arguements\n sign_in @user\n format.html { redirect_to @user }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n # Handle a successful update.\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n # Si no se pudo actualizar el usuario\n render 'edit'\n end\n end",
"def update\n if not check_logged_in then\n return\n end\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile updated\"\n sign_in @user\n else\n flash[:alert] = \"Unsuccessful, maybe you did not fill up password and password_confirmation correctly.\"\n end\n redirect_back_or root_path\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { sign_in_and_redirect @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n \n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_in_user\n unless signed_in?\n flash.now[:danger] = \"Please sign in first.\"\n # store the edit location for redirect back\n store_location\n redirect_to signin_url\n end\n end",
"def update\n respond_to do |format|\n if @user.password_changed?\n sign_in(@user, :bypass => true)\n else\n if @user.update(user_params)\n format.html { redirect_to \"/\", notice: t('success_update') }\n format.json { render :show, status: :ok, location: \"/\" }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\nend",
"def update\n if @current_user && @current_user.update(user_params)\n flash[:success] = \"Saved\"\n redirect_to edit_user_path(@current_user.id)\n else\n flash.now[:warning] = 'Please fill in all fields.'\n render :edit, status: :bad_request\n end\n end",
"def update\n return redirect_to :h_1 unless params[:user]\n\n if params[:user][:username]\n allow = User.username_allowed(params[:user][:username], :current_user => current_user)\n params[:user][:username] = allow[:allowed] ? allow[:regular] : \"\"\n end\n \n condition = params[:user][:username] || params[:user][:email] || params[:user][:password]\n \n updated = current_user.update_attributes params[:user] if !condition\n updated = current_user.update_with_password params[:user] if condition\n \n unless updated\n @errors = current_user.errors\n #cookies[:flavour] = current_user.flavour#why?\n end\n if updated\n set_current_locale current_user.locale\n set_current_time_zone current_user.time_zone\n end\n redirect_to request.referrer\n end",
"def update\n # Override Devise to use update_attributes instead of update_with_password.\n # This is the only change we make.\n if resource.update_attributes(params[resource_name])\n set_flash_message :notice, :updated\n # Line below required if using Devise >= 1.2.0\n sign_in resource_name, resource, :bypass => true\n redirect_to after_update_path_for(resource)\n else\n clean_up_passwords(resource)\n render_with_scope :edit\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = t(:updatedprofile, :default => \"Profile updated!\")\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n if session[:user_id] == @user.id or session[:uname] == \"admin@admin.com\"\n \n respond_to do |format|\n if @user.update(user_params)\n \n format.html { redirect_to dashboard_login_path, notice: \"El usuario #{@user.username} fue actualizado exitosamente.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n \n format.html { redirect_to dashboard_login_path, notice: \"El usuario #{@user.username} no pudo ser actualizado.\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path , notice: \" no esta autorizado para hacer esa accion\"\n end \n end",
"def update\n if current_user\n @user = User.find(params[:id])\n if (current_user.username == 'Administrator')||(current_user.username == @user.username)\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\telse\n \tredirect_to root_url, :notice => 'Uwaga! Nie masz uprawnień!'\n \tend\n else\n redirect_to :login, :notice => 'Informacja! Zaloguj się aby obejrzeć!'\n end\n end",
"def update\n @user = current_user \n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to root_url\n else\n render :action => \"edit\"\n end\n end",
"def update\n # Assume user is not trying to update password if the password is blank.\n if params[:user][:password].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n\n # Append an error for the admin field if you are trying to make yourself\n # not an admin.\n if params[:user][:admin] == '0' &&\n current_user.admin? &&\n current_user == @user\n @user.errors.add(:admin?, \"can't be disabled by the same user\")\n render :edit\n return\n end\n\n # Don't make an Upload unless we are given a file.\n unless params[:user][:avatar_attributes][:file]\n params[:user][:avatar_attributes] = nil\n end\n\n if @user.update_attributes(user_params)\n sign_in @user, bypass: true if @user == current_user\n redirect_to @user\n else\n render :edit\n end\n end",
"def update\n\n if (session[:user_id] != @user.id.to_i)\n respond_to do |format|\n format.html { redirect_to users_path ,notice:\"You can't edit other user's user\" }\n format.json { head :no_content }\n end\n\n return\n\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = current_user\n @user.update_attributes(params[:user])\n respond_with(@user)\n end",
"def update\n # prevent spoofs\n #TODO this is bullshit code; add filters, :before_update\n if !(request.post? || request.put?) || !user_signed_in? ||\n !(self.current_user.user_id == params[:id].to_i || self.current_user.admin_flag == 1)\n flash[:notice] = 'EPIC FAIL. You\\'re not logged in or you\\'re trying to update someone else\\'s account.'\n redirect_to(:controller => '/members', :action => 'index', :id=>params[:id])\n return\n end\n\n serviceable = MemberServiceable.new(params, session)\n @user = serviceable.update\n\n flash[:message]='Account Updated.'\n redirect_to(:controller => '/members', :action => 'profile', :id=>params[:id])\n\n end",
"def update\n if @user.update_attributes params[:user]\n if @user.id == current_user.id\n flash[:notice] = \"Your account was successfully updated.\"\n else\n flash[:notice] = \"#{@user.full_name} account was successfully updated.\"\n end\n if current_user.administrator?\n redirect_to users_path\n else\n redirect_to dashboard_path\n end\n else\n render :action => :edit\n end\n end",
"def update(id)\n @user = User.get(id)\n if not @user == session.user\n \n else\n redirect \"/\",\n :message =>\n {:error => \"Hey, that isn't you! Stop trying to be naughty!\"}\n end\n end",
"def update\n @user = current_user\n if @user.update(user_params)\n redirect_to root_url\n else\n render 'edit'\n end\n end",
"def update\n @user = User.find(params[:id])\n if params[:user][:password].blank?\n params[:user].delete(:password)\n end\n \n respond_to do |format|\n if @user.update_attributes(user_params)\n sign_in @user, :bypass => true #should be if password is updated\n format.html { render :action => 'show', :notice => 'Din profil blev opdateret og vi har gemt dine ændringer' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if (current_user?(User.find(params[:id])) || is_admin?)\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to user_path, notice: \"Access Denied\"\n end\n end",
"def update\n if current_user.update(user_params)\n redirect_to user_path(current_user), notice: 'Your profile was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\n end\n end",
"def update_user\n\t\tunless current_user.id == @prototype.user.id\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def update\n if current_user.update(user_params)\n redirect_to current_user, notice: t(\"profile.updated\")\n else\n render \"edit\"\n end\n end",
"def edit_as_signed_in_user\n unless signed_in?\n flash[:danger] = \"Please sign in to edit this design method.\"\n redirect_to design_method_url\n end\n end",
"def update\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n # Handle a successful update.\n flash[:success] = \"Profile updated\"\n # log_in here makes sure token in cookie gets updated\n # If someone is using hijacked cookie, token gets updated and results in stole token not working\n log_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def update\n @user = current_user\n if @user.update(user_params)\n # flash success\n redirect_to current_user\n else\n # hanle error\n render 'edit'\n end\n end",
"def update\n @user = User.find_by_id(params[:id])\n if session[:user_id] == @user[:id]\n @user.update(user_params)\n flash[:notice] = \"Successfully updated profile.\"\n redirect_to user_path(@user)\n else\n flash[:error] = @user.errors.full_messages.join(\", \")\n redirect_to edit_user_path(@user)\n end\nend",
"def update\n user = self.resource = User.to_adapter.get!(send(:\"current_user\").to_key)\n\n if user.update_with_password(resource_params)\n set_flash_message :notice, :updated\n sign_in resource_name, user, :bypass => true\n respond_with user, :location => after_update_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end",
"def update\n authorize! if @user != current_user\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !session[:user_id]\n\tredirect_to :action=> 'login'\n else\n @gebruiker = Gebruiker.find(params[:id])\n\n respond_to do |format|\n if @gebruiker.update_attributes(params[:gebruiker])\n format.html { redirect_to(@gebruiker, :notice => 'De aanpassing was succesvol.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gebruiker.errors, :status => :unprocessable_entity }\n end\n end\n end\nend",
"def update\n @user = User.find(self.current_user.id)\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to :action => 'profile'\n else\n render :action => 'edit'\n end\n end",
"def update\n current_user.update_attributes! user_params\n redirect_back fallback_location: root_url\n end",
"def update\n current_user.update_attributes! user_params\n redirect_back fallback_location: root_url\n end",
"def update\n if check_user_write_access\n respond_to do |format|\n if user.update_attributes(params[:user])\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n #raise @user.inspect\n if @user.update_attributes(params[:user])\n #set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n @user_c= User.find(current_user.id)\n sign_in @user_c, :bypass => true \n respond_to do |format| \n format.html { redirect_to edit_admin_user_path , notice: \"User (#{@user.email}) password was successfully updated.\" }\n format.json\n end \n else\nrespond_to do |format|\nformat.html { render action: \"edit\" , notice: \"User was successfully deleted.\"}\nformat.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n\nend",
"def update\n if current_user.update_attributes(user_params)\n redirect_to current_user, notice: 'Profile successfully updated.'\n else\n render 'edit'\n end\n end",
"def force_update_profile!\n return unless current_user && !current_user.email?\n return if protected_controllers?\n\n redirect_to edit_user_registration_url\n end",
"def update\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Le profil a bien été modifié\"\n redirect_to user_path(@user)\n else\n render :action => 'edit'\n end\n end",
"def update\n @current_user.update user_params\n redirect_to root_path\n end",
"def update\n unless current_user == @user.user\n respond_to do |format|\n format.html { redirect_to profiles_path, alert: 'You have improper permissions to edit this profile.' }\n format.json { head :no_content }\n end\n return\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @current_user.id == params[:id].to_i && \\\n @current_user.update_attributes(params[:user])\n flash[:success] = \"profile was successfully updated\"\n redirect_to individual_path(@current_user.id)\n else\n flash[:error] = \"update error, please try again\"\n @user = @current_user\n render(:action => \"edit\")\n end\n end",
"def update\n @user = User.find(current_user.id)\n # email_changed = @user.email != params[:user][:email]\n is_facebook_account = !@user.provider.blank?\n\n successfully_updated = if !is_facebook_account\n @user.update_with_password(allowed_params)\n else\n @user.update_without_password(allowed_params)\n end\n\n if successfully_updated\n # Sign in the user bypassing validation in case his password changed\n # sign_in @user, :bypass => true\n redirect_to registration_path\n else\n redirect_to registration_path \n end\n end",
"def update\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Check that the current user is the specified user, or an\n # administrator\n unless @user == current_user or admin_logged_in?\n flash[:error] = 'You cannot update the profile of another user.'\n redirect_to :controller => 'sessions', :action => 'new'\n else\n \n # Update the details of the specified user\n @user.update_attributes(params[:user])\n \n # If back_home flag is set, redirect home (used for the case of \n # prompting the user to update their time zone from the home page)\n if params[:back_home].blank?\n flash.now[:just_submitted] = true\n render :template => 'users/edit', :layout => 'dialog'\n else\n flash[:notice] = \"Your time zone has been set to #{current_user.time_zone}.\"\n redirect_to '/'\n end\n end\n end",
"def update\n\t\tget_current_user\n\t\t@user = User.find(params[:id])\n\n\t\treturn (render json: {errors: [\"Je bent niet geauthoriseerd om dit te doen\"]}, status: :unprocessable_entity) unless (@current_user.isAdmin || @current_user.id == @user.id)\n\n\t respond_to do |format|\n\t if @user.update_attributes(params[:user])\n\t \tnew_remember_token(@user) if @current_user.isStudent\n\t format.json { head :no_content }\n\t else\n\t format.json { render json: {errors: @user.errors.full_messages}, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"def update\n @user = User.find(params[:id])\n authorize! :update, @user, :message => 'You are not authorized to perform this operation.'\n if @user.update_attributes(params[:user])\n redirect_to user_path(@user), :notice => \"You updated your account successfully. #{undo_link}\"\n else\n redirect_to user_path(@user), :alert => \"Unable to update user.\"\n end\n end",
"def update\n @user = User.find_by_id(params[:id])\n @current_user = User.find_by_id(session[:user_id])\n if @user.update(user_params)\n redirect_to user_path, notice: 'Successfully updated!'\n else\n redirect_to edit_user_path, notice: \"An error prevented update: #{@user.errors.full_messages}\"\n end\n end",
"def update\n check_user\n if @user.update(user_params)\n redirect_to @user, notice: 'User was successfully updated.' and return\n end\n end",
"def update\n if conditionally_update\n handle_successful_update\n redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: \"Your profile has been updated\"\n else\n redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages\n end\n end",
"def update\n @user = current_user\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Profile update successful.\"\n redirect_to root_url\n else\n render :action => \"edit\"\n end\n end",
"def update\n user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(user)\n\n if user.update(user_params)\n redirect_to user, notice: 'User was successfully updated.'\n else\n flash[:errors] = user.errors.full_messages\n redirect_to edit_user_path(params[:id]), alert: 'User was not updated'\n end\n end",
"def update\n if student_signed_in?\n update_for_student\n elsif teacher_signed_in?\n update_for_teacher\n end\n end",
"def update\n @account = Account.find(params[:id]) \n if @account.update_attributes!(params[:account])\n flash[:success] = \"Profile updated\"\n sign_in @account\n redirect_to @account\n else\n render 'edit'\n end\n end",
"def update \n if @user.update(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to :action => 'edit'\n else\n render 'edit'\n end \n \n end",
"def update\n return redirect_to(@user) if @user != current_user\n if @user.update_attributes params[:user]\n flash[:notice] = I18n.t('profile_updated')\n return redirect_to(@user)\n else\n render :template => 'users/edit'\n end\n end",
"def update\n authorize! :update, @user\n if @user.update(user_params)\n flash.now[:notice] = '@user was successfully updated.'\n else\n flash.now[:alert] = @user.errors.full_messages.first\n end\n end",
"def update\n @user = current_user\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Your profile has been successfully updated.'\n redirect_to user_path(@user)\n else\n render :action => 'edit'\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user == current_user\n @user.update_attributes user_params\n redirect_to user_path(@user)\n else\n flash[:alert] = \"You do not have permission to edit this account\"\n redirect_to posts_path\n end\n end",
"def edit\n if logged_in?\n @user = current_user \n render :edit\n else\n flash[:error] = \"Please sign in\"\n render 'sessions/new'\n end\n end",
"def update\n if @user.update(user_params)\n redirect_to @user, notice: 'Usuario actualizado exitosamente.'\n else\n render :edit\n end\n end",
"def update\n if @user.update(user_params)\n redirect_to root_path\n else\n flash[:error] = \"bad params\"\n end\n end",
"def update\n @user = current_user\n if @user.update_attributes params[:user]\n flash[:notice] = t \"flash.saved_user\"\n redirect_to root_url\n else\n render :action => \"edit\"\n end\n end",
"def update\n if @user.update_with_password(params[:user])\n # Sign in the user by passing validation in case his password changed\n sign_in @user, :bypass => true if @user.id == current_user.id\n flash[:notice] = \"User was successfully updated.\"\n end\n respond_with @user, location: user_path\n end",
"def update\n @user = User.find(params[:id])\n\n if(params[:conf]!=params[:user][:password])\n flash[:error] = \"Las contrasenas no coinciden.\"\n render \"edit\"\n else\n respond_to do |format|\n if @user.update_attributes(params[:user])\n sign_in(@user)\n format.html { redirect_to @user, notice: 'Tu informacion ha sido actualizada.' }\n format.json { head :no_content }\n else\n sign_in(@user)\n format.html { render action: \"edit\", notice: 'whut' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n if @user.update_attributes(user_params)\n flash[:success] = 'Account_updated'\n redirect_to dashboard_home_path\n else\n render 'users/registrations/edit'\n end\n end",
"def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n # update_with_password is defined in user model\n if resource.update_with_password(params[resource_name])\n if is_navigational_format?\n if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?\n flash_key = :update_needs_confirmation\n end\n set_flash_message :notice, flash_key || :updated\n end\n sign_in resource_name, resource, :bypass => true\n respond_with resource, :location => after_update_path_for(resource)\n else\n clean_up_passwords resource\n flash[:notice] = flash[:notice].to_a.concat resource.errors.full_messages\n redirect_to \"/users/profile\"\n end\n end",
"def update\n @user = current_user\n\n if @user.update_attributes(params[:user])\n redirect_to profile_path, :notice => I18n.t('profile.update_successful')\n else\n render \"show\"\n end\n end",
"def update\n respond_to do |format|\n if session[:dual_role]\n if !params[:is_realtor] || !params[:is_hunter]\n session[:dual_role] = false\n end\n end\n if @user.update_without_password(user_update_params)\n format.html {redirect_to @user, notice: 'User was successfully updated.'}\n format.json {render :show, status: :ok, location: @user}\n else\n format.html {render :edit}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end",
"def logged_in_user\n if logged_in?\n current_user.UpdateAccountValue(current_user)\n else\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def update\n account_update_params = devise_parameter_sanitizer.sanitize(:account_update)\n\n # This is required for the form to submit when the password is left blank.\n if account_update_params[:password].blank?\n account_update_params.delete('password')\n account_update_params.delete('password_confirmation')\n end\n\n @user = User.find(current_user.id)\n if @user.update_attributes(account_update_params)\n set_flash_message ':notice', :updated\n\n # Sign in the user and bypass validation in case the password changed.\n sign_in @user, bypass: true\n redirect_to after_update_path_for(@user)\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if current_user.update(user_params)\n format.html { redirect_to edit_user_path(current_user), notice: \"Your account was successfully updated.\" }\n format.json { render :show, status: :ok, location: @current_user }\n else\n format.html { render :edit }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end",
"def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end",
"def update\n if @user.update(user_params)\n redirect_to user_path, notice: \"ユーザ情報を変更しました\"\n else\n render :edit\n end\n end",
"def update\n @user = User.find(params[:id])\n redirect_to root_path unless current_user?(@user)\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { flash[:notice] = t('users.update.success'); redirect_to @user }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_user_path }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_in_user\r\n redirect_to signin_url, notice: \"Fai il login\" unless signed_in?\r\n # flash[:notice] = \"Please sign in\"\r\n end",
"def update\n respond_to do |format|\n\n @user.email = user_params[:email]\n @user.publicvisible = user_params[:publicvisible]\n @user.realname = user_params[:realname]\n if user_params[:password] != '*'\n @user.password = user_params[:password]\n else\n @user.password = nil\n end\n\n\n begin\n status = @user.save\n rescue ActiveResource::UnauthorizedAccess\n status = false\n end\n\n if status\n format.html { redirect_to edit_profile_path, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @user, alert: \"Could not update\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_in_user\n redirect_to signin_url, notice: 'Please sign in' unless signed_in?\n # notice: 'Please sign in' is the same of flash[:notice] = 'Please sign in'\n end",
"def update\n if params[:user][:password].present? || params[:user][:current_password].present?\n super\n else\n @user = User.find(current_user.id)\n if @user.update_without_password(params[:user])\n redirect_to after_update_path_for(@user), :notice => I18n.t(\"devise.registrations.updated\")\n else\n render \"edit\"\n end\n end\n end",
"def update\n if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n @user.update(user_params)\n redirect_to root_path\n else\n redirect_to :back\n end\n end",
"def update\n respond_to do |format|\n if @user.update_with_password(user_params)\n sign_in @user, :bypass => true\n format.html { redirect_to edit_user_path(current_user), notice: 'Profile updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_in_user\n redirect_to signin_url, notice: \"Please sign in\" unless signed_in?\n # notice: \"Please sign in\" is the same of flash[:notice] = \"Please sign in\"\n end",
"def update\n\t\tif !current_user\n\t\t\tredirect_to '/'\n\t\t\treturn\n\t\tend\n\t\trespond_to do |format|\n\t\t\tif current_user && is_this_user && @user.update(user_params)\n\t\t\t\tformat.html { redirect_to @user, notice: '<span class=\"alert alert-success\">User was successfully updated.</span>' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @user }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update_user\n end"
] | [
"0.79120916",
"0.7705902",
"0.7624987",
"0.7619818",
"0.7559416",
"0.7453027",
"0.74476624",
"0.7401865",
"0.7401865",
"0.74005586",
"0.73864746",
"0.7342249",
"0.7340904",
"0.733215",
"0.7280451",
"0.726508",
"0.7238233",
"0.723091",
"0.7184276",
"0.71764535",
"0.7165976",
"0.7163005",
"0.71595824",
"0.7151756",
"0.7130479",
"0.71094066",
"0.7101089",
"0.7091318",
"0.70600873",
"0.7057145",
"0.70529497",
"0.7041163",
"0.7024978",
"0.7024444",
"0.7020602",
"0.70160294",
"0.70051277",
"0.70022285",
"0.7000468",
"0.7000246",
"0.6987909",
"0.6984085",
"0.6981857",
"0.6980811",
"0.6977422",
"0.69750667",
"0.6965771",
"0.69656205",
"0.6964485",
"0.6964485",
"0.6964167",
"0.6961775",
"0.695532",
"0.69522065",
"0.6947596",
"0.6942384",
"0.6934229",
"0.69313926",
"0.6929415",
"0.69210905",
"0.6916944",
"0.69113535",
"0.69082403",
"0.6904137",
"0.689563",
"0.6893983",
"0.6881742",
"0.6875353",
"0.68748313",
"0.6873899",
"0.6873866",
"0.6867615",
"0.6864379",
"0.6860587",
"0.685704",
"0.6853446",
"0.6850551",
"0.6845147",
"0.68281317",
"0.6827668",
"0.68269837",
"0.6825409",
"0.68128765",
"0.6806759",
"0.68018323",
"0.680046",
"0.67965126",
"0.6795373",
"0.6795373",
"0.67942023",
"0.6792241",
"0.67851746",
"0.6783765",
"0.6781108",
"0.6778626",
"0.6777929",
"0.6777022",
"0.6776899",
"0.67763054",
"0.67746335",
"0.67646605"
] | 0.0 | -1 |
Must be done after all of the table definitions since `metrics_01` is dumped prior to `metrics_base`, etc. | def miq_metric_table_constraints(stream)
inherited_metrics_tables.each do |(table, inherit_from)|
child_table_num = table.match(METRIC_ROLLUP_TABLE_REGEXP)[:CHILD_TABLE_NUM].to_i
child_table = remove_prefix_and_suffix(table).inspect
primary_condition = if inherit_from.include?("rollup")
"capture_interval_name != ? AND EXTRACT(MONTH FROM timestamp) = ?"
else
"capture_interval_name = ? AND EXTRACT(HOUR FROM timestamp) = ?"
end
conditions = [primary_condition, "realtime", child_table_num]
stream.puts " add_miq_metric_table_inheritance #{child_table}, " \
"#{inherit_from.inspect}, " \
":conditions => #{conditions.inspect}"
end
stream.puts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def create_metrics_for_snapshot(snapshot)\n\n @eth0_rx_counter ||= 0\n @eth0_tx_counter ||= 0\n @uptime_counter ||= 0\n \n # Build a random value for the network counters.\n @eth0_rx_counter += rand(100000)\n @eth0_tx_counter += rand(200000)\n\n # Increase the uptime counter by one minute.\n @uptime_counter += 1.minute\n\n # Create the load.average metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'load.average',\n :counter => rand()\n )\n\n # Create the memory metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.physical.used',\n :counter => rand(100000) + 1000\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.swap.used',\n :counter => rand(1000) + 1000\n )\n \n # Create a uptime metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'uptime',\n :counter => @uptime_counter\n )\n\n # Create the process count metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'processes.count',\n :counter => rand(100) + 10\n )\n\n # Create the eth0 network metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.rx',\n :counter => @eth0_rx_counter\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.tx',\n :counter => @eth0_tx_counter\n )\n\nend",
"def custom_metrics\n @custom_metrics ||= {}\n end",
"def persist_metrics\n self.metrics.each(&:save)\n end",
"def build_metrics\n {}\n end",
"def collate\n @metrics.all.each do |request|\n row = {}\n metric = request[:body]\n metric.each do |key, value|\n @columns.add key\n row[key] = value\n end\n @rows << row\n end\n end",
"def set_metrics(metrics, batch)\n _this_ts, label, latency, error, threads, http_code = metrics\n ['ALL', label].each do |key|\n # load test worker threads are recorded at the start of the interval\n batch[key]['threads'] = threads unless batch[key]['threads']\n batch[key]['requests'] += 1\n batch[key]['errors'] += error\n batch[key]['http_code_distribution'][http_code] += 1\n # latency samples are not counted for failed requests\n unless error == 1\n batch[key]['latency_distribution'][latency] += 1\n batch[key]['latency_sum'] += latency\n end\n end\n end",
"def create_stats_tbl\n tblName = \"#{@table}_stat\"\n creationQuery = \"select ''::text as key, ''::text as value from t_result where 1 =2\"\n # puts creationQuery\n DBConn.tblCreation(tblName, 'key', creationQuery)\n\n parseTree = @parseTree\n\n # fromPT = parseTree['SELECT']['fromClause']\n originalTargeList = parseTree['SELECT']['targetList']\n # fields = DBConn.getAllRelFieldList(fromPT)\n keyList = []\n valueList = []\n selectList = []\n pkJoinList = []\n \n pkArray = @pkList.split(',').map { |col| col.delete(' ') }\n pkArray.each do |pkcol|\n originalTargeList.each do |targetCol|\n targetField = targetCol['RESTARGET']['val']['COLUMNREF']['fields']\n if targetField.count > 1 && targetField[1].to_s == pkcol\n pkJoinList << \"t.#{pkcol} = #{targetField[0]}.#{targetField[1]}\"\n pkArray.delete(pkcol)\n end\n end\n end\n\n stats = {\n \"min\": {\"func\": \"min($COLUMN)\", \"type\": \"text\" },\n \"max\": {\"func\": \"max($COLUMN)\", \"type\": \"text\" },\n \"count\": {\"func\": \"count($COLUMN)\", \"type\": \"int\" },\n \"dist_count\": {\"func\": \"count(distinct $COLUMN)\", \"type\": \"int\" }\n }\n @all_cols.each do |field|\n # puts field.colname\n rel_alias = field.relalias\n stats.each do |stat, info|\n # SELECT\n # UNNEST(ARRAY['address_id_max','address_id_min']) AS key,\n # UNNEST(ARRAY[max(address_id),min(address_id)]) AS value\n # FROM address\n # only add N(umeric) and D(ate) type fields\n if %w(N D).include? field.typcategory\n keyList << \"'#{field.relname}_#{field.colname}_#{stat}'\"\n value = info[:func].gsub('$COLUMN',\"result.#{field.relname}_#{field.colname}\")\n # if info[:type] == 'text'\n value = \"#{value}::text\"\n # end\n valueList << value\n # valueList << \"#{stat}(result.#{field.relname}_#{field.colname})::text\"\n end\n end\n selectList << \"#{rel_alias}.#{field.colname} as #{field.relname}_#{field.colname} \"\n\n # construnct pk join cond\n if pkArray.include?(field.colname)\n pkJoinList << \"#{@table}.#{field.colname} = #{rel_alias}.#{field.colname}\"\n end\n end\n\n # # remove the where clause in query and replace targetList\n whereClauseReplacement = []\n selectQuery = ReverseParseTree.reverseAndreplace(parseTree, selectList.join(','), whereClauseReplacement)\n resultQuery = %(with result as (#{selectQuery} join #{@table} on #{pkJoinList.join(' AND ')}))\n newTargetList = \"UNNEST(ARRAY[#{keyList.join(',')}]) AS key, UNNEST(ARRAY[#{valueList.join(',')}]) as value\"\n\n newQuery = %(#{resultQuery} SELECT #{newTargetList} FROM result)\n query = %(INSERT INTO #{tblName} #{newQuery})\n # puts query\n DBConn.exec(query)\n end",
"def additional_metrics\n []\n end",
"def register_metrics!\n return if @registered\n @registered = true\n with_instance do |t|\n # Worker related\n t.add_gauge :dynflow_active_workers, 'The number of currently busy workers',\n [:queue, :world]\n t.add_counter :dynflow_worker_events, 'The number of processed events',\n [:queue, :world, :worker]\n\n # Execution plan related\n t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans',\n [:action, :world, :state]\n t.add_gauge :dynflow_queue_size, 'Number of items in queue',\n [:queue, :world]\n t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans',\n [:action, :world, :result]\n\n # Step related\n # TODO: Configure buckets in a sane manner\n t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step',\n [:action, :phase]\n t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step',\n [:action, :phase]\n\n # Connector related\n t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector',\n [:world, :direction]\n\n # Persistence related\n t.add_histogram :dynflow_persistence, 'The time spent communicating with the database',\n [:world, :method]\n end\n end",
"def migrate\n metrics_list = []\n timestamp = Time.now.to_i.to_s\n ipstring = @option[:ip_address].gsub '.', '-'\n\n # @result.each_pair do |key, value|\n # puts \"|#{key}|\"\n # value.each_pair do |ifname, ifvalue|\n # puts \"|#{ifname}|#{ifvalue}|\"\n # end\n # end\n [[:InSpeed, :InOctets], [:OutSpeed, :OutOctets]].each do |item|\n @result.each_pair do |vlannm, vlanvalue|\n #puts \"|#{vlannm}|\"\n if @exvlan.include? vlannm\n next\n end\n sorted = Hash[vlanvalue.sort_by {|a, b| -b[item[1]].to_i}]\n index = 0\n sorted.each_pair do |ifname, ifvalue|\n if @tops.to_i > 0 && index >= @tops.to_i\n break\n end\n index += 1\n\n #puts \"--#{ifname}, #{ifvalue}\"\n info = {\n :sn => ipstring + \"-\" + timestamp + \"-\" + ifname,\n :target => @option[:org_env] + \".\" + @option[:basetarget] +\n \".#{ipstring}.traffic.#{vlannm}.#{item[0]}\",\n :instance => ifname,\n :status => ifvalue[item[0]],\n :details => \"top#{index}\",\n :timestamp => Time.now().to_i() * 1000,\n :duration => 0,\n :attachments => []\n }\n #puts info\n metrics = Metrics.new(@option[:pin_code], info)\n #puts metrics\n metrics_list << metrics\n end\n end\n end\n\n merged = Metrics.merge(metrics_list)\n end",
"def data_set_for_metrics(metrics)\n\n data_set = {}\n previous_counters = {}\n\n metrics.each do |metric|\n\n path = metric.path\n timestamp = metric.timestamp\n current_counter = metric.counter\n counter = current_counter\n\n # If this is an incremental graph, calculate the difference between\n # the previous counter value for this path and the current counter\n # value, and use the difference as the counter value. If we have no\n # previous counter value, 0 is used.\n #\n # Also, if the differential between previous and current is below 0,\n # its assumed that the counter has reset and we will start counting\n # from 0 again instead of returning a negative value.\n if @type == 'incremental'\n if !previous_counters[path].blank?\n\n counter = current_counter - previous_counters[path]\n\n # Reset the counter if we have a negative value.\n if counter < 0\n counter = current_counter\n end\n\n else\n counter = 0\n end\n end\n\n # Define the previous counter value for this path.\n previous_counters[path] = current_counter\n\n # Add the counter to the data set.\n data_set[path] ||= []\n data_set[path] << Sherlock::Models::MetricData.new(timestamp, counter)\n\n end\n\n # Apply the requested conversion on the data set if requested.\n unless @conversion.blank?\n converter = Sherlock::MetricConverter.new(data_set)\n data_set = converter.apply_conversion(@conversion)\n end\n\n data_set\n\n end",
"def update_stats \n $logger.info \"regenerating stats from #{self.table_name}...\"\n \n # first delete the old data (always a good idea)\n AccessByServicePerMin.delete_all standard_condition \n AccessByServicePerHour.delete_all standard_condition\n AccessByServicePerDay.delete_all standard_condition\n \n # and reconstruct from the raw data\n success_entries = get_grouped_entries\n failure_entries = get_grouped_entries(false) \n \n # fill up gaps, merge the success and failure data and\n # write per-minute statistics\n 0.upto(23) do |hour|\n 0.upto(59) do |minute|\n \n the_timestamp = Time.at(start_ts + (hour * 60 + minute) * 60)\n \n new_row = AccessByServicePerMin.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => the_timestamp.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => 0, \n :failure_count => 0,\n :response_time_micros_avg => 0\n )\n if success_entries.has_key?(the_timestamp)\n new_row[:success_count] = success_entries[the_timestamp].the_count\n new_row[:response_time_micros_avg] = success_entries[the_timestamp].the_avg\n end\n if failure_entries.has_key?(the_timestamp)\n new_row[:failure_count] = failure_entries[the_timestamp].the_count\n end\n new_row.save()\n end\n end\n \n # group the data we've just written by hour\n grouped_by_hour = get_hour_stats_from_minutes\n 0.upto(23) do |hour|\n the_timestamp = Time.at(start_ts + (hour * 60 * 60))\n new_row = AccessByServicePerHour.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => the_timestamp.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => 0, \n :failure_count => 0,\n :response_time_micros_avg => 0 \n )\n if grouped_by_hour.has_key?(the_timestamp)\n new_row[:success_count] = grouped_by_hour[the_timestamp].success_sum\n new_row[:failure_count] = grouped_by_hour[the_timestamp].failure_sum\n new_row[:response_time_micros_avg] = grouped_by_hour[the_timestamp].the_avg\n end\n new_row.save\n end\n \n # and update the daily stats from the hours\n row = get_daily_stats_from_hours.first \n AccessByServicePerDay.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => start_ts.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => row.success_sum, \n :failure_count => row.failure_sum,\n :response_time_micros_avg => row.the_avg\n ).save()\n $logger.info \"updated stats for #{self.service_name}@#{self.host_name} : #{row.success_sum} successful calls, #{row.failure_sum} failures between #{start_ts} and #{stop_ts}\"\n end",
"def metrics\n @metrics ||= []\n end",
"def reset_metrics\n flush_cache\n self\n end",
"def cpu_metrics\n super\n end",
"def reset_statistics!; end",
"def reset_statistics!; end",
"def report_metrics(metrics=MetricFu.metrics)\n MetricFu.configuration.metrics.sort_by! {|x| x == :hotspots ? 1 : 0 }\n MetricFu.configuration.metrics\n end",
"def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n warning: 0 }\n end",
"def reset_all_statistics\n super\n end",
"def finalize_calculations\n\t\t\t@timeFactors.each do |t|\n\t\t\t\tif @metricsDataAggregator[t].hasDataToDump?\n\t\t\t\t\t@metricsDataAggregator[t].aggregateValues()\n\t\t\t\t\t@summaryMetricHashArr << @metricsDataAggregator[t].getCurrentData(@sequenceCounter)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# write the last batch to db\n\t\t\twrite_batch_to_db()\n\n\t\t\treturn true\n\t\tend",
"def all_tmm_statistics\n super\n end",
"def update_metric_ranges\n metrics = Metric.where(:range => nil)\n metrics.each do |m|\n case m.key\n when \"fs.disk.used\", \"fs.disk.free\"\n update_metric_range(m, \"fs.disk.size\")\n when \"fs.inode.used\", \"fs.inode.free\"\n update_metric_range(m, \"fs.inode.total\")\n when \"mem.used\", \"mem.free\"\n update_metric_range(m, \"mem.total\")\n when \"fs.files.count\"\n update_metric_range(m, \"fs.files.max\")\n else\n m.range = \"\"\n m.save\n end\n end\n\n true\n end",
"def metrics\n @metrics ||= parent_klass.metrics.dup\n end",
"def metrics\n @metrics ||= collect_metrics\n end",
"def process\n return if @metrics.size_all == 0\n\n collate\n write_to_disk\n end",
"def cleanup_tables\n klass_ = self.class.const_get(:DEFAULT_AR_CLASS)\n if klass_.connection.tables.include?('spatial_test')\n klass_.connection.drop_table(:spatial_test)\n end\n end",
"def performance_table_list\n super\n end",
"def update_averages_for_metrics!\n Metric.all.each do |metric|\n update_averages_for_metric!(metric)\n end\n end",
"def performance_table_statistics(opts)\n opts = check_params(opts,[:tables])\n super(opts)\n end",
"def summary_metrics\n []\n end",
"def collect(metrics)\n metrics[:polled_total] = rand(100)\n metrics\n end",
"def metric(name,type,value)\n @metrics[name] = {\n :type => type,\n :value => value\n }\nend",
"def initialize\n @stats = {}\n @schema = {}\n @ebd_cache = {}\n end",
"def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end",
"def prepare_metrics(metric_name, results)\n metrics = []\n results.each do |result|\n source = result['metric']['instance']\n value = result['value'][1].to_i\n log.debug(\"[#{metric_name}] value: '#{value}', source: '#{source}'\")\n metrics << { 'source' => source, 'value' => value }\n end\n metrics\n end",
"def initialize(...)\n @metrics = {}\n register(...)\n end",
"def metrics=(new_metrics)\n @metrics = new_metrics\n @metrics[:missing] = @metrics.first[1] unless @metrics[:missing]\n end",
"def collect_measurement_statistics\n Ggi::Taxon.all.select { |t| t.family? }.each do |taxon|\n Ggi::ClassificationImporter::MEASUREMENT_URIS_TO_LABELS.each do |uri, label|\n measurement = taxon.measurements.detect { |m| m[:measurementType] == uri }\n value = measurement ? measurement[:measurementValue] : DEFAULT_SCORE\n @measurement_type_values[uri] ||= Hash.new(DEFAULT_SCORE)\n @measurement_type_values[uri][value] += 1\n end\n end\n end",
"def import_active_stats\n\n end",
"def add_metric\n\t\tp_language = ProgrammingLanguage.find_by_name(RubyCoverage::PROGRAMMING_LANGUAGE)\n\t\t \n\t\tbegin\n\t\t Metric.table_exists?\n\t\t metric_analyser = RubyCoverage::ANALYSER\n\t\t metric_name = RubyCoverage::NAME\n\t\t if Metric.find_by_name(metric_name).nil?\n\t\t\tmetric = Metric.new(:name => metric_name, :analyser => metric_analyser)\n\t\t\tmetric.programming_language = p_language\n\t\t\tmetric.save!\n\t\t end \n\t\trescue\n\t\t raise \"ActiveRecord::Metric does not exist.\"\n\t\tend\n\t end",
"def process_rows!\n # Correct incorrect rows in the table\n table.each do |row|\n row_metric = row[\"metric\"] # perf optimization\n # TODO inject Saikuro reference\n if row_metric == :saikuro\n fix_row_file_path!(row)\n end\n tool_tables[row_metric] << row\n file_tables[row[\"file_path\"]] << row\n class_tables[row[\"class_name\"]] << row\n method_tables[row[\"method_name\"]] << row\n end\n end",
"def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end",
"def store(*metrics)\n\t\t\tgroups = Hash.new do |h1,mclass|\n\t\t\t\th1[mclass] = Hash.new do |h2,mtype|\n\t\t\t\t\th2[mtype] = Array.new\n\t\t\t\tend\n\t\t\tend\n\t\t\t\t\n\t\t\tmetrics.each do |metric| \n\t\t\t\tmtype = metric.metricType\n\t\t\t\tmclass = metric.metricClass\n\t\t\t\tensured = self.ensureMetricType(mtype,mclass)\n\t\t\t\t\n\t\t\t\tunless ensured\n\t\t\t\t\tself.logger.error(\"unable to store metric(#{mtype}/#{mclass}) #{metric}\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tgroups[mclass][mtype] << metric\n\t\t\tend\n\t\t\t\n\t\t\tgroups.each do |mclass,mtypes| \n\t\t\t\tlogic = @logic[:store][mclass]\n\t\t\t\tmtypes.each do |mtype, typMetrics|\n\t\t\t\t\tfailMessages = typMetrics.map {|metric| \"unable to store metric(#{mclass}/#{mtype}): #{metric}\"}\n\t\t\t\t\t \n\t\t\t\t\tself.tryBlock(*failMessages) do case logic.arity\n\t\t\t\t\t\twhen -2 then self.instance_exec(mtype, *typMetrics, &logic)\n\t\t\t\t\t\twhen -3 then self.instance_exec(mtype, mclass, *typMetrics, &logic)\n\t\t\t\t\tend end \n\t\t\t\tend\n\t\t\tend\n\n\t\t\tself\n\t\tend",
"def metrics\n with_stats_lock do\n @stats_hash.keys.map { |spec| spec.to_s }\n end\n end",
"def opx_dump_tabulator_data(tab)\n print \"Tabulator Data Summary\\n\"\n print \" Jurisdiction UID: #{tab.uids['jurisdiction'][0]}\\n\"\n print \" Election UID: #{tab.uids['election'][0]}\\n\"\n ['district','precinct','contest','candidate','question','counter',\n 'file','reporting group'].each do |k|\n length = tab.uids[k].length.to_s\n myuids = tab.uids[k].sort\n type = (k =~ /^report/ ? \"Reporting Groups\" : \"#{k.capitalize} UIDs\")\n if (myuids.length == 0)\n prefix = \" #{type} (NONE)\\n\"\n else\n prefix = \" #{type} (#{myuids.length.to_s}): \"\n print prefix\n if (myuids.length > 10)\n prefix = \" \"\n print \"\\n#{prefix}\"\n end\n opx_pp(myuids, prefix.length, prefix.length, 78)\n end\n end\n missing = (tab.counts_expected - tab.counts_accumulated)\n count = missing.length\n total = tab.counts_expected.length\n print \" Expected Counts \"\n if (total == 0)\n print \"(NONE)\\n\"\n else\n print \"(#{total}): Counter UID, Reporting Group, Precinct UIDs\\n\"\n tab.uids[\"counter\"].sort.each do |cid|\n if (tab.counts_expected.any? {|ce| ce[0] == cid})\n rgs = tab.uids[\"reporting group\"].sort.select { |rg|\n tab.counts_expected.any? {|ce| ce[0] == cid && ce[1] == rg }}\n rgs.each { |rg|\n pids = tab.uids[\"precinct\"].sort.select { |pid|\n tab.counts_expected.any? {|ce| ce == [cid, rg, pid]}}\n print \" #{cid}, #{rg}, #{pids.uniq.inspect.gsub(/\\\"/,\"\")}\\n\"}\n end\n end\n end\n print \" Missing Counts \"\n if (count == 0)\n print \"(NONE)\\n\"\n else\n print \"(#{count}): Counter UID, Precinct UID, Reporting Group\\n\"\n missing.each do |cid, rg, pid|\n print \" #{cid}, #{pid}, #{rg}\\n\"\n end\n end\n if (tab.counts_contests.keys.length == 0)\n print \" Contests (NONE)\\n\"\n else\n print \" Contests (\",tab.counts_contests.keys.length.to_s,\"):\"\n print \" Contest UID: overvote, undervote, write-in, Candidate UIDs\\n\"\n end\n tab.counts_contests.keys.sort.each do |k|\n v = tab.counts_contests[k]\n print \" #{k}: \"\n print \"overvote = #{v[\"overvote_count\"]}, \"\n print \"undervote = #{v[\"undervote_count\"]}, \"\n print \"writeins = #{v[\"writein_count\"]}\\n\"\n v[\"candidate_count_list\"].each do |item|\n print \" #{item[\"candidate_ident\"]} = #{item[\"count\"]}\\n\"\n end\n end\n if (tab.counts_questions.keys.length == 0)\n print \" Questions (NONE)\\n\"\n else\n print \" Questions (\",tab.counts_questions.keys.length.to_s,\"):\"\n print \" Question UID: overvote, undervote, Answers\\n\"\n end\n tab.counts_questions.keys.sort.each do |k|\n v = tab.counts_questions[k]\n print \" #{k}: \"\n print \"overvote = #{v[\"overvote_count\"]}, \"\n print \"undervote = #{v[\"undervote_count\"]}\\n\"\n v[\"answer_count_list\"].each do |item|\n print \" #{item[\"answer\"]} = #{item[\"count\"]}\\n\"\n end\n end\n print \"\\n\"\n rescue => e\n opx_err(\"Fatal failure while dumping Tabulator data\", e)\n end",
"def get_mbeanmap_for_lowerversion\n metric_type_to_solr_core_mbean_attr_map = {\n \"ADD_METRICS\" => {\n \"type=/get,id=org.apache.solr.handler.RealTimeGetHandler\" =>\n [\"requests,5minRateReqsPerSecond,15minRateReqsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"type=/select,id=org.apache.solr.handler.component.SearchHandler\" =>\n [\"requests,5minRateReqsPerSecond,15minRateReqsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"type=/update,id=org.apache.solr.handler.UpdateRequestHandler\" =>\n [\"requests,5minRateReqsPerSecond,15minRateReqsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"type=fieldValueCache,id=org.apache.solr.search.FastLRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"type=filterCache,id=org.apache.solr.search.FastLRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"type=documentCache,id=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"type=queryResultCache,id=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"type=perSegFilter,id=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"type=updateHandler,id=org.apache.solr.update.DirectUpdateHandler2\" =>\n [\"commits,soft autocommits\"],\n \"type=/admin/segments,id=org.apache.solr.handler.admin.SegmentsInfoRequestHandler\" =>\n [\"requests\"],\n \"type=fieldCache,id=org.apache.solr.search.SolrFieldCacheMBean\" =>\n [\"entries_count\"]\n },\n \"AVG_METRICS\" => {\n \"type=/get,id=org.apache.solr.handler.RealTimeGetHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"],\n \"type=/select,id=org.apache.solr.handler.component.SearchHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"],\n \"type=/update,id=org.apache.solr.handler.UpdateRequestHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"]\n }\n }\n return metric_type_to_solr_core_mbean_attr_map\n end",
"def update_metric_values!\n puts \"Updating metric values...\"\n update_daily_happiness_distributions!\n update_weekly_happiness_distributions!\n update_monthly_happiness_distributions!\n update_annual_happiness_distributions!\n update_average_happiness_distributions!\n update_averages_for_metrics!\n puts \"Done updating metric values.\"\n end",
"def run\n tables.each do |table|\n dump_table(table)\n end\n end",
"def temperature_metrics\n super\n end",
"def enable_all_metrics_collection\n enable_metrics_collection\n end",
"def all_metrics\n output = `cube_info #{@fname} -l`\n output.split(\"\\n\")\n end",
"def all\n @@all_metrics ||= self.from_file(\n File.join(Rails.root, 'config', 'metrics.yml')\n )\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_database_counters\n NineAstronauts::DatabaseCounters::Counters.reset!\n end",
"def reset_metrics_buffer\n @@metrics_buffer = []\n end",
"def table; end",
"def table; end",
"def table; end",
"def table; end",
"def application_metrics\n metrics = Danbooru::Metric::Set.new({\n danbooru_info: [:counter, \"Information about the current application build.\"],\n danbooru_artists_total: [:gauge, \"The total number of artists.\"],\n danbooru_artist_urls_total: [:gauge, \"The total number of artist URLs.\"],\n danbooru_artist_versions_total: [:counter, \"The total number of artist versions.\"],\n danbooru_background_jobs_total: [:gauge, \"The total number of background jobs.\"],\n danbooru_bans_total: [:gauge, \"The total number of user bans.\"],\n danbooru_bulk_update_requests_total: [:gauge, \"The total number of bulk update requests.\"],\n danbooru_comments_total: [:gauge, \"The total number of comments.\"],\n danbooru_comment_votes_total: [:gauge, \"The total number of comment votes.\"],\n danbooru_favorites_total: [:gauge, \"The total number of favorites.\"],\n danbooru_favorite_groups_total: [:gauge, \"The total number of favorite groups.\"],\n danbooru_forum_posts_total: [:gauge, \"The total number of forum posts.\"],\n danbooru_forum_topics_total: [:gauge, \"The total number of forum topics.\"],\n danbooru_media_assets_total: [:gauge, \"The total number of media assets. Excludes processing or failed assets.\"],\n danbooru_media_assets_file_size_bytes_total: [:gauge, \"The total file size of all active media assets. Does not include thumbnails.\"],\n danbooru_media_assets_pixels_total: [:gauge, \"The total number of pixels in all active media assets (that is, the sum of width * height for all images). Does not account for animated images.\"],\n danbooru_media_assets_duration_seconds_total: [:gauge, \"The total runtime of all active media assets. Includes videos, animated GIFs and PNGs, and ugoiras.\"],\n danbooru_post_votes_total: [:gauge, \"The total number of post votes.\"],\n danbooru_posts_total: [:gauge, \"The total number of posts.\"],\n danbooru_post_appeals_total: [:gauge, \"The total number of post appeals.\"],\n danbooru_post_flags_total: [:gauge, \"The total number of post flags.\"],\n danbooru_notes_total: [:gauge, \"The total number of notes.\"],\n danbooru_note_versions_total: [:counter, \"The total number of note versions.\"],\n danbooru_pools_total: [:gauge, \"The total number of pools.\"],\n danbooru_pools_post_count_total: [:gauge, \"The total number of posts in pools.\"],\n danbooru_tags_total: [:gauge, \"The total number of tags (excluding empty tags).\"],\n danbooru_tags_post_count_total: [:gauge, \"The total number of tags on posts.\"],\n danbooru_uploads_total: [:gauge, \"The total number of uploads.\"],\n danbooru_users_total: [:counter, \"The total number of users.\"],\n danbooru_user_feedbacks_total: [:gauge, \"The total number of user feedbacks (excluding deleted feedbacks).\"],\n danbooru_wiki_pages_total: [:gauge, \"The total number of wiki pages.\"],\n danbooru_wiki_page_versions_total: [:counter, \"The total number of wiki page versions.\"],\n })\n\n status = ServerStatus.new\n versions = {\n danbooru_version: status.danbooru_version,\n ruby_version: status.ruby_version,\n rails_version: status.rails_version,\n puma_version: status.puma_version,\n distro_version: status.distro_version,\n libvips_version: status.libvips_version,\n ffmpeg_version: status.ffmpeg_version,\n exiftool_version: status.exiftool_version,\n }\n metrics[:danbooru_info][versions].set(1)\n\n Artist.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_artists_total][deleted: deleted].set(count)\n end\n\n ArtistURL.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_artist_urls_total][active: active].set(count)\n end\n\n ArtistVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_artist_versions_total].set(count)\n end\n\n metrics[:danbooru_background_jobs_total][status: \"queued\"].set(BackgroundJob.queued.count)\n metrics[:danbooru_background_jobs_total][status: \"running\"].set(BackgroundJob.running.count)\n metrics[:danbooru_background_jobs_total][status: \"finished\"].set(BackgroundJob.finished.count)\n metrics[:danbooru_background_jobs_total][status: \"discarded\"].set(BackgroundJob.discarded.count)\n\n Ban.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_bans_total].set(count)\n end\n\n BulkUpdateRequest.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_bulk_update_requests_total][status: status].set(count)\n end\n\n Comment.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_comments_total][deleted: deleted].set(count)\n end\n\n CommentVote.group(:score).active.pluck(Arel.sql(\"score, COUNT(*)\")).each do |score, count, score_sum|\n metrics[:danbooru_comment_votes_total][type: score > 0 ? \"up\" : \"down\"].set(count)\n end\n\n FavoriteGroup.group(:is_public).pluck(Arel.sql(\"is_public, COUNT(*)\")).each do |is_public, count|\n metrics[:danbooru_favorite_groups_total][public: is_public].set(count)\n end\n\n ForumPost.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_posts_total][deleted: deleted].set(count)\n end\n\n ForumTopic.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_topics_total][deleted: deleted].set(count)\n end\n\n MediaAsset.active.group(:file_ext).pluck(Arel.sql(\"file_ext, COUNT(*), SUM(file_size), SUM(image_width*image_height), COALESCE(SUM(duration), 0)\")).each do |file_ext, count, file_size, pixels, duration|\n metrics[:danbooru_media_assets_total][file_ext: file_ext].set(count)\n metrics[:danbooru_media_assets_file_size_bytes_total][file_ext: file_ext].set(file_size)\n metrics[:danbooru_media_assets_pixels_total][file_ext: file_ext].set(pixels)\n metrics[:danbooru_media_assets_duration_seconds_total][file_ext: file_ext].set(duration.round(4))\n end\n\n Post.pluck(Arel.sql(\"SUM(up_score), ABS(SUM(down_score)), SUM(fav_count), COUNT(*) FILTER (WHERE is_pending), COUNT(*) FILTER (WHERE is_flagged), COUNT(*) FILTER (WHERE is_deleted), COUNT(*)\")).each do |upvote_count, downvote_count, favorite_count, pending_count, flagged_count, deleted_count, total_count|\n metrics[:danbooru_post_votes_total][type: \"up\"].set(upvote_count)\n metrics[:danbooru_post_votes_total][type: \"down\"].set(downvote_count)\n metrics[:danbooru_favorites_total].set(favorite_count)\n\n metrics[:danbooru_posts_total][status: \"pending\"].set(pending_count)\n metrics[:danbooru_posts_total][status: \"flagged\"].set(flagged_count)\n metrics[:danbooru_posts_total][status: \"deleted\"].set(deleted_count)\n metrics[:danbooru_posts_total][status: \"active\"].set(total_count - pending_count - deleted_count - flagged_count)\n end\n\n PostAppeal.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_appeals_total][status: status].set(count)\n metrics[:danbooru_posts_total][status: \"appealed\"].set(count) if status == \"pending\"\n end\n\n PostFlag.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_flags_total][status: status].set(count)\n end\n\n Note.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_notes_total][deleted: !active].set(count)\n end\n\n NoteVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_note_versions_total].set(count)\n end\n\n Pool.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(cardinality(post_ids))\")).each do |category, count, post_count|\n metrics[:danbooru_pools_total][category: category].set(count)\n metrics[:danbooru_pools_post_count_total][category: category].set(post_count)\n end\n\n Tag.nonempty.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(post_count)\")).each do |category, count, post_count|\n metrics[:danbooru_tags_total][category: TagCategory.reverse_mapping[category]].set(count)\n metrics[:danbooru_tags_post_count_total][category: TagCategory.reverse_mapping[category]].set(post_count)\n end\n\n Upload.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_uploads_total][status: status].set(count)\n end\n\n User.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_users_total].set(count)\n end\n\n UserFeedback.active.group(:category).pluck(Arel.sql(\"category, COUNT(*)\")).each do |category, count|\n metrics[:danbooru_user_feedbacks_total][category: category].set(count)\n end\n\n WikiPage.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_wiki_pages_total][deleted: deleted].set(count)\n end\n\n WikiPageVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_wiki_page_versions_total].set(count)\n end\n\n metrics\n end",
"def merge_metrics(storage, metrics)\n metrics.each do |metric, value|\n storage.store(\n metric.to_s,\n storage[metric.to_s].to_a << value.to_f\n )\n end\n storage\n end",
"def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end",
"def call\n missing_metrics.each(&method(:create_metric))\n missing_methods.each(&method(:create_method))\n end",
"def get_mbeanmap_for_higherversion\n metric_type_to_solr_core_mbean_attr_map = {\n \"ADD_METRICS\" => {\n # category, scope, name are the elements of the mbean object\n \"category=QUERY,scope=/get,name=org.apache.solr.handler.RealTimeGetHandler\" =>\n [\"requests,5minRateRequestsPerSecond,15minRateRequestsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"category=QUERY,scope=/select,name=org.apache.solr.handler.component.SearchHandler\" =>\n [\"requests,5minRateRequestsPerSecond,15minRateRequestsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"category=UPDATE,scope=/update,name=org.apache.solr.handler.UpdateRequestHandler\" =>\n [\"requests,5minRateRequestsPerSecond,15minRateRequestsPerSecond,timeouts,errors,clientErrors,serverErrors\"],\n \"category=CACHE,scope=fieldValueCache,name=org.apache.solr.search.FastLRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"category=CACHE,scope=filterCache,name=org.apache.solr.search.FastLRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"category=CACHE,scope=documentCache,name=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"category=CACHE,scope=queryResultCache,name=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"category=CACHE,scope=perSegFilter,name=org.apache.solr.search.LRUCache\" =>\n [\"hits,hitratio,evictions\"],\n \"category=UPDATE,scope=updateHandler,name=org.apache.solr.update.DirectUpdateHandler2\" =>\n [\"commits,soft autocommits\"],\n \"category=ADMIN,scope=/admin/segments,name=org.apache.solr.handler.admin.SegmentsInfoRequestHandler\" =>\n [\"requests\"],\n \"category=CORE,scope=searcher,name=org.apache.solr.search.SolrIndexSearcher\" =>\n [\"deletedDocs,maxDoc,numDocs\"],\n \"category=CACHE,scope=fieldCache,name=org.apache.solr.search.SolrFieldCacheMBean\" =>\n [\"entries_count,total_size\"]\n },\n \"AVG_METRICS\" => {\n # category, scope, name are the elements of the mbean object\n \"category=QUERY,scope=/get,name=org.apache.solr.handler.RealTimeGetHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"],\n \"category=QUERY,scope=/select,name=org.apache.solr.handler.component.SearchHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"],\n \"category=UPDATE,scope=/update,name=org.apache.solr.handler.UpdateRequestHandler\" =>\n [\"95thPcRequestTime,99thPcRequestTime\"]\n }\n }\n return metric_type_to_solr_core_mbean_attr_map\n end",
"def metrics\n pods.outer_join(:github_pod_metrics).on(:id => :pod_id).join(:cocoadocs_pod_metrics).on(:id => :pod_id)\n end",
"def combineMetricOutputs(output)\r\n output[:allMetrics] = output.values.collect { |v| v[:metrics] if v.is_a?(Hash) }.compact.flatten << \"--End-Metrics--\"\r\n output[:allNames] = output.values.collect { |v| v[:metricsNames] if v.is_a?(Hash) }.compact.flatten << \"--End-Names--\"\r\n output[:allPasses] = output.values.collect { |v| v[:metricsPass] if v.is_a?(Hash) }.compact.flatten << \"--End-Passes--\"\r\n output[:allComments] = output.values.collect { |v| v[:metricsComments] if v.is_a?(Hash) }.compact.flatten << \"--End-Comments--\"\r\n output[:allUsages] = output.values.collect { |v| v[:metricsUsage] if v.is_a?(Hash) }.compact.flatten << \"--End-Usage--\"\r\n output[:allDataSources] = output.values.collect { |v| v[:dataSource] if v.is_a?(Hash) }.compact.flatten\r\n end",
"def record_metrics_internal(metric_specs, value, aux)\n tsh = transaction_stats_hash\n if tsh\n tsh.record(metric_specs, value, aux)\n else\n with_stats_lock do\n @stats_hash.record(metric_specs, value, aux)\n end\n end\n end",
"def metrics=(array=[])\n @metrics = array.map { |m| m.is_a?(Metric) ? m : Metric.by_key(m) }.compact\n end",
"def get_all_metrics()\n return nil unless Config.metrics\n f = Fiber.current\n resp = metrics.find().defer_as_a\n resp.callback do |doc|\n f.resume doc\n end\n resp.errback do |err|\n raise *err\n end\n docs = Fiber.yield\n # convert ids to int\n docs.collect{|doc| doc['_id'] = doc['_id'].to_i ; doc }\n end",
"def before_load\n data_class.rebuild_table\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def initialize(metrics)\n @metrics = metrics\n end",
"def setup_cassandra\n puts \"SETTING UP CASSANDRA...\"\n\n client = cassandra_client\n\n # Don't drop and recreate the keyspace as that might disrupt (debug) clients\n # client.execute('DROP KEYSPACE IF EXISTS measurements')\n puts \"> CREATING KEYSPACE\"\n begin\n client.use('measurements')\n rescue Cql::QueryError => e\n keyspace_definition = <<-KSDEF\n CREATE KEYSPACE measurements\n WITH replication = {\n 'class': 'SimpleStrategy',\n 'replication_factor': 1\n }\n KSDEF\n client.execute(keyspace_definition)\n client.use('measurements')\n rescue => e\n raise e\n ensure\n\n puts \"> DROPPING TABLES\"\n\n tables = [\n \"InstantaneousPlugLoads\",\n \"AveragePlugLoads\",\n \"AverageHouseLoads\",\n \"Globals\",\n \"Metrics\"\n ]\n\n tables.each do |table|\n begin\n client.execute(\"DROP TABLE IF EXISTS #{table}\")\n rescue Cql::QueryError => e\n # nop\n end\n end\n\n #\n # TABLES\n #\n\n puts \"> CREATING TABLES\"\n\n # slice_index is a convenience. It could be determined by timestamp.\n table_definition = <<-TABLEDEF\n CREATE TABLE InstantaneousPlugLoads (\n plug_id BIGINT,\n house_id BIGINT,\n household_id BIGINT,\n timestamp BIGINT,\n slice_index INT,\n load DOUBLE,\n PRIMARY KEY (house_id, household_id, plug_id, timestamp)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE AveragePlugLoads (\n plug_id BIGINT,\n house_id BIGINT,\n household_id BIGINT,\n slice_index INT,\n load DOUBLE,\n predicted BOOLEAN,\n PRIMARY KEY (house_id, household_id, plug_id, slice_index)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE AverageHouseLoads (\n house_id BIGINT,\n slice_index INT,\n load DOUBLE,\n predicted BOOLEAN,\n PRIMARY KEY (house_id, slice_index)\n )\n TABLEDEF\n client.execute(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE Globals (\n name VARCHAR,\n value VARCHAR,\n PRIMARY KEY (name)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE Metrics (\n name VARCHAR,\n when TIMESTAMP,\n value VARCHAR,\n PRIMARY KEY (name, when)\n )\n TABLEDEF\n client.execute(table_definition)\n\n #\n # INDEXES\n #\n\n puts \"> CREATING INDEXES\"\n\n index_definition = <<-INDEXDEF\n CREATE INDEX InstantaneousPlugLoadsSliceIndex ON\n InstantaneousPlugLoads\n (slice_index)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AveragePlugLoadsPredictedIndex ON\n AveragePlugLoads\n (predicted)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AveragePlugLoadsSliceIndex ON\n AveragePlugLoads\n (slice_index)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AverageHouseLoadsPredictedIndex ON\n AverageHouseLoads\n (predicted)\n INDEXDEF\n client.execute(index_definition)\n end\n client\n end",
"def test_segments_will_not_record_metrics_when_turned_off\n in_transaction do |txn|\n segment = basic_segment\n txn.add_segment(segment)\n segment.record_metrics = false\n segment.start\n advance_process_time(1.0)\n segment.finish\n end\n\n refute_metrics_recorded [basic_segment_name, BasicSegment::ALL_NAME]\n end",
"def recalculate_usage\n # For some reason, ANALYZE TABLE doesn't update statistics in Travis' environment\n ActiveRecord::Base.connection.execute(\"OPTIMIZE TABLE #{binding.database}.stuff\")\n end"
] | [
"0.6586173",
"0.6586173",
"0.6586173",
"0.61209255",
"0.59465355",
"0.58593833",
"0.585492",
"0.576403",
"0.57523715",
"0.5638309",
"0.5612975",
"0.5564316",
"0.55219185",
"0.5492186",
"0.54915804",
"0.5485196",
"0.54703665",
"0.54582983",
"0.543948",
"0.543948",
"0.5437299",
"0.54341847",
"0.5413738",
"0.5404198",
"0.54013264",
"0.53879595",
"0.53861",
"0.5385453",
"0.53802484",
"0.5364415",
"0.5363577",
"0.5302363",
"0.5295304",
"0.52844065",
"0.52633286",
"0.5233154",
"0.5222626",
"0.52180165",
"0.52155864",
"0.5203873",
"0.51952356",
"0.5190554",
"0.51829255",
"0.51645947",
"0.5155252",
"0.5150969",
"0.5148878",
"0.51372683",
"0.51334137",
"0.513096",
"0.5126585",
"0.51265824",
"0.51221377",
"0.51120496",
"0.5093034",
"0.5092404",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.50748545",
"0.5066799",
"0.5065904",
"0.5065452",
"0.5065452",
"0.5065452",
"0.5065452",
"0.50607955",
"0.5055304",
"0.50546247",
"0.50494206",
"0.5045285",
"0.5044267",
"0.50431037",
"0.5041649",
"0.50389594",
"0.5035741",
"0.5022322",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.501185",
"0.5010084",
"0.5004704",
"0.4996074",
"0.49947494"
] | 0.6014903 | 4 |
trying to set CORS response headers in controller actions | def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
headers['Access-Control-Allow-Headers'] = 'Content-Type'
headers['Access-Control-Max-Age'] = "1728000"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n end",
"def cors_set_access_control_headers\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control-Allow-Methods'] = 'GET, PUT, POST, DELETE, OPTIONS, PATCH'\n response.headers['Access-Control-Max-Age'] = \"1728000\"\n response.headers['Access-Control-Allow-Headers'] = 'X-CSRF-Token, X-Requested-With, X-Prototype-Version, content-type, ' + @token_name\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Headers'] = \"X-Requested-With,Content-Type,Accept,Origin\"\n headers['Access-Control-Expose-Headers'] = \"Location\"\nend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Headers'] = \"Content-Type\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token, Access-Token, locale, authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Authorization, Content-Type'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\nheaders['Access-Control-Allow-Origin'] = '*'\nheaders['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\nheaders['Access-Control-Max-Age'] = '1728000'\nend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def set_access_controller_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = '*'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With auth_token X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Expose-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Allow-Credentials'] = 'true'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Allow-Credentials'] = 'true'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\nend",
"def cors_set_access_control_headers\n # headers['Access-Control-Allow-Origin'] = 'http://' + request.host\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = \"Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Content-Length, Accept, Accept-Charset, Accept-Encoding, Referer\";\n end",
"def cors_set_access_control_headers\n \nheaders['Access-Control-Allow-Origin'] = '*'\n \nheaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \nend",
"def cors_set_access_control_headers\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS, PATCH'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization' \n end",
"def cors_set_access_control_headers\n \t\theaders['Access-Control-Allow-Origin'] = '*'\n\tend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\r\n headers['Access-Control-Allow-Origin'] = '*'\r\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\r\n headers['Access-Control-Max-Age'] = \"1728000\"\r\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = 'http://localhost:9000'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end",
"def cors_set_access_control_headers\n log_origin_access # TODO: Disable logging for GoLive. Log only requests for api-clients #41\n headers['Access-Control-Allow-Origin'] = allowed_client_origins\n headers['Access-Control-Allow-Methods'] = allowed_client_methods\n headers['Access-Control-Allow-Headers'] = allowed_headers\n headers['Access-Control-Max-Age'] = allowed_max_age\n end",
"def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST,GET,OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\t end",
"def cors_set_access_control_headers\n\t\theaders['Access-Control-Allow-Origin'] = '*'\n\t\theaders['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n\t\theaders['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n\t\theaders['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization, X-CSRF-Token'\n end",
"def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end",
"def add_cors_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors_allow_header\n { 'Access-Control-Allow-Origin' => '*' }\n end",
"def set_cors_headers\n if request.headers[\"HTTP_ORIGIN\"]\n # better way check origin\n # if request.headers[\"HTTP_ORIGIN\"] && /^https?:\\/\\/(.*)\\.some\\.site\\.com$/i.match(request.headers[\"HTTP_ORIGIN\"])\n headers['Access-Control-Allow-Origin'] = request.headers[\"HTTP_ORIGIN\"]\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Max-Age'] = '86400'\n headers['Access-Control-Allow-Credentials'] = 'true'\n end\n end",
"def cors_preflight\n head(:ok)\n end",
"def cors_set_access_control_headers\n \t\theaders['Access-Control-Allow-Origin'] = '*'\n \t\theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \t \theaders['Access-Control-Allow-Headers'] = '*'\n \t\theaders['Access-Control-Request-Method'] = '*',\n\t\theaders['Access-Control-Max-Age'] = \"1728000\"\n\tend",
"def cors\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'OPTIONS, POST, DELETE, GET, PUT'\n\t headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept'\n\t headers['Access-Control-Max-Age'] = '1728000'\n\tend",
"def cors\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers['Access-Control-Request-Method'] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = %w{GET POST PUT DELETE OPTIONS}.join(\",\")\n headers[\"Access-Control-Allow-Headers\"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(\",\")\n if request.method == 'OPTIONS'\n head(:ok)\n end\n end",
"def set_access_control_headers\n return unless request.headers[\"Origin\"]\n response.headers[\"Access-Control-Allow-Origin\"] = request.headers[\"Origin\"]\n response.headers[\"Access-Control-Allow-Headers\"] = 'Accept, Content-Type, X-Requested-With, X-Access-Token'\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n response.headers['Access-Control-Allow-Credentials'] = 'false'\n response.headers['Access-Control-Max-Age'] = '86400'\n end",
"def cors\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n\n render text: '', content_type: 'text/plain'\n end",
"def cors_header\n origin = request.headers['Origin']\n if ENV['RAILS_ENV'] == 'production'\n headers[\"Access-Control-Allow-Origin\"] = origin if check_origin origin\n else\n headers[\"Access-Control-Allow-Origin\"] = origin unless origin.nil? # always pass if testing\n end\n headers[\"Access-Control-Allow-Methods\"] = \"GET,PUT,PATCH,POST,DELETE\"\n headers[\"Access-Control-Allow-Credentials\"] = \"true\"\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Content-Type'\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = \"*\"\n headers['Access-Control-Request-Method'] = %w{GET POST OPTIONS}.join(\",\")\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = '*'\n end",
"def cors_preflight_check\nheaders['Access-Control-Allow-Origin'] = '*'\nheaders['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\nheaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\nheaders['Access-Control-Max-Age'] = '1728000'\nend",
"def cors_header_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def options\n head :status => 200, :'Access-Control-Allow-Headers' => 'accept, content-type'\n end",
"def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, GET, PUT, OPTIONS, DELETE',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n #headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match'\n #headers['Access-Control-Max-Age'] = '86400'\n end",
"def set_access_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end",
"def response_headers(env)\n cors_origin(env) ? cors_headers(env) : {}\n end",
"def options_response\n render :nothing => true, :status => 200\n\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control-Max-Age'] = '86400' # 24 hours\n response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept'\n end",
"def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1000'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = '*'\n end",
"def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Credentials'] = true\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Content-Type, X-Experience-API-Version,Authorization,X-Requested-With, X-Prototype-Version, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end",
"def cors_handling\n if request.method == \"OPTIONS\"\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n response.headers['Access-Control-Allow-Headers'] = '*'\n response.headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end"
] | [
"0.76698726",
"0.7661982",
"0.7609696",
"0.7580956",
"0.7580956",
"0.7580956",
"0.7577397",
"0.7558065",
"0.75501055",
"0.75398964",
"0.75217545",
"0.7520277",
"0.7519073",
"0.7519073",
"0.7519073",
"0.751607",
"0.75038254",
"0.75001",
"0.7485436",
"0.7483834",
"0.7483834",
"0.7480151",
"0.7480151",
"0.74762046",
"0.7471444",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.7470284",
"0.74675494",
"0.7464696",
"0.7441351",
"0.7434111",
"0.74305737",
"0.7429604",
"0.74281716",
"0.74281716",
"0.74258494",
"0.7424892",
"0.7419042",
"0.7415472",
"0.7405608",
"0.7405608",
"0.74036103",
"0.7401853",
"0.74017483",
"0.7399615",
"0.7398174",
"0.73887926",
"0.73887926",
"0.73887926",
"0.737846",
"0.73758364",
"0.73752123",
"0.73570925",
"0.7350308",
"0.7332465",
"0.73266983",
"0.73266983",
"0.73266983",
"0.728997",
"0.7279039",
"0.7232428",
"0.7195383",
"0.7194503",
"0.71927524",
"0.71194077",
"0.71073234",
"0.71007746",
"0.70857304",
"0.706969",
"0.703067",
"0.7012443",
"0.70078766",
"0.70071703",
"0.69937706",
"0.69709086",
"0.6968489",
"0.6964937",
"0.69586253",
"0.6946526",
"0.69459176",
"0.6919418",
"0.69164973"
] | 0.7560409 | 7 |
GET /events GET /events.json | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def events\n data[\"events\"]\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def show\n render json: @event, status: :ok\n end",
"def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def events\n collection(\"events\")\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def past_events\n @events = Event.past\n render json: @events, include: :talks\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end",
"def show\n \trender json: @event\n end",
"def show\n @events = fetch_events\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end",
"def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\n render json: @events\n end",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end",
"def show\n @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end",
"def show\n render json: format_event(@event)\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\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 @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end"
] | [
"0.8337294",
"0.82393",
"0.7943906",
"0.7928331",
"0.77682066",
"0.77408546",
"0.76701826",
"0.7665501",
"0.76581633",
"0.7642472",
"0.76212007",
"0.7615658",
"0.7615658",
"0.7612881",
"0.75687",
"0.7522498",
"0.7488667",
"0.74813455",
"0.74698067",
"0.7441679",
"0.74408287",
"0.7439104",
"0.7438",
"0.7410777",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74001324",
"0.73986024",
"0.73760885",
"0.7367902",
"0.7366312",
"0.7364237",
"0.7363436",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73592705",
"0.7352217",
"0.7334486",
"0.73247266",
"0.7320335",
"0.72969604",
"0.72951084",
"0.7288287",
"0.7282072",
"0.72735256",
"0.72733235",
"0.72477293",
"0.7245006",
"0.7228475",
"0.7228475",
"0.72234964",
"0.72129667",
"0.72124153",
"0.7182632",
"0.71820146",
"0.71711934",
"0.71332264",
"0.712864",
"0.7123786",
"0.7122708",
"0.7114666",
"0.7110134",
"0.7110134",
"0.7104194",
"0.71022034",
"0.7101582",
"0.7101437",
"0.7099895",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326"
] | 0.0 | -1 |
POST /events POST /events.json | def create
# app_owner = params['app_owner']
# puts "*** #{params[app_owner]}"
# puts "*** #{params['app_owner']}"
# user = User.find_by_email(app_owner)
# user.events.create!(event_params)
# blocmetrics.track("some event name", {property_1: "some value", property_2: "some other value"})
# {"name"=>"Page Views", "application"=>"Bloccit", "topic_name"=>"officiis enim laboriosam quibusdam aperiam qui voluptatum et iusto", "app_user"=>"4", "app_owner"=>"douglaswalter2@gmail.com", "event"=>{"name"=>"Page Views"}}
Rails.logger.info(">>>>>>>>>This is in heroku")
@event = Event.create(name: params[:name], property_1: params[:topic_name], property_2: params[:app_owner])
Rails.logger.info ">>>>>> #{@event.inspect}"
Rails.logger.info ">>>>> #{params.inspect}"
respond_to do |format|
format.json { head :ok }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n megam_rest.post_event(to_hash)\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end",
"def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end",
"def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end",
"def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_events\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036",
"0.7081109",
"0.7080767",
"0.7071589",
"0.7057984",
"0.70422375",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7016941",
"0.70167124",
"0.70091015",
"0.70081246",
"0.6989661",
"0.6987218",
"0.6970633",
"0.6970633",
"0.6966775",
"0.6948742",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6942416",
"0.6936477",
"0.69359535",
"0.69359535",
"0.69318086",
"0.69268054",
"0.6907236",
"0.6905569",
"0.69051725",
"0.6904514",
"0.6902843",
"0.69011873",
"0.6899826",
"0.68961006",
"0.68811166",
"0.68746495",
"0.68642014",
"0.68642014",
"0.6843213",
"0.68419445",
"0.6836244",
"0.68352246",
"0.6820027",
"0.68000513",
"0.6791519"
] | 0.0 | -1 |
GET /product_groups/1 GET /product_groups/1.json | def show
@product_group = ProductGroup.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @product_groups = ProductGroup.all\n end",
"def index\n @product_product_groups = ProductProductGroup.all\n end",
"def index\n render json: ProductAuth.where({group_id: params[:group_id]})\n end",
"def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id]).pluck(:group_id)\n @groups = Group.where(id: @groups)\n render json: @groups\n end",
"def new\n @product_group = ProductGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_group }\n end\n end",
"def index\n @group_products = GroupProduct.all\n end",
"def get_groups\n @course = Course.find(params[:course_id])\n render json: @course.groups\n end",
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def show\n @item_group = ItemGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_group }\n end\n end",
"def show\n render json: @group\n end",
"def showgrp\n @grp = params[:id].to_s\n @groups=Group.where(\"kls_parent=\"+@grp).order(\"name asc\")\n render json: @groups\n end",
"def show\n @logical_product = LogicalProduct.find(params[:id])\n @variable_groups = @logical_product.variable_groups\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logical_product }\n end\n end",
"def show\n group = Group.find(params[:id])\n\n render json: group\n end",
"def show_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend",
"def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"def show\n @pgroup = Pgroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def show\n @pgroup = Pgroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n format.json { render json: @groups }\n end\n end",
"def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end",
"def all\n\n res=[]\n buf={}\n @groups = Group.where('kls_parent=1613').order(\"NAME ASC\").each do |grp|\n\t if grp.products.exists?\n buf={}\n\t\tbuf[:name] = grp.name\n\t\tbuf[:id] = grp.id\n\t\tbuf[:kls_parent] = grp.kls_parent\n\t\tbuf[:kls_unicode] = grp.kls_unicode\n\t\tbuf[:kls_childcount] = grp.kls_childcount\n \t res.push(buf)\n\t end\n end\n # @rgroups = @group\n# @groups = Group.where('kls_parent=1613')\n# render json: @groups\n render json: res\n\n end",
"def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def index\n @groups = Group.all\n render_json_serializer(@groups)\n end",
"def index\n @groups = current_user.groups\n render json: @groups\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end",
"def index\n @groups_with_el = Provider.pluck(:group_id).uniq - [nil, 0]\n \n @groups = Provider.where(is_group: true).order(:name).map{|g| {\n id: g.id, \n name: g.name,\n spec: g.spec,\n allow_delete: !@groups_with_el.include?(g.id),\n goods_types_array: g.goods_type_names_array.join(', ')\n }}\n\n store_providers_path\n end",
"def index\n @groups = Group.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def show\n @group = Group.find(params[:id])\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render :json => @group}\n end\n end",
"def index\n @title = \"Группы характеристик\"\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @item_groups = ItemGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_groups }\n end\n end",
"def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end",
"def show\n respond_with @project do |format|\n format.json { render json: decorate_group(@group) }\n end\n end",
"def show\n @image_group = ImageGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_group }\n end\n end",
"def get_group\n @group = Group.find(params[:id])\n end",
"def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end",
"def index\n @products_grupos = ProductsGrupo.all\n end",
"def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end",
"def index\n @pgroups = Pgroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pgroups }\n end\n end",
"def show\n objid = params[:id]\n obj = ManagingGroup.find_by_id(objid)\n if obj\n render json: {managing_group: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end",
"def show\n #@group = Group.find(params[:id])\n \n @users = @group.users\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def show\n @title = \"Группа характеристик\"\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def index\n @food_products = FoodProduct.where(group_id: @groups)\n end",
"def product_groups\n @product_groups ||= ProductGroupProxy.new(self)\n end",
"def index\n @groups = current_user.groups\n @groups = @groups.where('name LIKE ?', \"%#{params[:q]}%\") if params[:q].present?\n @groups = current_user.groups_sorted_by_admin_state_and_name(@groups)\n @groups_pictures = Group.group_images_hash_for_groups @groups\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @groups }\n end\n end",
"def index\n objs = ManagingGroup.all.order(:position)\n if objs\n render json: {managing_groups: objs}, status: 200\n else\n render json: {}, status: 500\n end\n rescue => error\n render json: {}, status: 500\n end",
"def create\n @product_group = ProductGroup.new(params[:product_group])\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: 'Product group was successfully created.' }\n format.json { render json: @product_group, status: :created, location: @product_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @esol_group = EsolGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @esol_group }\n end\n end",
"def destroy\n @product_group = ProductGroup.find(params[:id])\n @product_group.destroy\n\n respond_to do |format|\n format.html { redirect_to product_groups_url }\n format.json { head :no_content }\n end\n end",
"def fetch_group\n @group = Group.find(params[:group_id])\n end",
"def show\n #logger.info \"GroupsController Get Parameters: #{params}\"\n if @group\n render json: @group.to_json(:include => {:memberships => {:only => [:admin], :include => {:user => {:only => [:id, :first_name, :last_name, :email]}}}})\n else\n render json: {error: \"YOU MUST BE MEMBER OF THIS GROUP TO SEE IT\"}, status: :unprocessable_entity\n end\n end",
"def getGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/group\",params)\n end",
"def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_group }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_with @project do |format|\n format.json { render json: decorate_groups }\n end\n end",
"def index\n\n respond_to do |format|\n format.html {\n @search = ProductTreeGroup.search(params[:search])\n @product_tree_groups = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n }\n format.json { \n render json: ProductTreeGroup.select(\"id, name as text\").to_json\n }\n end\n end",
"def set_product_group\n @product_group = ProductGroup.find(params[:id])\n end",
"def retrieve_group\n @group = Group.find(params[:group_id])\n end",
"def get_groups(params)\n send_get \"get_groups\", params\n end",
"def set_group_product\n @group_product = GroupProduct.find(params[:id])\n end",
"def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end",
"def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end",
"def unit_show\n @product = Product.find(params[:id])\n\n @store_cust_group = CustomerGroup.find_by_name(\"Bakul/Toko\")\n @workshop_cust_group = CustomerGroup.find_by_name(\"Bengkel/Montir\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n authorize Group\n render :json => @group.group_memberships\n end",
"def belonging_groups\n contact_groups = []\n @contact.contact_groups.each do |group|\n contact_groups << { _id: group['_id'].to_s, lbl: group['label'] }\n end\n\n respond_to do |format|\n format.js {}\n format.json { render json: contact_groups }\n end\n end",
"def index\n\n @groups = Group.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n format.json { render :json => @groups }\n end\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end",
"def show\n @groupaddrobj = Groupaddrobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groupaddrobj }\n end\n end",
"def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end",
"def show\n @subscription_group = SubscriptionGroup.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @subscription_group }\n end\n end",
"def new\n @item_group = ItemGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_group }\n end\n end",
"def new\n @group = Group.new\n render json: @group\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def products_aggregate\n quantities = GroupBoxContent.sum(:quantity,group: :product_id)\n quantities.delete_if {|key, value| value == 0 } \n\n products = Product.find(quantities.keys)\n @products_quantities = {}\n products.each do |product|\n @products_quantities[product] = quantities[product.id]\n end\n\n respond_to do |format|\n format.html # products_aggregate.html.erb\n format.json { render json: @groups }\n end\n end",
"def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n render :json => Group.find(:all).map{|g| g}\n else\n render :json => @user.groups.map{|g| g}\n end\n end",
"def set_products_grupo\n @products_grupo = ProductsGrupo.find(params[:id])\n end",
"def get_nodegroups()\n nodemgr_rest_call(\"GET\", \"classifier\", \"groups\", $credentials)\nend",
"def group_items\n @group_items ||= Product.includes(:pictures)\n .where(group: group.presence || '_ZZZZ_', active: true, hidden: false)\n .order(:option_sort, :option_title)\n end",
"def show\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def show\n @grocery_groups = @grocery.groups\n end",
"def show_group\r\n show_group_by_id()\r\n end",
"def create\n @product_product_group = ProductProductGroup.new(product_product_group_params)\n\n respond_to do |format|\n if @product_product_group.save\n format.html { redirect_to @product_product_group, notice: 'Product product group was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_group }\n else\n format.html { render :new }\n format.json { render json: @product_product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @group_items = GroupItem.all\n end",
"def show_group(id)\n get(\"groups/#{id}\")\n end",
"def show\n @group = Group.find(params[:id])\n\n render json: @group.to_json(:include => {:memberships => {:only => [:admin], :include => {:user => {:only => [:id, :first_name, :last_name, :email]}}}})\n end",
"def index\n\n\t\t@groups = Group.find_paginate({:user=> current_user, :page => params[:page], :query => params[:query], :sort => params[:sort], :nb_items => get_nb_items(params[:nb_items]) })\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @groups }\n\t\t\tformat.json { render :json => @groups }\n\t\tend\n\tend",
"def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end"
] | [
"0.7469453",
"0.7381799",
"0.7266036",
"0.7241326",
"0.7148794",
"0.7009119",
"0.7007086",
"0.69642437",
"0.6889603",
"0.6879488",
"0.68774074",
"0.68574584",
"0.6847752",
"0.68304884",
"0.6828815",
"0.6793829",
"0.6793829",
"0.67805314",
"0.6775832",
"0.676863",
"0.6768066",
"0.67386776",
"0.67386776",
"0.669678",
"0.66930693",
"0.6673979",
"0.6672487",
"0.666784",
"0.6657936",
"0.6657936",
"0.66542107",
"0.6630396",
"0.6619535",
"0.65986735",
"0.65664333",
"0.6560088",
"0.65422064",
"0.6532742",
"0.65195495",
"0.6509916",
"0.6506693",
"0.64982",
"0.6496617",
"0.64934987",
"0.64820683",
"0.6460206",
"0.64183426",
"0.64038116",
"0.64024174",
"0.6396005",
"0.63932335",
"0.6389005",
"0.63821816",
"0.6378692",
"0.637845",
"0.63663554",
"0.63597816",
"0.6351913",
"0.63511926",
"0.63335603",
"0.6320083",
"0.6317241",
"0.63091123",
"0.6295393",
"0.6294154",
"0.62924707",
"0.6289346",
"0.62885094",
"0.6288307",
"0.6285342",
"0.6269378",
"0.62687755",
"0.6268314",
"0.62641335",
"0.62640285",
"0.6251905",
"0.6251507",
"0.6247948",
"0.6244268",
"0.6236956",
"0.62276536",
"0.6218852",
"0.6218641",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.6215376",
"0.62081003",
"0.6193837",
"0.6189941",
"0.61866564",
"0.61839265"
] | 0.7738448 | 0 |
GET /product_groups/new GET /product_groups/new.json | def new
@product_group = ProductGroup.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @group = Group.new\n render json: @group\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @title = \"Добавление группы характеристик\"\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @product_tree_group = ProductTreeGroup.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_tree_group }\n end\n end",
"def new\n @item_group = ItemGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def create\n @product_group = ProductGroup.new(params[:product_group])\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: 'Product group was successfully created.' }\n format.json { render json: @product_group, status: :created, location: @product_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def new\n @groupaddrobj = Groupaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupaddrobj }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n #format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group_request = GroupRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group_request }\n end\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @group = SuperSimpleCms::Group.new\n\n respond_to do |format|\n format.html {render :template=>'admin/groups/new'}\n format.js {render :template=>'admin/groups/new', :layout=>false}\n format.xml { render :xml => @group }\n end\n end",
"def new #:nodoc:\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n # format.xml { render :xml => @group }\n end\n end",
"def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_group }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = GROUP.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @breadcrumb = 'create'\n @ratio_group = RatioGroup.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ratio_group }\n end\n end",
"def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def new\n @esol_group = EsolGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @esol_group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @group_record = GroupRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_record }\n end\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def create\n @product_product_group = ProductProductGroup.new(product_product_group_params)\n\n respond_to do |format|\n if @product_product_group.save\n format.html { redirect_to @product_product_group, notice: 'Product product group was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_group }\n else\n format.html { render :new }\n format.json { render json: @product_product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n add_breadcrumb \"Social\", social_path()\n add_breadcrumb \"Create group\"\n \n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @groupon = Groupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupon }\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def new\n @group.parent_id = params[:group_id]\n \n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n unless params[:group_id]\n add_breadcrumb 'New group', new_hub_group_path(@hub)\n else\n add_breadcrumb 'New sub group', hub_group_subgroup_path(@hub, @group.parent)\n end\n \n append_title 'New group'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @group_product = GroupProduct.new(group_product_params)\n\n respond_to do |format|\n if @group_product.save\n format.html { redirect_to @group_product, notice: 'Group product was successfully created.' }\n format.json { render :show, status: :created, location: @group_product }\n else\n format.html { render :new }\n format.json { render json: @group_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @prefix_group = PrefixGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefix_group }\n format.js { render :layout => false }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n #format.html # new.html.erb\n #format.xml { render :xml => @group }\n format.js { render :action => 'new' }\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def new\n @group = Group.new(:owner => current_user)\n authorize @group, :new?\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @category = Category.new\n @category_group = CategoryGroup.find_by_id(params[:category_group_id]) if params[:category_group_id]\n respond_to do |format|\n format.html { render template:'categories/new', layout:'minimal' }\n format.json { render json: @category }\n end\n end",
"def new\n @group = current_user.created_groups.new\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @connection_group = ConnectionGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @connection_group }\n end\n end",
"def new\n @group = Group.new\n # @group_user = @current_user.join_group(@group)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_user }\n end\n end",
"def new\n @subscription_group = SubscriptionGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscription_group }\n end\n end",
"def new\n @size_group = SizeGroup.new\n @product = Product.find(params[:product_id].to_i) if params.has_key? :product_id\n\n render :partial => 'new', :object => @size_group\n end",
"def new\n @add_to_group = AddToGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_to_group }\n end\n end",
"def new\n @group = Group.new\n @title = 'Create Group'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @register_group = RegisterGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @register_group }\n end\n end",
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def new\n @group = Group.new \n end",
"def new\n @fun_group = FunGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fun_group }\n end\n end",
"def new\n @reagent_group = ReagentGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reagent_group }\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @questionnaire_group = QuestionnaireGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire_group }\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group_map = GroupMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_map }\n end\n end",
"def new\n @closed_group = ClosedGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closed_group }\n end\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group_mag = GroupMag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_mag }\n end\n end",
"def new\n @group_member = GroupMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_member }\n end\n end",
"def new\n @pack_group_dispatch = PackGroupDispatch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pack_group_dispatch }\n end\n end",
"def new\n @yeargroup = Yeargroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yeargroup }\n end\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def new\n @title = \"Добавление возрастной группы\"\n @age_group = AgeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @age_group }\n end\n end",
"def new\n @attribute_group = AttributeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attribute_group }\n end\n end",
"def new\n @deptgroup = Deptgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deptgroup }\n end\n end",
"def new\n @group_area = GroupArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_area }\n end\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end"
] | [
"0.77525693",
"0.77437204",
"0.77248377",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7654325",
"0.76500785",
"0.76500785",
"0.7637246",
"0.7637246",
"0.7630681",
"0.76269585",
"0.7613564",
"0.76000494",
"0.75543183",
"0.74896204",
"0.7448076",
"0.7448076",
"0.74278766",
"0.741514",
"0.7412447",
"0.7412447",
"0.73918086",
"0.73851204",
"0.73603135",
"0.73420554",
"0.732296",
"0.73227465",
"0.73156995",
"0.7304411",
"0.7270756",
"0.7260563",
"0.7232993",
"0.7219088",
"0.7217536",
"0.7216429",
"0.72063106",
"0.7205815",
"0.72020274",
"0.7189769",
"0.7149101",
"0.71392053",
"0.7122458",
"0.71096313",
"0.71078616",
"0.7084965",
"0.70843035",
"0.706396",
"0.70616233",
"0.7052455",
"0.7048998",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.70310575",
"0.7027598",
"0.7016965",
"0.7012688",
"0.7012672",
"0.70071435",
"0.699086",
"0.6986002",
"0.6983471",
"0.69830674",
"0.6960047",
"0.6955068",
"0.69526494",
"0.69523126",
"0.69519264",
"0.69519264",
"0.69519264",
"0.69519264",
"0.69519264",
"0.69503003",
"0.6946951",
"0.69451475",
"0.6944722",
"0.6937241",
"0.6932702",
"0.692009",
"0.69070625",
"0.69054955",
"0.6904264",
"0.68946874",
"0.6891191",
"0.68888986",
"0.6888164",
"0.6886592",
"0.6886592"
] | 0.8207227 | 0 |
POST /product_groups POST /product_groups.json | def create
@product_group = ProductGroup.new(params[:product_group])
respond_to do |format|
if @product_group.save
format.html { redirect_to @product_group, notice: 'Product group was successfully created.' }
format.json { render json: @product_group, status: :created, location: @product_group }
else
format.html { render action: "new" }
format.json { render json: @product_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_group }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_product_group = ProductProductGroup.new(product_product_group_params)\n\n respond_to do |format|\n if @product_product_group.save\n format.html { redirect_to @product_product_group, notice: 'Product product group was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_group }\n else\n format.html { render :new }\n format.json { render json: @product_product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_product = GroupProduct.new(group_product_params)\n\n respond_to do |format|\n if @group_product.save\n format.html { redirect_to @group_product, notice: 'Group product was successfully created.' }\n format.json { render :show, status: :created, location: @group_product }\n else\n format.html { render :new }\n format.json { render json: @group_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product_group\n ProductGroup.create(:group_id => self.group_id, :product_id => self.product_id)\n return true\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @product_tree_group = ProductTreeGroup.new product_tree_group_params\n\n respond_to do |format|\n if @product_tree_group.save\n format.html { redirect_to admin_product_tree_group_path(@product_tree_group), notice: '产品新建成功.' }\n format.json { render json: @product_tree_group, status: :created, location: @product_tree_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_tree_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n @feature_group = FeatureGroup.new(feature_group_params)\n @product = Product.find(params[:product_id])\n @feature_group.product_id = @product.id\n respond_to do |format|\n if @feature_group.save\n format.html { redirect_to @product, notice: 'Feature group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feature_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @feature_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def product_group_params\n params.require(:product_group).permit(:name, :title)\n end",
"def new\n @product_group = ProductGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_group }\n end\n end",
"def product_product_group_params\n params.require(:product_product_group).permit(:product_id, :product_group_id)\n end",
"def create\n @products_grupo = ProductsGrupo.new(products_grupo_params)\n\n respond_to do |format|\n if @products_grupo.save\n format.html { redirect_to @products_grupo, notice: 'Products grupo was successfully created.' }\n format.json { render :show, status: :created, location: @products_grupo }\n else\n format.html { render :new }\n format.json { render json: @products_grupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end",
"def create\n @group = Group.new(group_params)\n @group.create_robotsurvey()\n @group.create_signupsurvey()\n @group.create_poststudysurvey()\n respond_to do |format|\n if @group.save\n \n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @group_model.new(group_params)\n respond_to do |format|\n if @group.save\n @course.groups<< @group\n format.html { redirect_to course_group_path(@course,@group), notice: \"#{@group_model.to_s} was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def create\n @pgroup = Pgroup.new(params[:pgroup])\n\n respond_to do |format|\n if @pgroup.save\n format.html { redirect_to @pgroup, notice: 'Pgroup was successfully created.' }\n format.json { render json: @pgroup, status: :created, location: @pgroup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pgroup = Pgroup.new(params[:pgroup])\n\n respond_to do |format|\n if @pgroup.save\n format.html { redirect_to @pgroup, notice: 'Pgroup was successfully created.' }\n format.json { render json: @pgroup, status: :created, location: @pgroup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_group= Vger::Resources::Suitability::ItemGroup.new(params[:item_group])\n respond_to do |format|\n if @item_group.save\n format.html { redirect_to suitability_item_group_path(@item_group), notice: 'Suitability Item Group was successfully created.' }\n format.json { render json: @item_group, status: :created, location: @item_group}\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Course.groups.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(path, name)\n puts \"creating #{name} on path #{path}\"\n \n ret = RestClient.post \"#{@url}/groups\", \n { path: path, name: name }, \n { \"Private-Token\": @token } \n json = JSON.parse(ret.body)\n\n json['id']\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def products_grupo_params\n params.require(:products_grupo).permit(:code, :name, :user_id)\n end",
"def create\n @group = Group.new(params[:group])\n new_sort = Configurations.get_sort('group')\n @group.sort = new_sort\n @group.deleted = 0\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to :groups, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n respond_to do |format|\n if @group.save\n\tUserGroup.create(admin: true, user_id: current_user.id, group_id: @group.id)\n\tflash[:success] = \"Group was successfully created!\"\n format.html { redirect_to @group }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group\n\t\t@group = Group.new(params[:group])\n\t\t@group.cardsort_id = params[:cardsort_id]\n\t\trespond_to do |format|\n\t\t\tif (@group.save)\n\t\t\t\tformat.js {render \"new_group\", :status => :created}\n\t\t\telse\n\t\t\t\tformat.js {render \"new_group\", :status => :ok}\n\t\t\tend\n\t\tend\n\tend",
"def postEntityGroup( entity_id, group_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n return doCurl(\"post\",\"/entity/group\",params)\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Le groupe a été créé.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @esol_group = EsolGroup.new(params[:esol_group])\n\n respond_to do |format|\n if @esol_group.save\n format.html { redirect_to @esol_group, notice: 'Esol group was successfully created.' }\n format.json { render json: @esol_group, status: :created, location: @esol_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @esol_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection_group = CollectionGroup.new(collection_group_params)\n\n respond_to do |format|\n if @collection_group.save\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.user = @user\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Group.new(group_params)\n\n respond_to do |format|\n if @resource.save\n index\n\n flash[:success] = t('notices.saved_successfully')\n format.html { redirect_to @resource, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @membership = Membership.create!(group_id: @group.id, user_id: current_user.id, admin: true)\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @equipment_group = EquipmentGroup.new(equipment_group_params)\n\n respond_to do |format|\n if @equipment_group.save\n format.html { redirect_to @equipment_group, notice: 'Equipment group was successfully created.' }\n format.json { render :show, status: :created, location: @equipment_group }\n else\n format.html { render :new }\n format.json { render json: @equipment_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate(groups)\n groups_params = groups.inject({}) do |params, (k, v)|\n params[\"groups[#{k}]\"] = 1\n params\n end\n\n response = RouteNGN.put self.class.base_url, {:id => self.id}.merge!(groups_params)\n response.success?\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Новая группа создана!' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @product_product_groups = ProductProductGroup.all\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n format.js\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @user = current_user\n @group = Group.new(group_params)\n @group.save\n respond_with(@group)\n end",
"def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @product_groups = ProductGroup.all\n end",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'Usergroup was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device_group = DeviceGroup.new(device_group_params)\n\n respond_to do |format|\n if @device_group.save\n format.html { redirect_to @device_group, notice: 'Device group was successfully created.' }\n format.json { render :show, status: :created, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n else\n format.html { render :new }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n end\n end\n end",
"def create\n @group_item = GroupItem.new(group_item_params)\n\n respond_to do |format|\n if @group_item.save\n format.html { redirect_to @group_item, notice: 'Group item was successfully created.' }\n format.json { render :show, status: :created, location: @group_item }\n else\n format.html { render :new }\n format.json { render json: @group_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #redirect_to new_grouping_path if params[:grouping][:name] == ''\n #@grouping = Grouping.new(params[:grouping])\n @grouping.company_id = current_user.company_id\n\n if @grouping.save\n gflash :success => 'Group created.' \n else\n @users = []\n @root = false\n end\n \n #redirect_to edit_grouping_path(@grouping)\n respond_with(@grouping)\n end",
"def new\n @product_tree_group = ProductTreeGroup.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_tree_group }\n end\n end",
"def create\n @group = Group.new(group_params)\n token = params[:token]\n\n # use the user login instance and match emails to find current user\n @user_login = UserLogin.where(token: token).take\n @current_user = User.where(email: @user_login.email).take\n\n respond_to do |format|\n if @group.save\n\n # create a new group membership for new group w/ current user as admin\n @new_membership = GroupMembership.create(group_id: @group.id, user_id: @current_user.id, is_admin: true)\n\n # associate new membership with the group and the user\n @group.group_memberships << @new_membership\n @current_user.group_memberships << @new_membership\n\n format.html { redirect_to group_path(:id => @group.id), notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'User group was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questionnaire_group = QuestionnaireGroup.new(params[:questionnaire_group])\n\n respond_to do |format|\n if @questionnaire_group.save\n format.html { redirect_to @questionnaire_group, notice: 'Questionnaire group was successfully created.' }\n format.json { render json: @questionnaire_group, status: :created, location: @questionnaire_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new(customers_group_params)\n\n respond_to do |format|\n if @customers_group.save\n format.html { redirect_to @customers_group, notice: t('view.customers_groups.correctly_created') }\n format.json { render json: @customers_group, status: :created, location: @customers_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @customers_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new(customers_group_params)\n\n respond_to do |format|\n if @customers_group.save\n format.html { redirect_to @customers_group, notice: t('view.customers_groups.correctly_created') }\n format.json { render json: @customers_group, status: :created, location: @customers_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @customers_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:success] = \"Группа успешно добавлена.\"\n format.html { redirect_to @group }\n format.json { render json: @group, status: :created, location: @group }\n else\n flash.now[:error] = \"Группа с таким названием не может быть добавлена!\"\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @order = @user.order.new(order_params)\n respond_to do |format|\n if @order.save\n group_params['group_ids'].each do |g|\n gu = GroupUser.where(group_id: g)\n gu.each do |u|\n @u = User.find(u.user_id)\n @u.orders << Order.find(@order.id)\n end\n end\n\n format.html { redirect_to orders_path, 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 create\n @plant_group = PlantGroup.new(plant_group_params)\n\n respond_to do |format|\n if @plant_group.save\n format.html { redirect_to @plant_group, notice: 'Plant group was successfully created.' }\n format.json { render :show, status: :created, location: @plant_group }\n else\n format.html { render :new }\n format.json { render json: @plant_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @producer = Producer.new(params[:producer])\n @producer.update_attributes(:active => \"1\", :is_deleted => \"0\")\n\n\n @groupings = Grouping.all\n grouping_ids = params[:grouping_ids] if params[:grouping_ids] \n grouping_ids ||= []\n @producer.grouping_ids = grouping_ids\n\n @kinds = Kind.all\n kind_ids = params[:kind_ids] if params[:kind_ids] \n kind_ids ||= []\n @producer.kind_ids = kind_ids\n\n @producer.company_id = current_user.company_id\n\n respond_to do |format|\n if @producer.save\n grouping_ids.each do |id|\n grouping_code = params[:grouping_code]\n code = grouping_code['grouping_'+id]\n gc = GroupingsProducer.where(:grouping_id => id, :producer_id => @producer.id).first\n if gc.nil?\n GroupingsProducer.create(:grouping_id => id, :producer_id => @producer.id, :code => code) \n else\n gc.code = code\n gc.save\n end\n end\n\n format.html { redirect_to producers_path, notice: \"El productor #{@producer.name} fue creado exitosamente.\" }\n format.json { render json: @producer, status: :created, location: @producer }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @producer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subscription_group = SubscriptionGroup.new(params[:subscription_group])\n @subscription_group.user_id = current_user.id\n respond_to do |format|\n if @subscription_group.save\n format.json { render json: @subscription_group, status: :created, location: @subscription_group }\n else\n format.json { render json: @subscription_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_product_group\n @product_group = ProductGroup.find(params[:id])\n end",
"def create\n @request_group = RequestGroup.new(request_group_params)\n\n respond_to do |format|\n if @request_group.save\n format.html { redirect_to @request_group, \n\t\t\t\t\t\t\t\t\t\t\tnotice: 'Request group was successfully created.' }\n format.json { render action: 'show', status: :created, \n\t\t\t\t\t\t\t\t\t\t\tlocation: @request_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @request_group.errors, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_order = GroupOrder.new(group_order_params)\n\n respond_to do |format|\n if @group_order.save\n format.html { redirect_to group_orders_path, notice: 'Group order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group_order }\n else\n format.html { render action: 'new' }\n format.json { render json: @group_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_group = SalesGroup.new(sales_group_params)\n\n respond_to do |format|\n if @sales_group.save\n format.html { redirect_to @sales_group, notice: 'Sales group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sales_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @sales_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n @group.group_locales = []\n\n params[:group_locales].each do |locale, values|\n @group.group_locales << GroupLocale.new(:locale => Locale.new(values), :group => @group)\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n format.xml { render xml: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n format.xml { render xml: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def add_to_group\n if request.post?\n @user_id = params[:user_id]\n @group = params[:group_ids]\n @created_g_u= Array.new\n @group.each do |g|\n #g_user = GroupUser.find(:all,:conditions=>[\"user_id=#{@user_id.to_i} and group_id=#{g.to_i}\"])\n group_user = GroupUser.create(:user_id=>@user_id.to_i,:group_id=>g.to_i)# if g_user.blank?\n @created_g_u << group_user if group_user.id\n end\n @notice = \"Successfully added to group.\"\n respond_to do |format|\n format.js\n end\n \n else\n render :partial=>\"add_to_group_form\", :locals=>{:user=>@login_user,:user_id=>params[:id]}, :layout=>false\n end\n end",
"def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end",
"def create_group(groupname)\n current_path = '/api/v1/groups'\n payload = { 'group_name' => groupname }.to_json\n @conn.post(current_path, payload)\n end",
"def create\n\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n\n @course = Course.find([@group.course_id]).first\n\n @course.cfolders.each do |cfolder|\n gfolder = @group.gfolders.create(name: cfolder.name, group_id: @group.id)\n cfolder.cposts.each do |cpost|\n gpost = gfolder.gposts.create(title: cpost.id, body: cpost.body, link: cpost.link, gfolder_id: gfolder.id)\n end\n end\n\n format.html { redirect_to [@group], notice: 'group was successfully created.' }\n format.json { render :show, status: :created, location: [@group] }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n new_group = @@data_util.hash_data_to_upper_case(@@data_util.strip_hash_data(params[:dept_group]), ['description'])\n new_group[:mypclient_id] = session[:client_id]\n new_group[:isactive] = 1\n new_group[:createdby] = session[:username]\n\n @deptgroup = Deptgroup.new(new_group)\n\n if @deptgroup.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'Department Sub Group was successfully created.'\n else\n @@request_result[:errormsg] = @deptgroup.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def create\n @yeargroup = Yeargroup.new(params[:yeargroup])\n\n respond_to do |format|\n if @yeargroup.save\n format.html { redirect_to @yeargroup, notice: 'Yeargroup was successfully created.' }\n format.json { render json: @yeargroup, status: :created, location: @yeargroup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yeargroup.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74873894",
"0.7404065",
"0.7276609",
"0.72105795",
"0.69572115",
"0.6926051",
"0.68251",
"0.6778822",
"0.67742246",
"0.6755118",
"0.67133766",
"0.6642443",
"0.6631938",
"0.66003615",
"0.6566832",
"0.6520253",
"0.64784855",
"0.64757067",
"0.64537245",
"0.6451597",
"0.64394295",
"0.6418068",
"0.64023584",
"0.63932717",
"0.63932717",
"0.63846594",
"0.6382887",
"0.6382887",
"0.63821715",
"0.63718146",
"0.6360436",
"0.6348897",
"0.63449854",
"0.63449854",
"0.63449854",
"0.63449854",
"0.63449854",
"0.63449854",
"0.63259816",
"0.63259816",
"0.63259816",
"0.63259816",
"0.63259816",
"0.6317877",
"0.6311277",
"0.6299678",
"0.62961435",
"0.628374",
"0.6274735",
"0.62714446",
"0.62681997",
"0.62652737",
"0.6240079",
"0.6212208",
"0.6204151",
"0.6204151",
"0.62025666",
"0.6196142",
"0.619487",
"0.61928487",
"0.619258",
"0.61908686",
"0.61865675",
"0.61823124",
"0.61761177",
"0.6172096",
"0.6169609",
"0.6164987",
"0.6164402",
"0.61606413",
"0.616019",
"0.61555654",
"0.61539435",
"0.61487824",
"0.61473393",
"0.6143641",
"0.6141251",
"0.61395234",
"0.61395234",
"0.61374927",
"0.61302555",
"0.61046433",
"0.61034805",
"0.6095127",
"0.60920846",
"0.60874385",
"0.60794705",
"0.6078464",
"0.60782415",
"0.607608",
"0.60760355",
"0.607517",
"0.6074596",
"0.607452",
"0.60741043",
"0.60678273",
"0.6063773",
"0.60601735",
"0.60553354",
"0.60551906"
] | 0.74643666 | 1 |
PUT /product_groups/1 PUT /product_groups/1.json | def update
@product_group = ProductGroup.find(params[:id])
respond_to do |format|
if @product_group.update_attributes(params[:product_group])
format.html { redirect_to @product_group, notice: 'Product group was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @product_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @product_group.update(product_group_params)\n format.html { redirect_to @product_group, notice: \"Product group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product_group }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @product_product_group.update(product_product_group_params)\n format.html { redirect_to @product_product_group, notice: 'Product product group was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_product_group }\n else\n format.html { render :edit }\n format.json { render json: @product_product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_product_group\n @product_group = ProductGroup.find(params[:id])\n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group_product.update(group_product_params)\n format.html { redirect_to @group_product, notice: 'Group product was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_product }\n else\n format.html { render :edit }\n format.json { render json: @group_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_group_product\n @group_product = GroupProduct.find(params[:id])\n end",
"def set_product_product_group\n @product_product_group = ProductProductGroup.find(params[:id])\n end",
"def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n @group = Course.groups.new(group_params)\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend",
"def update\n @group.update(group_params)\n respond_with(@group)\n end",
"def update\n @group.name = params['name']\n @group.save\n respond_to do |format|\n format.json { render :show, status: :ok, location: @group }\n end\n end",
"def update\n set_feature_group\n respond_to do |format|\n if @feature_group.update(feature_group_params)\n format.html { redirect_to @product, notice: 'Feature group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_group }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_group = ProductGroup.new(params[:product_group])\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: 'Product group was successfully created.' }\n format.json { render json: @product_group, status: :created, location: @product_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_tree_group = ProductTreeGroup.find(params[:id])\n\n respond_to do |format|\n if @product_tree_group.update_attributes product_tree_group_params\n format.html { redirect_to admin_product_tree_group_path(@product_tree_group), notice: '产品修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_tree_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_product_group_params\n params.require(:product_product_group).permit(:product_id, :product_group_id)\n end",
"def update\n respond_to do |format|\n if @products_grupo.update(products_grupo_params)\n format.html { redirect_to @products_grupo, notice: 'Products grupo was successfully updated.' }\n format.json { render :show, status: :ok, location: @products_grupo }\n else\n format.html { render :edit }\n format.json { render json: @products_grupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Le groupe a été modifié.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Группа обновлена!' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item_group = Vger::Resources::Suitability::ItemGroup.find(params[:id])\n respond_to do |format|\n if @item_group.class.save_existing(params[:id], params[:item_group])\n format.html { redirect_to suitability_item_group_path(params[:id]), notice: 'Suitability Item Group was successfully updated.' }\n format.json { render json: @item_group, status: :created, location: @item_group}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @group\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to group_path(@group), notice: \"Group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to [@group], notice: 'group was successfully updated.' }\n format.json { render :show, status: :ok, location: [@group] }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection_group.update(collection_group_params)\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @esol_group = EsolGroup.find(params[:id])\n\n respond_to do |format|\n if @esol_group.update_attributes(params[:esol_group])\n format.html { redirect_to @esol_group, notice: 'Esol group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @esol_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #logger.info \"Put parameters: #{params.to_json}\"\n\n if @membership.admin \n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n else \n render json: {error: \"YOU MUST BE AN ADMINISTRATOR TO COMPLETE THIS ACTION\"}, status: :unprocessable_entity\n end \n end",
"def create\n @product_product_group = ProductProductGroup.new(product_product_group_params)\n\n respond_to do |format|\n if @product_product_group.save\n format.html { redirect_to @product_product_group, notice: 'Product product group was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_group }\n else\n format.html { render :new }\n format.json { render json: @product_product_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_group_params\n params.require(:product_group).permit(:name, :title)\n end",
"def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pgroup = Pgroup.find(params[:id])\n\n respond_to do |format|\n if @pgroup.update_attributes(params[:pgroup])\n format.html { redirect_to @pgroup, notice: 'Pgroup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pgroup = Pgroup.find(params[:id])\n\n respond_to do |format|\n if @pgroup.update_attributes(params[:pgroup])\n format.html { redirect_to @pgroup, notice: 'Pgroup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @group\n @group.creator = current_user\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n audit(@group, \"update\", @group.name)\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(group_id, attributes)\n put(\"/v1/groups/#{group_id}\", attributes)\n end",
"def update\n respond_to do |format|\n if @resource_group.update(resource_group_params)\n format.html { redirect_to @resource_group, notice: 'Resource group was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource_group }\n else\n format.html { render :edit }\n format.json { render json: @resource_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = SuperSimpleCms::Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to super_simple_group_path(@group) } \n format.js { redirect_to formatted_super_simple_group_path(@group, :js) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => \"new\", :layout=>false}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: I18n.t(:group_update) }\n format.json { render :show, status: :ok, location: @group }\n else\n flash[:alert] = @group.errors.full_messages.to_sentence\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @agroup.update(agroup_params)\r\n format.html { redirect_to @agroup, notice: 'Agroup was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @agroup.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @group_product = GroupProduct.new(group_product_params)\n\n respond_to do |format|\n if @group_product.save\n format.html { redirect_to @group_product, notice: 'Group product was successfully created.' }\n format.json { render :show, status: :created, location: @group_product }\n else\n format.html { render :new }\n format.json { render json: @group_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n token = params[:token]\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to group_path(:id => @group.id), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @objectgrouptoobjectgroup = Objectgrouptoobjectgroup.find(params[:id])\n\n respond_to do |format|\n if @objectgrouptoobjectgroup.update_attributes(params[:objectgrouptoobjectgroup])\n flash[:notice] = 'Objectgrouptoobjectgroup was successfully updated.'\n format.html { redirect_to(@objectgrouptoobjectgroup) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @objectgrouptoobjectgroup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end",
"def update\n respond_to do |format|\n if @small_group.update(small_group_params)\n format.html { redirect_to @small_group, notice: 'Small group was successfully updated.' }\n format.json { render :show, status: :ok, location: @small_group }\n else\n format.html { render :edit }\n format.json { render json: @small_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_group.update(sales_group_params)\n format.html { redirect_to @sales_group, notice: 'Sales group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sales_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(current_user.id)\n @group = @user.groups.find(params[:id])\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n @groupcategory = GroupCategory.where(:group_id => params[:id])\n @groupcategory.update(group_id: @group.id , category_id: params[:category])\n\n respond_to do |format|\n if @group.update(title: params[:title], description: params[:description])\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n @users = @group.users\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to edit_user_registration_path, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @group.update_attributes(group_params)\n format.html { redirect_to @group.becomes(Group), notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n if !@group.admin.empty?\n @user=User.find(@group.admin)\n puts \"///////group controller update//////////\"+ @user.to_json\n @user.update_attributes(role: '1')\n @user.update_attributes(group_id: @group._id)\n end\n @group.update_attributes(params[:group])\n #format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n #format.json { render json: @group, status: :accepted, location: @group }\n render 'show'\n #format.html { render action: \"edit\" }\n #format.json { render json: @group.errors, status: :unprocessable_entity } \n end",
"def create\n @api_v1_group_update = Api::V1::GroupUpdate.new(api_v1_group_update_params)\n\n respond_to do |format|\n if @api_v1_group_update.save\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_group_update }\n else\n format.html { render :new }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n if @attribute_group.update_attributes(params[:attribute_group])\n format.html { redirect_to(@attribute_group, :notice => 'Attribute group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attribute_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if request.post?\n if @group.update_attributes(params[:group])\n redirect_to :action => 'list'\n else\n render :action => 'rename'\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Group\"[], \"updated\"[]]\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n flash[:notice] = t('flash_msg47')\n @groups = Group.all\n # format.html { redirect_to(@group) }\n # format.xml { head :ok }\n else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end",
"def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to params[:back_to], notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @polco_group = PolcoGroup.find(params[:id])\n @polco_group.title = \"#{params[:polco_group][:name]}_custom\" \n\n respond_to do |format|\n if @polco_group.update_attributes(params[:group])\n format.html { redirect_to(@polco_group, :notice => 'PolcoGroup was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @polco_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_products_grupo\n @products_grupo = ProductsGrupo.find(params[:id])\n end",
"def update\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n\n respond_to do |format|\n if @item_group.update_attributes(params[:item_group])\n format.html do\n redirect_to items_path(group_key:@item_group.key), notice: 'Question was successfully updated.'\n end\n\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(group_params)\n # Load records in order to refresh index page\n index\n flash[:success] = t('notices.updated_successfully')\n format.html { redirect_to @resource, warning: 'Group was successfully updated.'}\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end",
"def destroy\n @product_group = ProductGroup.find(params[:id])\n @product_group.destroy\n\n respond_to do |format|\n format.html { redirect_to product_groups_url }\n format.json { head :no_content }\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to( view_group_path(@group.label), :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_group(id, params)\n put(\"groups/#{id}\", group: params)\n end"
] | [
"0.7319747",
"0.717857",
"0.7144693",
"0.7133317",
"0.6942322",
"0.69123155",
"0.6906836",
"0.68793714",
"0.67309684",
"0.67155915",
"0.6634647",
"0.66333306",
"0.6632108",
"0.66289",
"0.65920997",
"0.6582122",
"0.6545448",
"0.65433204",
"0.65422857",
"0.6541781",
"0.6521263",
"0.6521263",
"0.65177983",
"0.6507461",
"0.6507461",
"0.6507461",
"0.65031934",
"0.64985967",
"0.64952606",
"0.64858687",
"0.6471514",
"0.64632",
"0.64554775",
"0.6448296",
"0.6434767",
"0.643354",
"0.64240515",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.6414481",
"0.64103884",
"0.6404471",
"0.64029336",
"0.6398944",
"0.63961226",
"0.6386379",
"0.63676155",
"0.63576835",
"0.63576835",
"0.6352533",
"0.6352533",
"0.6352533",
"0.6352533",
"0.63515574",
"0.6342897",
"0.63404775",
"0.6332135",
"0.63274103",
"0.6326358",
"0.63185936",
"0.6313537",
"0.63028026",
"0.63025266",
"0.63022596",
"0.62984234",
"0.62925017",
"0.6281161",
"0.62800175",
"0.6277824",
"0.62459254",
"0.6242571",
"0.6233972",
"0.6231532",
"0.62270975",
"0.62267154",
"0.62256956",
"0.6225617",
"0.62230617",
"0.6213967",
"0.6213967",
"0.6213761",
"0.62127644",
"0.6209593",
"0.6207251",
"0.61985195",
"0.619481",
"0.61926657",
"0.6191698",
"0.619077",
"0.61827326",
"0.6179771"
] | 0.74395096 | 0 |
DELETE /product_groups/1 DELETE /product_groups/1.json | def destroy
@product_group = ProductGroup.find(params[:id])
@product_group.destroy
respond_to do |format|
format.html { redirect_to product_groups_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @product_group.destroy\n respond_to do |format|\n format.html { redirect_to product_groups_url, notice: \"Product group was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_tree_group = ProductTreeGroup.find(params[:id])\n @product_tree_group.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_product_tree_groups_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_product_group.destroy\n respond_to do |format|\n format.html { redirect_to product_product_groups_url, notice: 'Product product group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end",
"def destroy\n @group_product.destroy\n respond_to do |format|\n format.html { redirect_to group_products_url, notice: 'Group product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @esol_group = EsolGroup.find(params[:id])\n @esol_group.destroy\n\n respond_to do |format|\n format.html { redirect_to esol_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_group.destroy\n respond_to do |format|\n format.html { redirect_to request_groups_url }\n format.json { head :no_content }\n end\n end",
"def deleteEntityGroup( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/group\",params)\n end",
"def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n @item_group.destroy\n\n respond_to do |format|\n format.html { redirect_to item_groups_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_group_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_updates_url, notice: 'Group update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @products_grupo.destroy\n respond_to do |format|\n format.html { redirect_to products_grupos_url, notice: 'Products grupo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end",
"def destroy\n @sales_group.destroy\n respond_to do |format|\n format.html { redirect_to sales_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_group.destroy\n respond_to do |format|\n format.html { redirect_to collection_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group_item.destroy\n respond_to do |format|\n format.html { redirect_to group_items_url, notice: 'Group item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @plant_group.destroy\n respond_to do |format|\n format.html { redirect_to plant_groups_url, notice: 'Plant group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end",
"def destroy\n @pgroup = Pgroup.find(params[:id])\n @pgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to pgroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pgroup = Pgroup.find(params[:id])\n @pgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to pgroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @group.destroy\n\n head :no_content\n end",
"def destroy\n if @group.destroy\n render json: {result: 1}\n else\n render json: {result: 0}\n end\n end",
"def destroy\n @small_group.destroy\n respond_to do |format|\n format.html { redirect_to small_groups_url, notice: 'Small group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @group\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customers_group.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customers_group.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @meta_data_group = MetaDataGroup.find(params[:id])\n @meta_data_group.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_data_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @yeargroup = Yeargroup.find(params[:id])\n @yeargroup.destroy\n\n respond_to do |format|\n format.html { redirect_to yeargroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute_group = AttributeGroup.find(params[:id])\n @attribute_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(attribute_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_group.destroy\n\n render json: @contact_group, status: :ok\n end",
"def destroy\n @group_order.destroy\n respond_to do |format|\n format.html { redirect_to group_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource_group.destroy\n respond_to do |format|\n format.html { redirect_to resource_groups_url, notice: 'Resource group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_group.destroy\n respond_to do |format|\n format.html { redirect_to food_groups_url, notice: 'Food group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Le groupe a été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense_group.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to admin_groups_url, notice: t('activerecord.models.group') +'删除成功!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Группа удалена!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n @questionnaire_group.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaire_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @user_id = @group.user_id\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url(:user_id=>@user_id) }\n # format.html { redirect_to groups_sidebartab_url(:user_id=>@user_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alien_group.destroy\n respond_to do |format|\n format.html { redirect_to alien_groups_url, notice: 'Alien group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @groups = Group.find(params[:id])\n @groups.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupon = Groupon.find(params[:id])\n @groupon.destroy\n\n respond_to do |format|\n format.html { redirect_to groupons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n flash[:success] = \"Группа успешно удалена.\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = @course.groups.find(params[:id])\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupaddrobj = Groupaddrobj.find(params[:id])\n @groupaddrobj.destroy\n\n respond_to do |format|\n format.html { redirect_to groupaddrobjs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to @index_url, notice: \"#{@group_model.to_s} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n # format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access_group = AccessGroup.find(params[:id])\n @access_group.destroy\n\n respond_to do |format|\n format.html { redirect_to access_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n audit(@group, \"destroy\", @group.name )\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend"
] | [
"0.7735333",
"0.77158034",
"0.7650658",
"0.7554933",
"0.7516712",
"0.73726857",
"0.73586386",
"0.7358454",
"0.7348608",
"0.7340374",
"0.73220503",
"0.731833",
"0.7316048",
"0.73030275",
"0.7301992",
"0.7284739",
"0.7284739",
"0.7282055",
"0.7282055",
"0.7282055",
"0.7282055",
"0.7282055",
"0.7282055",
"0.7278683",
"0.7278683",
"0.7278305",
"0.7277235",
"0.72740144",
"0.72740144",
"0.72740144",
"0.72740144",
"0.72740144",
"0.72596675",
"0.72568077",
"0.7256367",
"0.72385395",
"0.72339666",
"0.72237635",
"0.71913236",
"0.7184903",
"0.71782154",
"0.7170859",
"0.71609104",
"0.71609104",
"0.71574163",
"0.7156746",
"0.7154451",
"0.7146513",
"0.7144505",
"0.7138427",
"0.7138427",
"0.7133442",
"0.71256816",
"0.7123799",
"0.7120637",
"0.71199864",
"0.7103905",
"0.71009773",
"0.7090617",
"0.7088189",
"0.7086284",
"0.7085552",
"0.70837104",
"0.70799875",
"0.7078071",
"0.7076596",
"0.707124",
"0.7064272",
"0.7060459",
"0.7045346",
"0.7044129",
"0.7043977",
"0.7043901",
"0.7034198",
"0.70323414",
"0.70310366",
"0.7030998",
"0.70263916",
"0.7025054",
"0.7024427",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.7022039",
"0.70209306",
"0.70123637",
"0.70117134",
"0.70117134",
"0.7004231"
] | 0.7959752 | 0 |
what is the time complexity of this solution? o(n!) what happens if you increase the size of the strings? will be a lot slower p first_anagram?("gizmo", "sally") => false p first_anagram?("elvis", "lives") => true phase 2 | def second_anagram?(word1, word2)
p "Running second_anagram?..."
start = Time.now
word2 = word2.split("") #O(n)
word1.each_char do |char| #O(n)
char_index = word2.index(char) #O(n)
if char_index.nil? #O(1)
return false #O(1)
else
word2.delete_at(char_index) #O(1)
end
end
word2.empty? #O(1)
p "Took #{Time.now - start} seconds"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_anagram?(string1, string2)\n all_anagrams(string1).include?(string2)\nend",
"def first_anagram?(str1, str2)\n all_anagrams(str1).include?(str2)\nend",
"def first_anagram?(str1, str2)\n possible = str1.split(\"\").permutation.to_a #O(n!)\n possible.include?(str2.split(\"\")) #n\nend",
"def first_anagram?(string1, string2) # space/time o(n!)\n string1.chars.to_a.permutation.map(&:join).include?(string2)\nend",
"def first_anagram?(str1, str2)\r\n anagram_helper(str1).include?(str2) \r\n\r\nend",
"def first_anagram?(str1, str2)\n all_anagrams1 = str1.split(\"\").permutation.to_a.map(&:join)\n # (n) + (n!) + (n!) + (n!*n) => reduces down to O(n *n!) \n # ^\n #bottleneck\n all_anagrams1.include?(str2) # O(n!*n) \nend",
"def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def first_anagram?(str1, str2)\r\n possible = str1.split(\"\").permutation.to_a #O(n!)\r\n possible.map! {|ele| ele.join(\"\")} #O(n)\r\n possible.include?(str2) #O(n)\r\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def first_anagram?(str1, str2)\n\n str1.split(\"\").permutation.each do |perm| # O(n!)\n word = perm.join(\"\") # O(1)\n return true if word == str2 # O(1)\n end\n false # O(1)\nend",
"def first_anagram?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a \n anagrams.include?(str2.split(\"\"))\nend",
"def first_anagram?(str1, str2)\n str1.split(\"\").permutation.include?(str2.split(\"\"))\nend",
"def first_anagram?(string, strong)\n anagram = string.chars.permutation.to_a\n anagram.include?(strong.split(''))\nend",
"def first_anagram?(str1, str2)\n str1.chars.permutation.to_a.include?(str2.chars)\nend",
"def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend",
"def first_anagram(string1, string2)\n string1.chars.permutation.to_a.include? string2\nend",
"def first_anagram?(str1, str2)\n str1.chars.to_a.permutation.map(&:join).include?(str2)\nend",
"def third_anagram?(string1, string2) #O(n log(n))\r\n string1.chars.sort == string2.chars.sort \r\nend",
"def first_anagram?(str1, str2)\n str1.split(\"\").permutation.include?(str2.split(\"\")) #.to_a.include?(str2.split(\"\")) \nend",
"def first_anagram?(string1,string2)\n new_strings = string1.chars.permutation.to_a\n new_strings.include?(string2.chars)\n\nend",
"def second_anagram?(string1, string2) #O(n^2)\n return true if string1.empty?\n string2.length.times do |i|\n if string2[i] == string1[0]\n return second_anagram?(string1[1..-1], string2)\n end\n end\n false\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def first_anagram?(str1, str2)\n str_1 = []\n str1.each_char do |char1|\n sub_str = \"\"\n str1.each_char do |char2|\n sub_str += char2\n end\n str_1 << sub_str\n end \n result = str_1.select {|ele| ele.length == str2.length}.first\n\n str2.chars.all? {|char| result.chars.include?(char)}\nend",
"def second_anagram?(str1, str2) #.351 #! O(n^2)\n string = str2\n\n str1.each_char do |char| \n return false if !string.include?(char)\n string = string[0...string.index(char)] + string[string.index(char) + 1..-1]\n end\n string.empty? ? true : false\nend",
"def first_anagram?(str_1, str_2)\n perms = str_1.chars.permutation.to_a\n perms.map! { |perm| perm.join(\"\") }\n perms.include?(str_2)\nend",
"def third_anagram?(str1, str2) # O(2 * n log n)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1,str2)\n str1.split(\"\").sort == str2.split(\"\").sort # nlogn\nend",
"def third_anagram?(str1, str2) # O(n log n) linearithimic\n str1.chars.sort == str2.chars.sort\nend",
"def first_anagram?(string, target)\n return false if str1.length != str2.length\n perms = anagram_perms(string.chars)\n perms.include?(target.chars)\nend",
"def first_anagram?(word1, word2)\n permutations = word1.split('').permutation.to_a.map(&:join)\n permutations.include?(word2)\nend",
"def third_anagram?(string1, string2) # Ruby uses quicksort. Time: o(n*log(n)) space = o(n)\n string1.split(\"\").sort == string2.split(\"\").sort\nend",
"def third_anagram?(string1, string2) #0(log n)\n string1.sort == string2.sort\nend",
"def first_anagram?(str_1, str_2)\n\n new_arr = str_1.chars.permutation.to_a\n all_possible = []\n new_arr.each do |ele|\n all_possible << ele.join(\"\")\n end\n all_possible.any? { |ele| str_2.include?(ele) }\n\nend",
"def second_anagram?(string1, string2) #O(n^2) \r\n string1.chars.each do |letter|\r\n return false unless string2.include?(letter)\r\n idx = string2.index(letter)\r\n string2 = string2[0...idx] + string2[idx+1..-1]\r\n end\r\n return true \r\nend",
"def fourth_anagram?(first_str, second_str)\n first_count = Hash.new(0)\n second_count = Hash.new(0)\n first_str.each_char { |char| first_count[char] += 1 } # n\n second_str.each_char { |char| second_count[char] += 1 } # m\n first_count == second_count\n\n\n\n\n# O(n)\n anagram = true\n count = Hash.new(0)\n first_str.each_char { |char| count[\"first_#{char}\"] += 1 }\n second_str.each_char { |char| count[\"second_#{char}\"] += 1 }\n first_str.each_char do |char|\n anagram = false unless count[\"first_#{char}\"] == count[\"second_#{char}\"]\n end\n anagram\nend",
"def third_anagram?(str1,str2) #O(n^2) ~ O(nlogn)\n str1.split('').sort == str2.split('').sort\nend",
"def third_anagram?(str1,str2) #O(nlogn)\n str1_a = str1.split('').sort\n str2_a = str2.split('').sort\n\n str1_a == str2_a \nend",
"def first_anagram?(str, target)\n perms = str.split('').permutation.to_a\n \n perms.each do |perm|\n return true if perm.join('') == target \n end\n \n false\nend",
"def first_anagram?(str1, str2)\n arr1 = str1.chars\n perms = permutations(arr1).map do |perm| # => 'ab' => [[a,b],[b,a]] => ['ab', 'ba']\n perm.join('')\n end\n\n perms.include?(str2)\nend",
"def fourth_anagram?(str1, str2) # O(n)\n hash = Hash.new(0) # 1\n str1.each_char {|char| hash[char] += 1} # n\n str2.each_char {|char| hash[char] -= 1} # n\n\n hash.values.all?(0) # n\n\nend",
"def third_anagram?(first_str, second_str)\n first_sorted = first_str.chars.sort # n + nlogn\n second_sorted = second_str.chars.sort # m + mlogm\n first_sorted == second_sorted\nend",
"def second_anagram?(str, str2)\n\n return true if str.empty? && str2.empty?\n\n str = str.chars.sort.join\n str2 = str2.chars.sort.join\n\n if str[0] == str2[0]\n second_anagram?(str[1..-1], str2[1..-1])\n else\n return false\n end\n\nend",
"def first_anagram?(s1, s2)\n all_poss = s1.chars.permutation.to_a\n\n all_poss.any? do |poss|\n s2 == poss.join\n end\nend",
"def fifth_anagram?(string1, string2) # Time: O(n) * O(n) * O(n) => O(n) Space = O(1)\n count = Hash.new(0)\n string1.split(\"\").each {|char1| count[char1]+=1}\n string2.split(\"\").each {|char2| count[char2]-=1}\n count.all? {|k,v| v.zero?}\nend",
"def second_anagram?(str_1, str_2)\n temp = str_2.split(\"\") \n str_1.each_char.with_index do |char, i| #O(n) **\n temp_idx = temp.find_index(char) #O(n*log(n)) ** (need to check this!)\n return false if temp_idx.nil?\n temp.slice!(temp_idx) #O(n)\n end \n temp.join(\"\") == \"\"\nend",
"def is_anagram(s, t)\n\n return s.split(\"\").sort == t.split(\"\").sort\n\nend",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def anagram?(string, string2)\n str_arr = string.chars\n answer_array = []\n (0...str_arr.length).each do |i|\n answer_array << str_arr.permutation(i).to_a\n end\n\n answer = answer_array.uniq.join\n answer.include?(string2)\nend",
"def second_anagram?(str1, str2) # O(n + n*n) -> O(n^2)\n alpha = (\"a\"..\"z\").to_a # 1\n arr = str2.split(\"\") # n\n str1.each_char do |char| # n\n a_idx = alpha.index(char) # 1\n arr.reject! {|char2| alpha.index(char2) == a_idx} # n * 1\n end\n arr.empty? # 1\nend",
"def first_anagram?(first_word, second_word)\n perms = first_word.chars.permutation\n\n perms.each do |perm|\n return true if perm.join == second_word\n end\n\n false\nend",
"def third_anagram?(s1, s2)\r\n s1.chars.sort == s2.chars.sort\r\nend",
"def third_anagram?(str_1,str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def fourth_anagram?(string1, string2) # Time: O(n) * O(n) => O(n) Space = O(1)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n string1.split(\"\").each {|char1| hash1[char1]+=1}\n string2.split(\"\").each {|char2| hash2[char2]+=1}\n\n hash1 == hash2\nend",
"def is_anagram(s, t)\n return s.chars.sort == t.chars.sort\nend",
"def fifth_anagram?(str1, str2) # .295 O(n)\n h = Hash.new(0)\n str1.each_char { |c1| h[c1] += 1}\n str2.each_char { |c1| h[c1] -= 1}\n h.value?(0)\nend",
"def third_anagram?(str_1, str_2)\n str_1.split('').sort == str_2.split('').sort\nend",
"def third_anagram?(str,str2)\n str.chars.sort == str2.chars.sort\nend",
"def fifth_anagram?(str1, str2)\n\n counter = Hash.new(0)\n str1.each_char.with_index do |char, idx| #O(n)\n counter[char] += 1 \n counter[str2[idx]] -= 1\n end\n\n counter.values.all? { |v| v == 0 } #O(n)\n\nend",
"def third_anagram?(str_1,str_2)\n str_1.sort == str_2.sort\nend",
"def fourth_anagram?(s1, s2)\r\n string_hash(s1) == string_hash(s2)\r\nend",
"def third_anagram?(s1, s2)\n return s1.chars.sort == s2.chars.sort\nend",
"def third_anagram?(str1, str2)\n\n str1.split(\"\").sort == str2.split(\"\").sort\n\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\n \nend",
"def third_anagram?(str1, str2)\r\n str1.split('').sort == str2.split('').sort\r\nend",
"def third_anagram?(string1, string2)\n string1.split(\"\").sort == string2.split(\"\").sort \nend",
"def is_anagram(s, t)\n s.chars.sort == t.chars.sort\nend",
"def third_anagram?(str1, str2)\n sorted1 = str1.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n sorted2 = str2.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n\n sorted1 == sorted2 #O(1)\nend",
"def third_anagram?(str1,str2)\r\n str1.chars.sort == str2.chars.sort\r\nend",
"def third_anagram?(str1, str2)\r\n str1.split(\"\").sort == str2.split(\"\").sort\r\nend",
"def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend",
"def third_anagram?(string1,string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.sort == str2.sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str_1, str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def third_anagram?(str_1, str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def anagramI?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a.map { |anagram| anagram.join(\"\") }\n anagrams.include?(str2)\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def anagram(string1, string2)\n puts \"Are #{string1} and #{string2} anagrams?\"\n if string1.length != string2.length\n return false\n else\n string1.length.times do |i|\n if !string2.include? string1[i] \n return false\n end\n end\n return true\n end\nend",
"def second_anagram?(first_str, second_str)\n first_str.each_char.with_index do |ele, i| # n * m\n idx = second_str.index(ele)\n second_str[idx] = \"\" unless idx.nil?\n end\n return true if second_str.length == 0\n false\nend",
"def anagram3(string, string2)\n(string.chars.sort.join == string2.chars.sort.join) ? true : false\nend",
"def anagram?(s1,s2)\n\ts1.chars.sort == s2.chars.sort\nend",
"def second_anagram?(str_1,str_2)\n str_1.each_char do |c|\n index = str_2.split(\"\").find_index(c)\n str_2 = str_2[0...index] + str_2[index + 1..-1] unless index.nil?\n end\n str_2.empty?\nend",
"def anagram_3_alphabetically(str1, str2) # O( 2*(nlogn) ) => O(nlogn)\n str1.split(\"\").sort == str2.split(\"\").sort\n # what kind of sorting method\nend",
"def fourth_anagram?(str1, str2)\n\n str1_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n str2_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n\n str1.each_char do |char| # O(n)\n str1_hash[char] += 1\n end\n\n str2.each_char do |char| # O(n)\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash # O(1)\n\nend",
"def second_anagram?(str1,str2)\n str1.chars.each_with_index do |char,i|\n if !str2.chars.find_index(char).nil?\n idx = str2.chars.find_index(char)\n str2 = str2[0...idx] + str2[idx+1..-1]\n end\n end\n return true if str2.length ==0\n false\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort.join(\"\") == str2.split(\"\").sort.join(\"\")\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def fourth_anagram?(str1, str2) # .338 O(n)\n h1 = Hash.new(0)\n h2 = Hash.new(0)\n str1.each_char { |c1| h1[c1] += 1}\n str2.each_char { |c2| h2[c2] += 1}\n h1 == h2\nend",
"def second_anagram?(string1,string2)\n string1.each_char.with_index do |char, i|\n idx = string2.index(char)\n if idx != nil \n string2 = string2[0...idx] + string2[idx+1..-1]\n end\n end\n string2.length == 0\n\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend"
] | [
"0.86453944",
"0.85758716",
"0.85600007",
"0.8552878",
"0.8546111",
"0.8475641",
"0.84730524",
"0.8457353",
"0.8450251",
"0.84415144",
"0.83857226",
"0.8381222",
"0.8343028",
"0.83159333",
"0.8305027",
"0.8271278",
"0.82649314",
"0.82325995",
"0.8222806",
"0.8195654",
"0.8173914",
"0.8156454",
"0.8149624",
"0.81455266",
"0.8132788",
"0.8129886",
"0.81183934",
"0.8112095",
"0.81032276",
"0.8101377",
"0.8101296",
"0.8099118",
"0.809496",
"0.8091591",
"0.8052924",
"0.8050694",
"0.802656",
"0.80121166",
"0.79989123",
"0.7994622",
"0.7986957",
"0.79848516",
"0.7976917",
"0.7954209",
"0.7943186",
"0.79431695",
"0.79419124",
"0.79329735",
"0.7895395",
"0.78551453",
"0.78533834",
"0.78481764",
"0.78461784",
"0.78435564",
"0.7842647",
"0.78418046",
"0.78413516",
"0.78411925",
"0.78381",
"0.7838081",
"0.7834134",
"0.7832229",
"0.7830983",
"0.782401",
"0.7818536",
"0.78172094",
"0.78171694",
"0.7815855",
"0.7815095",
"0.7813909",
"0.7809623",
"0.7808288",
"0.7806922",
"0.780535",
"0.78052247",
"0.78052247",
"0.780263",
"0.7802597",
"0.7801156",
"0.77915084",
"0.77915084",
"0.778892",
"0.77836883",
"0.7783076",
"0.7781751",
"0.7781234",
"0.7780768",
"0.7775957",
"0.7770696",
"0.7769499",
"0.77634573",
"0.77615285",
"0.77615285",
"0.77609533",
"0.77601707",
"0.77585316",
"0.77585316",
"0.77585316",
"0.77585316",
"0.77585316",
"0.77585316"
] | 0.0 | -1 |
p second_anagram?("gizcxzmoasdfg", "sallcasdfgxzy") => false p second_anagram?("eelviscxzasdfg", "elivcxasdfgzes") => true what is the time complexity of this solution? o(n) what happens if you increase the size of the strings? will be a little slower | def third_anagram?(word1, word2)
p "Running third_anagram..."
start = Time.now
var = word1.split("").sort == word2.split("").sort
puts "Took #{Time.now - start} seconds - Result: #{var}"
# return var
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def second_anagram?(string1, string2) #O(n^2)\n return true if string1.empty?\n string2.length.times do |i|\n if string2[i] == string1[0]\n return second_anagram?(string1[1..-1], string2)\n end\n end\n false\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def third_anagram?(string1, string2) #O(n log(n))\r\n string1.chars.sort == string2.chars.sort \r\nend",
"def second_anagram?(str1, str2) #.351 #! O(n^2)\n string = str2\n\n str1.each_char do |char| \n return false if !string.include?(char)\n string = string[0...string.index(char)] + string[string.index(char) + 1..-1]\n end\n string.empty? ? true : false\nend",
"def third_anagram?(str1, str2) # O(2 * n log n)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2) # O(n log n) linearithimic\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def first_anagram?(str1, str2)\n\n str1.split(\"\").permutation.each do |perm| # O(n!)\n word = perm.join(\"\") # O(1)\n return true if word == str2 # O(1)\n end\n false # O(1)\nend",
"def second_anagram?(string1, string2) #O(n^2) \r\n string1.chars.each do |letter|\r\n return false unless string2.include?(letter)\r\n idx = string2.index(letter)\r\n string2 = string2[0...idx] + string2[idx+1..-1]\r\n end\r\n return true \r\nend",
"def third_anagram?(string1, string2) #0(log n)\n string1.sort == string2.sort\nend",
"def first_anagram?(str1, str2)\n all_anagrams1 = str1.split(\"\").permutation.to_a.map(&:join)\n # (n) + (n!) + (n!) + (n!*n) => reduces down to O(n *n!) \n # ^\n #bottleneck\n all_anagrams1.include?(str2) # O(n!*n) \nend",
"def first_anagram?(string1, string2) # space/time o(n!)\n string1.chars.to_a.permutation.map(&:join).include?(string2)\nend",
"def fourth_anagram?(first_str, second_str)\n first_count = Hash.new(0)\n second_count = Hash.new(0)\n first_str.each_char { |char| first_count[char] += 1 } # n\n second_str.each_char { |char| second_count[char] += 1 } # m\n first_count == second_count\n\n\n\n\n# O(n)\n anagram = true\n count = Hash.new(0)\n first_str.each_char { |char| count[\"first_#{char}\"] += 1 }\n second_str.each_char { |char| count[\"second_#{char}\"] += 1 }\n first_str.each_char do |char|\n anagram = false unless count[\"first_#{char}\"] == count[\"second_#{char}\"]\n end\n anagram\nend",
"def fourth_anagram?(str1, str2) # O(n)\n hash = Hash.new(0) # 1\n str1.each_char {|char| hash[char] += 1} # n\n str2.each_char {|char| hash[char] -= 1} # n\n\n hash.values.all?(0) # n\n\nend",
"def first_anagram?(str1, str2)\n possible = str1.split(\"\").permutation.to_a #O(n!)\n possible.include?(str2.split(\"\")) #n\nend",
"def second_anagram?(str_1, str_2)\n temp = str_2.split(\"\") \n str_1.each_char.with_index do |char, i| #O(n) **\n temp_idx = temp.find_index(char) #O(n*log(n)) ** (need to check this!)\n return false if temp_idx.nil?\n temp.slice!(temp_idx) #O(n)\n end \n temp.join(\"\") == \"\"\nend",
"def third_anagram?(str1,str2) #O(n^2) ~ O(nlogn)\n str1.split('').sort == str2.split('').sort\nend",
"def first_anagram?(str1, str2)\r\n possible = str1.split(\"\").permutation.to_a #O(n!)\r\n possible.map! {|ele| ele.join(\"\")} #O(n)\r\n possible.include?(str2) #O(n)\r\nend",
"def third_anagram?(first_str, second_str)\n first_sorted = first_str.chars.sort # n + nlogn\n second_sorted = second_str.chars.sort # m + mlogm\n first_sorted == second_sorted\nend",
"def third_anagram?(str1,str2) #O(nlogn)\n str1_a = str1.split('').sort\n str2_a = str2.split('').sort\n\n str1_a == str2_a \nend",
"def third_anagram?(string1, string2) # Ruby uses quicksort. Time: o(n*log(n)) space = o(n)\n string1.split(\"\").sort == string2.split(\"\").sort\nend",
"def third_anagram?(str1,str2)\n str1.split(\"\").sort == str2.split(\"\").sort # nlogn\nend",
"def third_anagram?(str1, str2)\n sorted1 = str1.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n sorted2 = str2.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n\n sorted1 == sorted2 #O(1)\nend",
"def second_anagram?(str1, str2) # O(n + n*n) -> O(n^2)\n alpha = (\"a\"..\"z\").to_a # 1\n arr = str2.split(\"\") # n\n str1.each_char do |char| # n\n a_idx = alpha.index(char) # 1\n arr.reject! {|char2| alpha.index(char2) == a_idx} # n * 1\n end\n arr.empty? # 1\nend",
"def second_anagram?(first_str, second_str)\n first_str.each_char.with_index do |ele, i| # n * m\n idx = second_str.index(ele)\n second_str[idx] = \"\" unless idx.nil?\n end\n return true if second_str.length == 0\n false\nend",
"def fourth_anagram?(string1, string2) #O(n) time, O(1) space\n string_hash = Hash.new(0)\n string1.chars.each do |ch|\n string_hash[ch] += 1\n end\n string2.chars.each do |ch|\n string_hash[ch] -= 1\n end\n string_hash.all? { |k, v| v == 0 }\nend",
"def second_anagram?(str_1, str_2)\n str_1.each_char do |char| #O(n)\n return false if !str_2.include?(char) #O(m)\n str_2_idx = str_2.index(char) #O(m)\n str_2[str_2_idx] = \"\"\n end\n str_2.empty? #O(1)\nend",
"def second_anagram?(str, str2)\n\n return true if str.empty? && str2.empty?\n\n str = str.chars.sort.join\n str2 = str2.chars.sort.join\n\n if str[0] == str2[0]\n second_anagram?(str[1..-1], str2[1..-1])\n else\n return false\n end\n\nend",
"def fifth_anagram?(string1, string2) # Time: O(n) * O(n) * O(n) => O(n) Space = O(1)\n count = Hash.new(0)\n string1.split(\"\").each {|char1| count[char1]+=1}\n string2.split(\"\").each {|char2| count[char2]-=1}\n count.all? {|k,v| v.zero?}\nend",
"def fifth_anagram?(str1, str2) # .295 O(n)\n h = Hash.new(0)\n str1.each_char { |c1| h[c1] += 1}\n str2.each_char { |c1| h[c1] -= 1}\n h.value?(0)\nend",
"def second_anagram?(s1, s2)\n return false if s1.length != s2.length # O(1)\n\n # N(N + N + N) --> O(N^2)\n s1.chars.each do |char|\n # byebug\n return false if !s2.include?(char) # O(N)\n s1.delete!(char) # O(N)\n s2.delete!(char) # O(N)\n end\n\n s1.length == 0 && s2.length == 0\nend",
"def fourth_anagram?(string1, string2) # Time: O(n) * O(n) => O(n) Space = O(1)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n string1.split(\"\").each {|char1| hash1[char1]+=1}\n string2.split(\"\").each {|char2| hash2[char2]+=1}\n\n hash1 == hash2\nend",
"def second_anagram?(str1,str2) #O(n*m)\n return false if str1.length != str2.length\n str1_arr = str1.split('')\n str2_arr = str2.split('')\n \n str1_arr.each do |char1|\n str2_arr.find_index(char1) ? str2_arr.delete(char1) : (return false)\n end\n\n str2_arr.empty? ? true : false\nend",
"def fourth_anagram?(str1, str2) # .338 O(n)\n h1 = Hash.new(0)\n h2 = Hash.new(0)\n str1.each_char { |c1| h1[c1] += 1}\n str2.each_char { |c2| h2[c2] += 1}\n h1 == h2\nend",
"def first_anagram?(str1, str2)\n str1.split(\"\").permutation.include?(str2.split(\"\"))\nend",
"def second_anagram?(string1, string2) # n^2\n chars1 = string1.split(\"\")\n chars2 = string2.split(\"\")\n\n chars1.each do |char|\n index = chars2.find_index(char)\n return false if index.nil?\n chars2.delete_at(index)\n end\n chars2.empty?\nend",
"def first_anagram?(string1, string2)\n all_anagrams(string1).include?(string2)\nend",
"def anagram3(string, string2)\n(string.chars.sort.join == string2.chars.sort.join) ? true : false\nend",
"def second_anagram?(second_string)\n arr1 = self.chars\n arr2 = second_string.chars\n arr1.each_with_index do |let1,idx1|\n arr2.each_with_index do |let2,idx2|\n if let1 == let2\n arr1[idx1] = nil\n arr2[idx2] = nil\n end\n end\n end\n return true if arr1.compact.empty? && arr2.compact.empty?\n false\n end",
"def fifth_anagram?(str1, str2)\n\n counter = Hash.new(0)\n str1.each_char.with_index do |char, idx| #O(n)\n counter[char] += 1 \n counter[str2[idx]] -= 1\n end\n\n counter.values.all? { |v| v == 0 } #O(n)\n\nend",
"def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend",
"def second_anagram?(str1, str2)\n str2_arr = str2.split(\"\") # O(1)\n str1.each_char do |char| # O(n)\n idx = str2_arr.find_index(char) # O(n)\n return false if idx == nil # O(1)\n str2_arr.delete_at(idx) # O(1)\n end\n return str2_arr.empty? # O(1)\nend",
"def third_anagram?(str,str2)\n str.chars.sort == str2.chars.sort\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def fourth_anagram?(str1, str2)\n\n str1_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n str2_hash = Hash.new {|h,k| h[k] = 0 } # O(1)\n\n str1.each_char do |char| # O(n)\n str1_hash[char] += 1\n end\n\n str2.each_char do |char| # O(n)\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash # O(1)\n\nend",
"def second_anagram?(str_1, str_2)\n str_1, str_2 = str_1.split(\"\"), str_2.split(\"\")\n str_1.each do |char|\n str_2_idx = str_2.find_index(char)\n return false if str_2_idx.nil?\n str_2 = str_2[0...str_2_idx] + str_2[str_2_idx + 1.. -1]\n end\n str_2 == []\nend",
"def third_anagram?(s1, s2)\n return s1.chars.sort == s2.chars.sort\nend",
"def third_anagram?(s1, s2)\r\n s1.chars.sort == s2.chars.sort\r\nend",
"def fourth_anagram?(str1, str2)\n return false if str1.length != str2.length\n hash = {}\n str1.each_char {|ele| hash[ele] = true}\n str2.chars.all?{|ch| hash.key?(ch)}\nend",
"def second_anagram?(string1, string2) #o(n^2)\n return false if string1.length!=string2.length\n splitString2 = string2.split(\"\")\n string1.each_char do |char|\n if splitString2.include?(char)\n splitString2.delete_at(splitString2.index(char))\n end\n end\n \n splitString2.join(\"\") == \"\"\nend",
"def first_anagram?(str1, str2)\n all_anagrams(str1).include?(str2)\nend",
"def second_anagram?(str1, str2) #n*m \n str1 = str1.split(\"\") #n\n str2 = str2.split(\"\") #m\n str1.each do |char| #n\n loc = str2.find_index(char) #m ... n*m\n if loc.nil? \n return false \n else\n str2.delete_at(loc) #m\n end \n end \n return true if str2.empty? \nend",
"def first_anagram?(str1, str2)\n str1.chars.permutation.to_a.include?(str2.chars)\nend",
"def first_anagram?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a \n anagrams.include?(str2.split(\"\"))\nend",
"def third_anagram?(second_string)\n self.chars.sort == second_string.chars.sort\n end",
"def second_anagram?(s1, s2)\r\n arr = s2.chars\r\n s1.chars.each_with_index do |c, i|\r\n return false unless arr.delete(c)\r\n end\r\n return true if arr.empty?\r\n false\r\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort.join(\"\") == str2.split(\"\").sort.join(\"\")\nend",
"def second_anagram?(str1, str2) #better than the first ( n^2 )\n str1.each_char do |char|\n second_idx = str2.index(char)\n str2[second_idx] = \"\" unless second_idx == nil\n end\n str2.chars.empty?\nend",
"def third_anagram?(string1,string2)\n string1.chars.sort == string2.chars.sort\nend",
"def second_anagram?(str1,str2)\n str1.chars.each_with_index do |char,i|\n if !str2.chars.find_index(char).nil?\n idx = str2.chars.find_index(char)\n str2 = str2[0...idx] + str2[idx+1..-1]\n end\n end\n return true if str2.length ==0\n false\nend",
"def third_anagram?(str1, str2)\r\n str1.split('').sort == str2.split('').sort\r\nend",
"def anagram?(string, string2)\n str_arr = string.chars\n answer_array = []\n (0...str_arr.length).each do |i|\n answer_array << str_arr.permutation(i).to_a\n end\n\n answer = answer_array.uniq.join\n answer.include?(string2)\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\n \nend",
"def third_anagram?(str1,str2)\r\n str1.chars.sort == str2.chars.sort\r\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def second_anagram?(str1, str2)\n arr1 = str1.split(\"\") #O(n)\n arr2 = str2.split(\"\") #O(n)\n\n arr1.each do |char| #O(n)\n idx = arr2.index(char) #O(n)\n idx.nil? ? (return false) : arr2.delete_at(idx) #O(1)\n end\n arr2.empty? #O(1)\nend",
"def fourth_anagram?(s1, s2)\r\n string_hash(s1) == string_hash(s2)\r\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort! == str2.chars.sort!\nend",
"def anagram_bruteforce? (s1,s2)\n sp = StringPermutator.new\n return true if sp.permutations(s1).include? s2\n false\n end",
"def third_anagram?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend",
"def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def second_anagram?(str1, str2) # O(n^2)\n str2_chars = str2.chars \n str1.chars.each do |char| \n idx = str2_chars.find_index(char) \n if !idx.nil?\n str2_chars.delete_at(idx) \n end\n end\n str2_chars.empty?\nend",
"def second_anagram?(str1,str2) #n^2\n \n str1.split('').each do |c1|\n str2.split('').each do |c2|\n if c1 == c2 \n str1.delete!(c1)\n str2.delete!(c2)\n end \n end \n end \n str1.empty? && str2.empty?\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def first_anagram?(str1, str2)\n str1.chars.to_a.permutation.map(&:join).include?(str2)\nend",
"def third_anagram?(s1, s2)\n s1.chars.sort.join == s2.chars.sort.join\nend",
"def second_anagram(str1, str2)\n str1_chars = str1.chars #n\n #+\n str2_chars = str2.chars #n\n#+\n str1_chars.each do |char| #n\n #*\n idx = str2_chars.find_index(char) #n\n #+\n return false if idx == nil #constant\n #+\n str2_chars.delete_at(idx) #n\n\n end #n(n+1+n) => 2n^2 + n\n\n\n\n str2_chars.empty? ? true : false\n\n end",
"def fourth_anagram?(str, str2)\n\n str_hash = hash_creator(str)\n str2_hash = hash_creator(str2)\n\n str_hash.each do |k,v|\n return false unless str2_hash.has_key?(k)\n if v != str2_hash[k]\n return false\n end\n end\n # true\n str2_hash.each do |k, v|\n return false unless str_hash.has_key?(k)\n if v != str_hash[k]\n return false\n end\n end\n\n return true\nend",
"def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n str1_copy = str1.dup\n str2_copy = str2.dup\n\n (0...str1.length).each do |i|\n if str2.include?(str1[i])\n str1_copy.delete!(str1[i])\n end\n end\n\n (0...str2.length).each do |i|\n if str1.include?(str2[i])\n str2_copy.delete!(str2[i])\n end\n end\n\n\n return true if str1_copy.empty? && str2_copy.empty?\n false\nend",
"def third_anagram?(str1, str2)\r\n str1.split(\"\").sort == str2.split(\"\").sort\r\nend",
"def third_anagram?(str_1, str_2)\n str_1.split('').sort == str_2.split('').sort\nend",
"def third_anagram?(str_1, str_2)\n str_1.chars.sort.join == str_2.chars.sort.join\nend",
"def fifth_anagram?(str1,str2) #O(n)\n hash1 = Hash.new(0)\n \n str1.split('').each do |c1|\n hash1[c1] += 1\n end \n\n str2.split('').each do |c1|\n hash1[c1] -= 1\n end \n\n hash1.each do |k,v|\n return false if hash1[k] != 0\n end\n true\nend",
"def fourth_anagram?(str1, str2)\n char_count = Hash.new(0)\n str1.each_char do |el|\n char_count[el] += 1\n end\n str2.each_char do |el|\n if char_count[el] == 0\n return false\n else\n char_count[el] -= 1\n end\n end\n str1.length == str2.length\nend",
"def fifth_anagram?(str, str2)\n return false unless str.length == str2.length\n str_hash = hash_creator(str)\n\n str_hash.each do |k,v|\n return false unless str.include?(k)\n if str2.count(k) != v\n return false\n end\n end\n\n true\nend",
"def second_anagram?(string1,string2)\n # byebug\n return false unless string1.length == string2.length\n\n chars1 = string1.chars\n chars2 = string2.chars\n\n chars1.each do |char|\n if chars2.include?(char)\n chars2.delete(char)\n end\n end\n\n return true if chars2.empty?\n\n false\nend",
"def second_anagram?(str_1,str_2)\n str_1.each_char do |c|\n index = str_2.split(\"\").find_index(c)\n str_2 = str_2[0...index] + str_2[index + 1..-1] unless index.nil?\n end\n str_2.empty?\nend",
"def second_anagram?(string1, string2)\n arr = string2.split(\"\")\n string1.each_char do |char|\n if !arr.find_index(char).nil?\n idx = arr.find_index(char)\n arr[idx] = \"\"\n end\n end\n return true if arr.join(\"\") == \"\"\n false\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n\n str1.chars.each {|el| hash1[el] += 1}\n str2.chars.each {|el| hash1[el] += 1}\n\n hash1.each {|k,_| hash1[k].even? ? next : (return false) }\n true\nend",
"def anagram(string1, string2)\n puts \"Are #{string1} and #{string2} anagrams?\"\n if string1.length != string2.length\n return false\n else\n string1.length.times do |i|\n if !string2.include? string1[i] \n return false\n end\n end\n return true\n end\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str_1,str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend"
] | [
"0.8943164",
"0.8923429",
"0.8905731",
"0.888033",
"0.88681173",
"0.8833851",
"0.8813002",
"0.88057226",
"0.87907225",
"0.8753518",
"0.87507635",
"0.87321794",
"0.87303895",
"0.87283415",
"0.8717794",
"0.87177163",
"0.8699652",
"0.8689417",
"0.86874527",
"0.86852944",
"0.86603206",
"0.8648866",
"0.8637572",
"0.8612003",
"0.8592211",
"0.85705775",
"0.85683614",
"0.8567765",
"0.8539936",
"0.85316473",
"0.85193145",
"0.85091615",
"0.850744",
"0.8502092",
"0.84969634",
"0.84944755",
"0.84855574",
"0.8483523",
"0.84707284",
"0.8469576",
"0.84630716",
"0.8452529",
"0.8451996",
"0.845028",
"0.84419054",
"0.84370166",
"0.84322315",
"0.84302443",
"0.84279335",
"0.8425373",
"0.8423927",
"0.84227186",
"0.8417703",
"0.84154785",
"0.8413625",
"0.8408254",
"0.84026045",
"0.83951557",
"0.8391509",
"0.839102",
"0.8390563",
"0.8389848",
"0.8389177",
"0.8389073",
"0.83867973",
"0.83867973",
"0.8383778",
"0.8380115",
"0.83764493",
"0.83760273",
"0.83716977",
"0.8371428",
"0.83698064",
"0.83687663",
"0.8368253",
"0.8368159",
"0.8367096",
"0.8367096",
"0.8367096",
"0.8367096",
"0.8367096",
"0.8367096",
"0.8366212",
"0.83654153",
"0.83646816",
"0.8363769",
"0.8357992",
"0.83563507",
"0.83517945",
"0.8346833",
"0.83452195",
"0.8343781",
"0.83430034",
"0.8341419",
"0.8340813",
"0.8339224",
"0.83390576",
"0.83321244",
"0.8320232",
"0.83196634",
"0.83196217"
] | 0.0 | -1 |
=> true p fourth_anagram?("gizcxzmoasdfg", "sallcasdfgxzy") => false WHY DO WE GET VARYING TIMES EVEN WITH SAME WORDS p fourth_anagram?("eelviscxzasdfg", "elivcxasdfgzes") => true | def fifth_anagram?(word1, word2) # O(n)
p "Running fifth_anagram..."
start = Time.now
hash1 = Hash.new(0)
# hash2 = Hash.new(0)
word1.each_char {|char| hash1[char] += 1}
word2.each_char {|char| hash1[char] += 1}
hash1.values.all? {|v| v.even?}
# puts "Took #{Time.now - start} seconds"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fourth_anagram?(s1, s2)\r\n string_hash(s1) == string_hash(s2)\r\nend",
"def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end",
"def third_anagram?(string, strong)\n string.chars.sort == strong.chars.sort\nend",
"def fourth_anagram?(str1, str2)\n helper(str1) == helper(str2)\nend",
"def fourth_anagram?(word1, word2)\n letters = Hash.new(0)\n word1.each_char do |char|\n letters[char] += 1\n end\n word2.each_char do |char2|\n letters[char2] -= 1\n end\n letters.all? {|k,v| v ==0}\nend",
"def fifth_anagram?(first_word, second_word)\n word_count = Hash.new(0)\n first_word.chars.each { |char| word_count[char] += 1 }\n second_word.chars.each { |char| word_count[char] -= 1 }\n\n word_count.all? {|_, val| val == 0}\nend",
"def fourth_anagram?(str1, str2)\n return false if str1.length != str2.length\n hash = {}\n str1.each_char {|ele| hash[ele] = true}\n str2.chars.all?{|ch| hash.key?(ch)}\nend",
"def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend",
"def fourth_anagram?(str, str2)\n\n str_hash = hash_creator(str)\n str2_hash = hash_creator(str2)\n\n str_hash.each do |k,v|\n return false unless str2_hash.has_key?(k)\n if v != str2_hash[k]\n return false\n end\n end\n # true\n str2_hash.each do |k, v|\n return false unless str_hash.has_key?(k)\n if v != str_hash[k]\n return false\n end\n end\n\n return true\nend",
"def fourth_anagram?(str1,str2)\n str_to_hash(str1) == str_to_hash(str2)\nend",
"def third_anagram?(first_word, second_word)\n first_word.chars.sort == second_word.chars.sort\nend",
"def fourth_anagram?(string1, string2)\n chars_hash = Hash.new(0)\n string1.chars.each do |chr|\n chars_hash[chr] += 1\n end\n\n string2.chars.each do |chr|\n chars_hash[chr] -= 1\n end\n\n chars_hash.values.all? {|count| count == 0}\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n\n str1.chars.each {|el| hash1[el] += 1}\n str2.chars.each {|el| hash1[el] += 1}\n\n hash1.each {|k,_| hash1[k].even? ? next : (return false) }\n true\nend",
"def fifth_anagram?(str, str2)\n return false unless str.length == str2.length\n str_hash = hash_creator(str)\n\n str_hash.each do |k,v|\n return false unless str.include?(k)\n if str2.count(k) != v\n return false\n end\n end\n\n true\nend",
"def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend",
"def fifth_anagram?(first_word, second_word)\n hash = Hash.new(0)\n first_word.each_char do |char|\n hash[char] += 1\n end\n\n second_word.each_char do |char|\n hash[char] -= 1\n end\n hash.values.all? {|value| value == 0}\nend",
"def third_anagram?(word1, word2)\n word1.split(\"\").sort == word2.split(\"\").sort\nend",
"def third_anagram?(string1,string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend",
"def third_anagram?(second_string)\n self.chars.sort == second_string.chars.sort\n end",
"def fourth_anagram?(str1, str2)\n char_count = Hash.new(0)\n str1.each_char do |el|\n char_count[el] += 1\n end\n str2.each_char do |el|\n if char_count[el] == 0\n return false\n else\n char_count[el] -= 1\n end\n end\n str1.length == str2.length\nend",
"def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\n \nend",
"def fourth_anagram?(string1, string2)\n s1 = Hash.new(0)\n s2 = Hash.new(0)\n string1.chars { |ch| s1[ch] += 1 }\n string2.chars { |ch| s2[ch] += 1 }\n s1.all? do |k, v|\n s2[k] == v\n end\nend",
"def fourth_anagram?(str1,str2)\n counter = Hash.new(0)\n str1.each_char { |chr| counter[chr] += 1 }\n str2.each_char { |chr| counter[chr] -= 1 }\n counter.all? { |k, v| v == 0 }\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n first_word.each_char do |char|\n first_hash[char] += 1\n end\n second_word.each_char do |char|\n second_hash[char] += 1\n end\n first_hash == second_hash\nend",
"def fourth_anagram?(string, strong)\n s_hash = Hash.new(0)\n ss_hash = Hash.new(0)\n string.chars.each do |el|\n s_hash[el] += 1\n end\n strong.chars.each do |el|\n ss_hash[el] += 1\n end\n s_hash.to_a.sort == ss_hash.to_a.sort\nend",
"def third_anagram?(str, target)\n str.chars.sort == target.chars.sort\nend",
"def fourth_anagram?(str1, str2)\n counter = Hash.new(0)\n (str1 << str2).each_char do |k, v|\n counter[k] += 1\n end\n !counter.values.any? { |ele| ele == 1 }\nend",
"def fourth_anagram?(str_1, str_2)\n letters = Hash.new(0)\n str_1.each_char do |letter|\n letters[letter] += 1\n end\n str_2.each_char do |letter|\n if !letters.include?(letter) || letters[letter] <= 0\n return false\n end\n letters[letter] -= 1\n end\n letters.all? { |k,v| v == 0 }\nend",
"def is_anagram?(word)\n#try determining if they are composed of the same letters.\n word.chars.sort == @word.chars.sort\n end",
"def third_anagram?(str, target)\n str.split(\"\").sort == target.split(\"\").sort\nend",
"def fourth_anagram?(str_1, str_2)\n str_1_hash = Hash.new(0)\n str_2_hash = Hash.new(0)\n str_1.each_char { |char| str_1_hash[char] += 1 }\n str_2.each_char { |char| str_2_hash[char] += 1 }\n str_1_hash == str_2_hash\nend",
"def fourth_anagram?(str, target)\n hash = Hash.new(0)\n str.each_char{|char| hash[char] += 1}\n target.each_char{|char| hash[char] -=1}\n hash.values.all?(0)\n\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n\n first_word.chars.each { |char| first_hash[char] += 1 }\n second_word.chars.each { |char| second_hash[char] += 1 }\n\n first_hash == second_hash\nend",
"def fourth_anagram?(str, target_str)\n return false unless str.length == target_str.length\n str_counter = Hash.new(0)\n target_counter = Hash.new(0)\n\n str.each_char {|char| str_counter[char] += 1}\n target_str.each_char {|char| target_counter[char] += 1}\n str_counter.keys.all? {|k| str_counter[k] == target_counter[k]}\nend",
"def third_anagram?(word1, word2)\n word1_chars = word1.split(\"\").sort\n word2_chars = word2.split(\"\").sort\n word1_chars == word2_chars\n\nend",
"def third_anagram?(str,str2)\n str.chars.sort == str2.chars.sort\nend",
"def third_anagram?(s1, s2)\r\n s1.chars.sort == s2.chars.sort\r\nend",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend",
"def third_anagram?(s1, s2)\n return s1.chars.sort == s2.chars.sort\nend",
"def fourth_anagram?(string1, string2)\n hash = Hash.new(0)\n\n string1.each_char {|char| hash[char] += 1}\n string2.each_char {|char| hash[char] -= 1}\n hash.all? {|k,v| v.zero?}\n\nend",
"def fourth_anagram?(string_1, string_2)\n characters_1 = Hash.new(0)\n characters_2 = Hash.new(0)\n string_1.chars.each { |ch| characters_1[ch] += 1 }\n string_2.chars.each { |ch| characters_2[ch] += 1 }\n characters_1 == characters_2\nend",
"def fourth_anagram?(str_1, str_2)\n hash = Hash.new(0)\n\n str_1.each_char { |char| hash[char] += 1 }\n str_2.each_char { |char| hash[char] -= 1 }\n\n hash.all? { |k,v| v == 0 }\nend",
"def third_anagram?(word1, word2)\n first = word1.chars.sort.join(\"\")\n second = word2.chars.sort.join(\"\")\n\n p first == second \nend",
"def panagram?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend",
"def panagram3?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend",
"def third_anagram?(first_word, second_word)\n first_word = first_word.chars.sort\n second_word = second_word.chars.sort\n\n first_word == second_word\nend",
"def fourth_anagram?(string1, string2)\n # count1 = Hash.new(0)\n # count2 = Hash.new(0)\n\n # string1.each_char {|char| count1[char] += 1}\n # string2.each_char {|char| count2[char] += 1}\n\n # count1 == count2\n\n count = Hash.new(0)\n\n string1.each_char {|char| count[char] += 1}\n string2.each_char do |char|\n count[char] -= 1\n return false if count[char] < 0\n end\n\n count.values.all? {|el| el == 0}\nend",
"def third_anagram?(string1, string2) #0(log n)\n string1.sort == string2.sort\nend",
"def third_anagram?(string1, string2)\n string1.split(\"\").sort == string2.split(\"\").sort \nend",
"def third_anagram?(str1, str2)\n str1.chars.sort! == str2.chars.sort!\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1,str2)\r\n str1.chars.sort == str2.chars.sort\r\nend",
"def anagram3(string, string2)\n(string.chars.sort.join == string2.chars.sort.join) ? true : false\nend",
"def fourth_anagram?(str_1, str_2)\n return false if str_1.length != str_2.length \n hash = Hash.new(0)\n str_1.each_char {|char| hash[char] += 1}\n str_2.each_char {|char| hash[char] -= 1}\n hash.all? {|k, v| v == 0}\nend",
"def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend",
"def third_anagram?(str1, str2)\r\n str1.split('').sort == str2.split('').sort\r\nend",
"def fourth_anagram?(string1, string2) #O(n) time, O(1) space\n string_hash = Hash.new(0)\n string1.chars.each do |ch|\n string_hash[ch] += 1\n end\n string2.chars.each do |ch|\n string_hash[ch] -= 1\n end\n string_hash.all? { |k, v| v == 0 }\nend",
"def third_anagram?(word1, word2)\n split1= word1.chars.sort\n split2 = word2.chars.sort\n split1 == split2\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort.join(\"\") == str2.split(\"\").sort.join(\"\")\nend",
"def anagram_word?(test_word)\n sort_word(@word) == sort_word(test_word)\n end",
"def third_anagram?(s1, s2)\n s1.chars.sort.join == s2.chars.sort.join\nend",
"def third_anagram?(str_1, str_2)\n str_1.split('').sort == str_2.split('').sort\nend",
"def panagram?(string)\n return false if string.length < 26\n\n letters = string.downcase.gsub(/[^a-z]/, '')\n letters.chars.uniq.count >= 26\nend",
"def panagram?(string)\nend",
"def third_anagram?(str1, str2)\r\n str1.split(\"\").sort == str2.split(\"\").sort\r\nend",
"def third_anagram?(string1, string2)\n chars1 = string1.chars.sort\n chars2 = string2.chars.sort\n\n chars1 == chars2\nend",
"def fourth_anagram?(first_str, second_str)\n first_count = Hash.new(0)\n second_count = Hash.new(0)\n first_str.each_char { |char| first_count[char] += 1 } # n\n second_str.each_char { |char| second_count[char] += 1 } # m\n first_count == second_count\n\n\n\n\n# O(n)\n anagram = true\n count = Hash.new(0)\n first_str.each_char { |char| count[\"first_#{char}\"] += 1 }\n second_str.each_char { |char| count[\"second_#{char}\"] += 1 }\n first_str.each_char do |char|\n anagram = false unless count[\"first_#{char}\"] == count[\"second_#{char}\"]\n end\n anagram\nend",
"def fourth_anagram?(str1, str2)\n str1_counts = Hash.new(0)\n str2_counts = Hash.new(0)\n\n str1.chars.each { |letter| str1_counts[letter] += 1 }\n str2.chars.each { |letter| str2_counts[letter] += 1 }\n\n str1_counts == str2_counts\nend",
"def third_anagram?(string1, string2) #O(n log(n))\r\n string1.chars.sort == string2.chars.sort \r\nend",
"def fourth_anagram2?(word1, word2)\n hash = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash[char] += 1\n end\n word2.chars.each do |char|\n hash[char] -= 1\n end\n hash.keys.all? { |v| v == 0 }\nend",
"def third_anagram?(str_1, str_2)\n str_1.chars.sort.join == str_2.chars.sort.join\nend",
"def third_anagram?(str_1,str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def fourth_anagram?(string1, string2)\r\n counter = Hash.new(0)\r\n (0...string1.length).each do |i|\r\n increment = string1[i]\r\n decrement = string2[i]\r\n counter[increment] += 1\r\n counter[decrement] -= 1\r\n end\r\n # string1.each_char do |char|\r\n # counter[char] += 1\r\n # end\r\n\r\n # string2.each_char do |char|\r\n # counter[char] -= 1\r\n # end\r\n counter.values.all?(0)\r\nend",
"def third_anagram?(str_1, str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def third_anagram?(str_1, str_2)\n str_1.split(\"\").sort == str_2.split(\"\").sort\nend",
"def fourth_anagram?(word1, word2)\n hash1 = Hash.new { |h, k| h[k] = 0 }\n hash2 = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash1[char] += 1\n end\n word2.chars.each do |char|\n hash2[char] += 1\n end\n hash1 == hash2\nend",
"def third_anagram?(str1,str2)\n str1.split(\"\").sort == str2.split(\"\").sort # nlogn\nend",
"def third_anagram?(string1, string2) # Ruby uses quicksort. Time: o(n*log(n)) space = o(n)\n string1.split(\"\").sort == string2.split(\"\").sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def fourth_anagram?(string1, string2)\n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n string1.chars.each do |char|\n str1_hash[char] += 1\n end\n string2.chars.each do |char|\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def third_anagram?(str1, str2)\n str1.split(\"\").sort == str2.split(\"\").sort\nend",
"def fourth_anagram?(word_1, word_2) #O(n)\n count1 = Hash.new(0) \n word_1.each_char { |char| count1[char] += 1 }\n\n count2 = Hash.new(0) \n word_2.each_char { |char| count2[char] += 1 }\n\n count1 == count2\nend",
"def third_anagram?(str1, str2)\n str1.sort == str2.sort\nend",
"def fourth_anagram?(str1, str2)\n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n str1.each_char { |letter| str1_hash[letter] += 1 }\n str2.each_char { |letter| str2_hash[letter] += 1 }\n\n str1_hash == str2_hash\nend",
"def third_anagram?(str_1,str_2)\n str_1.sort == str_2.sort\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def third_anagram?(str1, str2)\n\n str1.split(\"\").sort == str2.split(\"\").sort\n\nend",
"def third_anagram?(word1, word2)\n\n word1_arr = word1.split(\"\")\n word2_arr = word2.split(\"\")\n\n word1_arr.sort == word2_arr.sort\n\nend",
"def fourth_anagramb?(word1, word2)\n hash1 = Hash.new { |h, k| h[k] = 0}\n\n word1.each_char do |char|\n hash1[char] += 1\n end\n\n word2.each_char do |char|\n hash1[char] -= 1\n end\n\n hash1.each_value { |v| return false if v != 0}\n true\nend",
"def fifth_anagram?(str1, str2)\n count = Hash.new(0)\n str1.each_char {|char| count[char] += 1}\n str2.each_char {|char| count[char] -= 1}\n\n count.all? {|k,v| v.zero? }\nend"
] | [
"0.8488202",
"0.8478943",
"0.8409723",
"0.84065604",
"0.8361914",
"0.83372366",
"0.83138555",
"0.8305577",
"0.82907504",
"0.82633984",
"0.8261686",
"0.8252298",
"0.8227482",
"0.8222696",
"0.8215059",
"0.82134044",
"0.82103765",
"0.8205123",
"0.8199502",
"0.8199502",
"0.8198642",
"0.81959695",
"0.8194997",
"0.81815624",
"0.8180974",
"0.8177671",
"0.817295",
"0.8172794",
"0.8171751",
"0.81690574",
"0.81690234",
"0.8161518",
"0.81603235",
"0.8157418",
"0.81567806",
"0.81554276",
"0.8151138",
"0.81498647",
"0.8146353",
"0.81431043",
"0.8139948",
"0.81398356",
"0.8135124",
"0.8132879",
"0.8132691",
"0.8126573",
"0.8117934",
"0.811118",
"0.8103045",
"0.8100021",
"0.809061",
"0.80897236",
"0.8085918",
"0.8084812",
"0.8084812",
"0.8084812",
"0.8084812",
"0.8084812",
"0.8084812",
"0.80841833",
"0.8083874",
"0.80781525",
"0.80771",
"0.80730075",
"0.80720407",
"0.80686617",
"0.8068491",
"0.8068366",
"0.8066923",
"0.8065376",
"0.8063058",
"0.8054117",
"0.8054054",
"0.80516446",
"0.805078",
"0.804706",
"0.8039627",
"0.80345917",
"0.80320615",
"0.803076",
"0.8028311",
"0.80271447",
"0.8024708",
"0.8024708",
"0.8023951",
"0.8023817",
"0.8021133",
"0.80171734",
"0.8015432",
"0.8015091",
"0.8014999",
"0.8014999",
"0.8012212",
"0.8007161",
"0.800451",
"0.80012333",
"0.7993051",
"0.7984045",
"0.79694045",
"0.79569024",
"0.7955844"
] | 0.0 | -1 |
this endpoint creates a model use that's useful for figuring out flaws in the UI | def create_model_user
u = User.find_by(email: 'shahid@eff.org')
# setup long fab
f = u.fabs.last
f.backward[0].update_attributes body: "Duis vitae nisi quis enim viverra consequat at et lorem. Morbi in quam ut tellus fermentum iaculis. Nullam erat libero, suscipit eget nullam."
f.backward[1].update_attributes body: "Fusce malesuada odio orci, sit amet malesuada ipsum laoreet in. Aenean id pretium arcu. Integer volutpat gravida ante, quis rutrum est fermentum vel. Sed tempus justo ipsum, ac accumsan quam facilisis eu. Aliquam mollis euismod eros nullam."
f.backward[2].update_attributes body: "Quisque quis dignissim dui. Aliquam nec varius neque. Duis vitae lacus amet."
f.forward[0].update_attributes body: "Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere."
f.forward[1].update_attributes body: "Aenean ornare mi in tellus egestas rhoncus. Quisque quam ante, ultricies at pretium dictum, pulvinar convallis dolor volutpat."
f.forward[2].update_attributes body: "Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere."
# setup Gif Tag
f.gif_tag open("http://media2.giphy.com/media/9B5EkgWrF4Rri/giphy.gif")
f.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_and_model; end",
"def model\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def usage\n Zapi::Models::Usage.new\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def create\n # USELESS\n end",
"def create\n # USELESS\n end",
"def model\n @model ||= resource.model\n end",
"def create\n @breadcrumb = 'create'\n @use = Use.new(params[:use])\n @use.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @use.save\n format.html { redirect_to @use, notice: crud_notice('created', @use) }\n format.json { render json: @use, status: :created, location: @use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def model\n @model ||= operation.run\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def private_model; @private_model = true end",
"def model(model)\n if @resource_config[:model]\n raise DefinitionError, \"model already declared in #{self}\"\n end\n @resource_config[:model] = model\n end",
"def set_model\n @model = Info\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def set_model\n @model=Info\n end",
"def setup_model(opts, current_account:, **)\n opts['model'] = current_account\n end",
"def model=(value)\n @model = value\n end",
"def model\n @opts[:model]\n end",
"def model!(options, params:)\n options['model'] = Event.find(params[:id])\n end",
"def brand_with_model; end",
"def set_model\n @model = Request.find(params[:id])\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def model\n @model ||= @fact_model.model\n end",
"def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end",
"def new\n @breadcrumb = 'create'\n @use = Use.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @use }\n end\n end",
"def _default_wrap_model; end",
"def model=(value)\n @model = value\n end",
"def model=(value)\n @model = value\n end",
"def model\n provider.model\n end",
"def set_model\n @model = ClientService.find(params[:id])\n end",
"def fabricate_via_api!\n validate_reuse_preconditions\n\n resource_web_url(api_get)\n rescue Errors::ResourceNotFoundError\n super\n ensure\n self.class.resources[reuse_as] ||= {\n tests: Set.new,\n resource: self\n }\n\n self.class.resources[reuse_as][:attributes] ||= all_attributes.each_with_object({}) do |attribute_name, attributes|\n attributes[attribute_name] = instance_variable_get(\"@#{attribute_name}\")\n end\n self.class.resources[reuse_as][:tests] << Runtime::Example.location\n end",
"def make_and_model\n m = make\n\n \"#{m} #{model(make_of_model: m)}\"\n end",
"def model name, **params\n # <<- CLOSURE_SCOPE\n current = @current # closure scope\n params = @environs.merge params if @environs\n filled_or_maybe = optionality(params)\n params[:class] ||= name.to_s.gsub(/(?:\\A|_)./) { |m| m[-1].upcase }\n # CLOSURE_SCOPE\n\n schema do\n __send__(current, name).__send__(filled_or_maybe, model?: params[:class])\n end\n\n define_helper_methods name\n end",
"def model; eval model_name; end",
"def model; eval model_name; end",
"def model\n nil\n end",
"def model\n nil\n end",
"def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n end",
"def fullfilled_model\n explicit_fullfilled_model || implicit_fullfilled_model\n end",
"def set_model\n @model = Response.find(params[:id])\n end",
"def initialize(model, request)\n @model = model\n @request = request\n end",
"def model\n return @model\n end",
"def initialize(make, model)\n @make = make\n @model = model\n end",
"def model\n @values.fetch('ai.device.model') { \n @values['ai.device.model'] = nil\n }\n end",
"def request_model\n model = {\n 'content_snapshot': Base64.strict_encode64(snapshot.to_s),\n 'meta': {\n 'signs': signatures\n }\n }\n\n if validation_token\n model[:meta][:validation] = {'token': validation_token.value}\n end\n if relations\n model[:meta][:relations] = relations\n end\n\n return model\n end",
"def obj\n @model\n end",
"def create\n # @post.user = current_user\n # @user = User.find(params[:user_id])\n # @model = @user.models.create(params[:model])\n\n # On construit le model pour l utilsateur courant\n @model = current_user.models.build(params[:model])\n #Equivault a ces deux lignes\n # @model = Model.new(params[:model])\n # @model.user = current_user\n\n #On appelle la procedure objSize\n # @model.name= objSize\n # @model.name = \"test\"\n\n @model.scale = 1\n @model.modelPath = @model.avatar.url\n @model.bbX=100\n @model.bbY=100\n @model.bbZ=100\n\n respond_to do |format|\n\n if @model.save\n get_volume_value\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_model\n self.model = nil # set up the model\n end",
"def model\n self::Model\n end",
"def model\n __getobj__\n end",
"def initialize_model\n # let's create our new empty model\n @model = OpenStudio::Model::Model.new if @model.nil?\n end",
"def manage_restfully_incorporation\n name = controller_name\n record_name = name.to_s.singularize\n model = name.to_s.singularize.classify.constantize\n records = model.name.underscore.pluralize\n code = ''\n\n columns = model.columns_hash.keys\n columns = columns.delete_if { |c| [:depth, :rgt, :lft, :id, :lock_version, :updated_at, :updater_id, :creator_id, :created_at].include?(c.to_sym) }\n values = columns.inject({}) do |hash, attr|\n hash[attr] = \"params[:#{attr}]\".c unless attr.blank? || attr.to_s.match(/_attributes$/)\n hash\n end.collect { |k, v| \"#{k}: (#{v.inspect})\" }.join(', ')\n code << \"def pick\\n\"\n code << \" @#{record_name} = resource_model.new(#{values})\\n\"\n code << \" already_imported_records = #{model}.select(:reference_name).collect(&:reference_name)\\n\"\n code << \" already_imported = already_imported_records.inject({}) { |ha, val| ha[val] = true; ha}\\n\"\n code << \" @items = Nomen::#{controller_name.camelcase}.select_without already_imported\\n\"\n code << \"end\\n\"\n\n code << \"def incorporate\\n\"\n code << \" reference_name = params[:#{record_name}][:reference_name]\\n\"\n code << \" if Nomen::#{controller_name.camelcase}[reference_name]\\n\"\n code << \" begin\\n\"\n code << \" @#{record_name} = #{model.name}.import_from_nomenclature(reference_name, true)\\n\"\n code << \" notify_success(:record_has_been_imported)\\n\"\n code << \" rescue ActiveRecord::RecordInvalid => e\\n\"\n code << \" notify_error :record_already_imported\\n\"\n code << \" end\\n\"\n code << \" redirect_to(params[:redirect] || :back) and return\\n\"\n code << \" else\\n\"\n code << \" @#{record_name} = resource_model.new(#{values})\\n\"\n code << \" @items = Nomen::#{controller_name.camelcase}.selection\\n\"\n code << \" notify_error :invalid_reference_name\\n\"\n code << \" end\\n\"\n code << \" render 'pick'\\n\"\n code << \"end\\n\"\n\n class_eval(code)\n end",
"def active_model_really_sucks\n Class.new(Validator).tap do |v|\n v.model_name = model_name\n end\n end",
"def create\n @use = Use.new(params[:use])\n\n respond_to do |format|\n if @use.save\n format.html { redirect_to(@use, :notice => 'Use was successfully created.') }\n format.xml { render :xml => @use, :status => :created, :location => @use }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @use.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def model\n return @model\n end",
"def model\n return @model\n end",
"def model=(model)\n @model = model\n end",
"def new\n @use = Use.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @use }\n end\n end",
"def model()\n @props[:model]\n end",
"def create\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @operation = Operation.new(params[:operation])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.save\n if @model\n @operation.dependent.models << @model\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'Operation was successfully created.' }\n else\n format.html { redirect_to root_path, notice: 'Operation was successfully created.' }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def model\n self\n end",
"def get_model\n return model_classes[item_type].new()\n end",
"def new\n @user = current_user\n @model = Model.find(params[:model_id])\n @operation = Operation.new\n @distributions = @model.distributions\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation }\n end\n end",
"def models\r\n\r\n end",
"def model_class; end",
"def model_class=(_arg0); end",
"def couchrest_model\n ## TODO - deprecate this method\n return if self.term.nil? || instance_database.nil? || self.vocabulary.nil?\n \n write_attribute(:instance_class_name, self.term.singularize.camelize)\n\n if Object.const_defined?(self.instance_class_name.intern)\n klass = Object.const_get(self.instance_class_name.intern)\n else\n db = instance_database\n prop_list = self.vocabulary.properties.inject([]) {|plist, p| plist << p}\n type_list = self.vocabulary.types.inject([]) {|tlist, t| tlist << t} \n \n klass = Object.const_set(self.instance_class_name.intern, \n Class.new(CouchRest::Model::Base) do\n use_database db\n prop_list.each {|p| property p.term.to_sym}\n property :serial_number\n property :data_source_id\n timestamps!\n\n # type_list.each |t| do\n # property t.to_sym do\n # t.properties.each {|tp| property tp.term.to_sym}\n # end\n # end\n # \n design do\n view :by_serial_number\n view :by_data_source_id\n end\n \n end\n )\n end\n klass\n end",
"def model\n @model ||= Model.new(self)\n end",
"def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n @use_case.hard_infos.last.save\n #--\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @use_case }\n format.json { render :show, status: :created, location: @use_case }\n else\n format.html { render :new }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reports_on(model)\n @@model = model.to_s.classify\n end",
"def api_model\n api_model_nane.constantize\n end",
"def create\n\n\n@need = Need.new()\n@need.firstname = params[:need][:firstname]\n@need.lastname = params[:need][:lastname]\n@need.color = params[:need][:color]\n@need.manufacturer = params[:need][:manufacturer]\n# create an instance/object of a BasicCar\nmyNeed = BasicNeed.new(2000, @need.manufacturer, @need.color)\n# add the extra features to the new need\nif params[:need][:milk].to_s.length > 0 then\nmyNeed = MilkDecorator.new(myNeed)\nend\nif params[:need][:egg].to_s.length > 0 then\nmyNeed = EggDecorator.new(myNeed)\nend\nif params[:need][:bread].to_s.length > 0 then\nmyNeed = BreadDecorator.new(myNeed)\nend\n## populate the cost and the description details\n@need.cost = myNeed.cost\n@need.description = myNeed.details\n\n# Singleton Logg\nlogger = SpLogger.instance\nlogger.logInformation(\" A new Basic Need is added:\" + @need.description)\n\nrespond_to do |format|\nif @need.save\nformat.html { redirect_to @need, notice: 'need was successfully created.'}\nformat.json { render :show, status: :created, location: @need }\nelse\nformat.html { render :new }\n\nformat.json { render json: @need.errors, status: :unprocessable_entity }\nend\nend\nend",
"def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end",
"def initialize\n # this hash maps models to layout names \n @special_layout = {\n Contribution => \"Language_contributors (table)\",\n MeaningsVerb => \"Verb_meanings (table)\",\n ExamplesVerb => \"Verb_examples (table)\",\n Languageref => \"Languages (Editors' layout)\",\n AlternationValuesExample => \"Alternation_value_examples (table)\",\n CodingFrameExample => \"Verb_coding_frame_examples (table)\",\n CodingFrameIndexNumbersMicrorole => \"Coding_frame_Microrole_index_numbers (table)\"\n }\n # this hash maps a model to a hash from property name to FileMaker field name\n @special_field_name = { # FileMaker field names must be in lowercase!\n Alternation => {\n 'coding_frames_text' => 'coding_frames_of_alternation',\n 'complexity' => 'simplex_or_complex'\n },\n GlossMeaning => {\n 'comment' => 'gloss_meaning_comments::comments'\n },\n Example => {\n 'person_id' => 'source_person_id'\n },\n Meaning => {\n 'meaning_list' => 'z_calc_meaning_list_core_extended_new_or_old'\n },\n Language=> {\n 'name_for_url' => 'z_calc_language_name_for_url'\n },\n Languageref=> {\n 'id' => 'language_id',\n 'name' => 'language_name',\n 'nodata' => 'z_calc_alternation_occurs_nodata_percent'\n },\n CodingFrame => {\n 'derived' => 'z_calc_basic_or_derived'\n },\n Person => {\n 'email' => 'email_address',\n 'affiliation' => 'academic affiliation',\n 'photo_url' => 'photo url'\n },\n Verb => {\n 'verb_type' => 'v_type'\n }\n }\n end",
"def check_resource\n resource.singular ||= @res.singular.to_s\n resource.plural ||= @res.plural.to_s\n resource.model ||= @res.singular.camelize.constantize\n resource.name_prefix ||= @res.name_prefix || ''\n resource.model_name = resource.model.class_name.to_s # Always should be te same as resource.model.class_name\n rescue => e\n raise StandardError.new(\"** AutoRest: model not found supplying defaults for #{@res.singular.camelize}.\\n#{e.message}\")\n end",
"def model(main_model, options={})\n self.model_options = [main_model, options]\n end"
] | [
"0.6901091",
"0.6357704",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6298928",
"0.6223855",
"0.6204241",
"0.6204241",
"0.6204241",
"0.61900246",
"0.61843157",
"0.61738276",
"0.61738276",
"0.60918623",
"0.60771483",
"0.60135365",
"0.59542626",
"0.59321606",
"0.59163785",
"0.5895136",
"0.5889022",
"0.5889022",
"0.5889022",
"0.5889022",
"0.5869042",
"0.5869042",
"0.5869042",
"0.5869042",
"0.5855428",
"0.58264726",
"0.5819148",
"0.58025306",
"0.5757615",
"0.573563",
"0.5714129",
"0.56929886",
"0.56863594",
"0.56863594",
"0.56863594",
"0.5684535",
"0.5684382",
"0.5658873",
"0.5658682",
"0.5645549",
"0.5636337",
"0.5636337",
"0.56239766",
"0.56208766",
"0.5619548",
"0.5615963",
"0.561308",
"0.56099206",
"0.56099206",
"0.5594947",
"0.5594947",
"0.5590453",
"0.55900276",
"0.5588946",
"0.55794835",
"0.55687135",
"0.55599225",
"0.5517199",
"0.5501318",
"0.54919714",
"0.5489383",
"0.5484012",
"0.5479669",
"0.5478587",
"0.54738533",
"0.5469294",
"0.5463201",
"0.54601073",
"0.5459114",
"0.5459114",
"0.5458526",
"0.5454378",
"0.5452842",
"0.5442888",
"0.5437765",
"0.54343045",
"0.54128206",
"0.5406645",
"0.5390618",
"0.5387462",
"0.5384387",
"0.5382035",
"0.53742224",
"0.5372148",
"0.5364211",
"0.535223",
"0.53508157",
"0.5347696",
"0.5342819",
"0.5338804"
] | 0.0 | -1 |
pass in a user_id and period in params and it will find the next or previous fab | def cycle_fab_by_period(direction, params)
user = User.find(params[:user_id])
current_fab = find_or_create_base_fab(user, params)
@fab = (direction == :forward) ? current_fab.exactly_next_fab : current_fab.exactly_previous_fab
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_fab\n fab = self.user.fabs.where('period > ?', self.period).last\n end",
"def previous_fab\n self.user.fabs.where('period < ?', self.period).first\n end",
"def find_or_create_base_fab(user, params)\n t = DateTime.parse(params[:fab_period])\n user.fabs.where(period: t..(t+7)).limit(1).first or\n user.fabs.build(period: t)\n end",
"def exactly_next_fab(include_hypothetical_fab = true)\n fab = self.user.fabs.where(period: period+1.week-1.day..period+2.weeks-1.day).last\n fab = self.user.fabs.build(period: period+1.week) if include_hypothetical_fab and fab.nil?\n fab\n end",
"def next_fab\n user = User.find(params[:user_id])\n current_fab = Fab.find(params[:fab_id])\n @fab = current_fab.next_fab\n\n render text: \"no such fab\" and return if @fab.nil?\n\n @previous_fab_exists, @next_fab_exists = @fab.which_neighbor_fabs_exist?\n\n render '/tools/ajax_forward_back.html.erb', layout: false\n end",
"def exactly_previous_fab(include_hypothetical_fab = true)\n fab = self.user.fabs.where(period: period+1.day-2.week..period+1.day-1.week).last\n fab = self.user.fabs.build(period: period-1.week) if include_hypothetical_fab and fab.nil?\n fab\n end",
"def next_due_link(current_user)\n @assignment = current_user.assignments.first\n unless @assignment.nil?\n \"/assignments/#{@assignment.id}/edit\"\n end\n\tend",
"def set_period\n @period = Period.joins(:budget).where(user: current_user).find(params[:period_id] || params[:id])\n end",
"def switchPeriod\n if params[:periode] == \"année\"\n visitors_by_months\n elsif params[:periode] == \"mois\"\n visitors_by_weeks\n elsif params[:periode] == \"personnalisé\"\n p \"params[:presonnalize_date] =>>>> #{params[:presonnalize_date]}\"\n dates = params[:presonnalize_date]\n if dates.present?\n @start = Date.parse(dates.split(' to ')[0])\n p \"start at :#{ @start}\"\n @end = Date.parse(dates.split(' to ')[1])\n p \"end at :#{ @end}\"\n rang = (@end-@start).to_i\n p \"rang is at: #{ rang}\"\n if rang < 8\n charts_visitors_by_days_path(params1: @start, params2: @end)\n elsif rang < 31\n\n charts_visitors_by_weeks_path\n\n else\n visitors_by_months\n end\n end\n else\n charts_visitors_by_days_path\n end\n\n end",
"def one_user\n @user = User.find(params[:user_id])\n @date = (params[:date])? Date.parse(params[:date]) : Date.today\n \n next_3_days_date = @date + 3\n todos = DailyTodo.all(\n :conditions => [\"user_id = ? AND (date <= ? AND date >= ?)\", params[:user_id], next_3_days_date, @date - ONE_WEEK + 1],\n :order => 'date' # ASC because \"range\" below is increasing\n )\n range = (@date - ONE_WEEK + 1)..next_3_days_date\n \n @todos = if todos.empty?\n range.map do |date|\n DailyTodo.new(:user_id => @user.id, :date => date)\n end\n else\n i = 0\n range.map do |date|\n if i >= todos.size || date < todos[i].date\n DailyTodo.new(:user_id => @user.id, :date => date)\n else\n i += 1\n todos[i - 1]\n end\n end\n end\n \n @todos.reverse!\n end",
"def next\r\n\r\n User.first(:order => 'users.id', :conditions => [\"users.id > ?\", self.id])\r\n end",
"def next_oncall_shift(user_id, api_token)\n url = \"https://api.pagerduty.com/oncalls?user_ids[]=#{user_id}&since=#{Time.now.utc.iso8601}&until=#{(Time.now + 86400 * 7).utc.iso8601}\"\n uri = URI.parse(url)\n\n request = Net::HTTP::Get.new(uri)\n request['Content-Type'] = 'application/json'\n request['Accept'] = 'application/vnd.pagerduty+json;version=2'\n request['Authorization'] = \"Token token=#{api_token}\"\n\n response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n if response.code == '200'\n data = JSON.parse(response.body)\n oncalls = data['oncalls']\n\n next_oncall = oncalls.find { |oncall| !oncall['end'].nil? && Time.parse(oncall['end']) > Time.now }\n if !next_oncall.nil?\n start, finish = Time.parse(next_oncall['start']), Time.parse(next_oncall['end'])\n\n if start < Time.now\n return \"now (ends in #{((finish - Time.now) / 3600.0).round} hours)\"\n end\n\n diff = ((start - Time.now) / 3600.0).round\n\n return \"#{diff} hours\"\n else\n return \"not found\"\n end\n else\n raise StandardError.new(\"Error fetching on-call shifts: #{response.code} #{response.message}\")\n end\nend",
"def go_to_date_link(user)\n\t\tdynamic_range\n\t\t@base_path = root_path+\"users/#{user.id}/scrapbook/#{@destination}\"\n\tend",
"def get_active_period\n # puts 'ejecutando get_active_period'\n @active_period = current_user.periods.active\n # puts 'get_active_period ejecutado'\n end",
"def balance_operations_by_user(id, page:, per_page:)\n required_interval = discount_intervals\n .by_account(id)\n .page(page)\n .per_page(per_page)\n .to_a\n return [] if required_interval.empty?\n\n to = required_interval.first[:date_interval].end_of_day.to_i\n from = required_interval.last[:date_interval].to_i\n load_balance_history id, from, to\n end",
"def next_user\n redirect_to_next_object(:next, User, params[:id].to_s)\n end",
"def prev_user\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end",
"def prev_user # :norobots:\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end",
"def index\n #temp current user\n # @current_user = User.first\n\n @tab_class = Hash.new\n @tab_class = {:followers => 'btn-deactive', \n :not_followers => 'btn-deactive', \n :cafes => 'btn-deactive', \n }\n @tab = params[:tab]? params[:tab] : 'followers'\n @tab_class[@tab.to_sym] = 'btn-active'\n\n page_num = params[:page]? params[:page] : 1\n\n case params[:tab]\n when 'not_followers'\n @users = User.not_followers(@current_user,page_num)\n when 'cafes'\n @users = User.cafes(@current_user,page_num)\n else \n @users = User.followers(@current_user,page_num) \n end\n end",
"def index\n if params[:transac_period]\n @params_period=params[:transac_period].to_i\n else\n @params_period=nil\n end\n @spendings=nil\n \n if @params_period!=6\n #return the start date based on params[:transac_period]. If there is no parameter, use 7 days ago as default.\n @start_date= return_start_date(@params_period)\n @spendings=Spending.find_spendings(@start_date,session[:user_id]).paginate(page:params[:page]) \n else\n @spendings=Spending.all.where(:user_id=>session[:user_id]).paginate(page:params[:page])\n if (@spendings.last)\n @start_date=@spendings.last.transaction_date_d\n end\n end\n # in case that user hasn't input anything in the specified period.\n if (@spendings!=nil &&@spendings.count>0)\n @start_date=@spendings.last.transaction_date_d\n @end_date=@spendings.first.transaction_date_d\n end\n @text=return_text(@params_period)\n # Advance search implementation\n \n if params[:id]\n @advance_search=AdvanceSearch.find(params[:id])\n @spendings=@advance_search.transactions.where(:user_id=>session[:user_id]).paginate(page:params[:page])\n if @spendings.count>0\n @start_date=@spendings.last.transaction_date_d\n @end_date=@spendings.first.transaction_date_d\n end\n #define class to display tab\n @normal_search_class=\"\"\n @advance_search_class=\"active\" \n # define class to display normal search form or advance_search form\n @normal_search_class2=\"no_display\"\n @advance_search_class2=\"\"\n else\n @advance_search=AdvanceSearch.new\n #define class to display tab\n @normal_search_class=\"active\"\n @advance_search_class=\"\" \n # define class to display normal search form or advance_search form\n @normal_search_class2=\"\"\n @advance_search_class2=\"no_display\"\n end\n \n respond_to do |format|\n format.html{}\n format.csv{send_data Spending.to_csv(@spendings)}\n format.xls\n end\n end",
"def next_user # :norobots:\n redirect_to_next_object(:next, User, params[:id].to_s)\n end",
"def go_next\n authorize! :go_next, League, :message => \"Non puoi modificare le impostazioni della lega\"\n lega = League.find(current_user.league_id)\n #controllo solo per evitare il doppio click su go next day, controlla\n #che la differenza il giorno tra successivo e il giorno dell'ultima formazione\n #creata dagli utenti non sia maggiore di uno\n if( lega.current_day <= lega.votes_day )\n lega.current_day += 1\n lega.save\n redirect_to '/leagues/score/rate'\n else\n flash[:danger] = \"Attenzione: non puoi calcolare i punteggi della giornata corrente se i voti non sono della medesima giornata\"\n redirect_to '/leagues/score/rate'\n end\n end",
"def future\n if @user\n @enrollments = @user.enrollments.future\n add_breadcrumb 'Future', future_user_enrollments_path(@user)\n end\n index\n end",
"def show\n @account = Account.find(params[:id])\n if @account.user_id != current_user.id\n raise Forbidden\n end\n account_last = Account.find(:last)\n account_first = Account.find(:first)\n next_id = @account.id\n previous_id = @account.id\n \n \n while(account_last.id >= next_id)\n next_id += 1\n @next = Account.where('id = ? AND user_id = ?',next_id,current_user.id)\n if @next.present?\n @next = Account.find_by_id(next_id)\n break\n end\n end\n \n while(account_first.id <= previous_id)\n previous_id -= 1\n @previous = Account.where('id = ? AND user_id = ?',previous_id,current_user.id)\n if @previous.present?\n @previous = Account.find_by_id(previous_id)\n break\n end\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def period_params\n params.require(:period).permit(:start_date, :end_date, :user_id)\n end",
"def current_period_and_client\n Period.where([\"currentperiod = ? and client_id = ?\", \"t\", current_user.client_id]).first\n end",
"def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end",
"def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end",
"def show\n @user = User.find(params[:id])\n redirect_to users_path, alert: 'アクセス権限がありません' unless current_user.id == @user.id || current_user.id == @user.superior_user.id || current_user.admin?\n if current_user.normal?\n @self_answers = Answer.where(answering_user_id:current_user.id,answered_user_id: current_user.id, period_id: params[:period_id])\n @answers = Answer.where(answering_user_id: current_user.superior_user.id, answered_user_id: current_user.id, period_id: params[:period_id])\n elsif current_user.manager?\n @self_answers = Answer.where(answering_user_id: @user.id,answered_user_id: @user.id, period_id: params[:period_id])\n @answers = Answer.where(answering_user_id: current_user.id,answered_user_id: @user.id, period_id: params[:period_id])\n elsif current_user.executive?\n @self_answers = Answer.where(answering_user_id: @user.id,answered_user_id: @user.id, period_id: params[:period_id])\n @answers = Answer.where(answering_user_id: current_user.id,answered_user_id: @user.id, period_id: params[:period_id])\n elsif current_user.admin?\n @self_answers = Answer.where(answering_user_id: @user.id,answered_user_id: @user.id, period_id: params[:period_id])\n @answers = Answer.where(answering_user_id: @user.superior_user.id,answered_user_id: @user.id, period_id: params[:period_id])\n @answered_user = @user\n @answering_user = @user.superior_user\n end\n end",
"def nextTasks\n @user = current_user\n if current_user.admin? and params[:user_id]\n @user = current_user.company.users.find(params[:user_id])\n end\n\n html = render_to_string :partial => \"tasks/next_tasks_panel\", :locals => { :count => params[:count].to_i, :user => @user }\n render :json => { :html => html, :has_more => (@user.tasks.open_only.not_snoozed.count > params[:count].to_i) }\n end",
"def set_next\n @activity_sequence = ActivitySequence.find(params[:id]) \n @activity_sequence.set_next\n redirect_to myp_path(@activity_sequence.current_activity)\n end",
"def get_next_task\n sp = current_user.service_provider\n task = sp.get_next_task(belongs_to_common_pool?,belongs_to_back_office?,belongs_to_front_office?)\n if task\n task.update_attributes(:assigned_to_user_id=>sp.user.id,:assigned_by_user_id=>nil)\n flash[:notice] = t(:flash_new_task_from_queue)\n else\n flash[:error] = t(:warning_task_not_found)\n end\n redirect_to(:action => 'index')\n end",
"def next\n self.class.first(\n :conditions => {\n :user_id => self.user_id,\n :id_gt => self.id})\n end",
"def index\n #This clamps the offset and limit values between 0 and Event.count-1, since there isnt a clamp function in ruby\n offset = [0, params[:offset].to_i, User.count-1].sort[1]\n #This also clamps, between 1 and 5\n limit = [1, params[:limit].to_i, 5].sort[1]\n #Sort asc since that means start from id 1 and work upwards\n @users = User.all.offset(offset).limit(limit)\n\n count = @users.count\n\n #If the offset + limit selects higher items than there is, no next_link\n if offset+limit >= User.count\n next_link = nil\n elsif count < User.count\n next_link = \"http://localhost:3000/api/v1/users/?offset=#{offset+limit}&limit=#{limit}\"\n else\n next_link = nil\n end\n #If the offset is larger than 0, there must be atleast 1 item before\n if offset > 0 && User.count > 0\n #Do note that offset - limit can become negative, but since offset gets clamped, it doesn't really matter\n previous = \"http://localhost:3000/api/v1/users/?offset=#{offset-limit}&limit=#{limit}\"\n else\n previous = nil\n end\n\n respond_with users: @users, total: User.count, limit: limit, offset: offset, next: next_link, previous: previous\n end",
"def update_holidays(id_usr , mode)\n #Trae todos los usuarios activos\n @users = User.find(id_usr)\n \n #Busca registro del usuario en tabla general\n holidays_general = Holidays.find(:all , :conditions => [\"period = ? and user_id = ?\" , @@today_year , @users.id]).first\n \n \n if mode == 'consumed' then\n #Sql para recuperar dias de vacaciones en el periodo\n sql_days =\" SELECT ifnull( sum( days ) , 0 )\n FROM holidays_users\n WHERE holidays_users.id_user = \" + id_usr.to_s + \"\n AND (date_from >= '\" + (@@today_year-1).to_s + \"-10-31')\n AND (date_to <= '\" + @@today_year.to_s + \"-10-31')\"\n \n #obtengo cantidad de dias del periodo\n sql_days_result = ActiveRecord::Base.connection.execute(sql_days)\n sql_days_result.each do | days |\n #Actualizo dias usados en el periodo\n holidays_general.days_consumed = days[0]\n end\n else\n #Sql para recuperar dias otorgados al usuario\n sql_free_days =\"SELECT ifnull( sum( days ) , 0 )\n FROM holidays_adds\n WHERE user_id = \" + id_usr.to_s + \"\n AND (date >= '\" + (@@today_year-1).to_s + \"-10-31')\n AND (date <= '\" + @@today_year.to_s + \"-10-31')\"\n \n #obtengo cantidad de dias del periodo\n sql_free_days_result = ActiveRecord::Base.connection.execute(sql_free_days)\n sql_free_days_result.each do | days |\n #Actualizo dias otorgados en el periodo\n holidays_general.days_free = days[0]\n end\n end\n \n #Actualizo dias totales\n holidays_general.diff = holidays_general.days + holidays_general.days_acum + holidays_general.days_free - holidays_general.days_consumed\n #Guardo\n holidays_general.save\n \n end",
"def set_and_authorize_period\n @period = Period.find(params[:id])\n authorize @period, \"#{action_name}?\".to_sym\n end",
"def user_tomorrow(user_id)\n return user_today(user_id) + 1\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 next_event_url\n user_event_path(user_id: @user.id, id: @next_event) if next_event?\n end",
"def next\n Job.generate_next_weeks_work_order\n redirect_to '/'\n end",
"def check_next_and_prev\n if params[:prev] == \"true\"\n if session[:from] - 12 >= 0\n session[:from] -= 12\n session[:to] -= 12\n end\n redirect_to recipes_path\n end\n\n if params[:next] == \"true\"\n if session[:to] + 12 <= session[:search_count]\n session[:to] += 12\n session[:from] += 12\n end\n redirect_to recipes_path\n end\n end",
"def follow\n\t\t@most_active_users.each do |user|\n\t\t\tpath = \"https://github.com/%s/followers\" % [user]\n\t\t\tnavigate(path)\n\n\t\t\tDEFAULT_NUMBER_PAGES.times do |page|\n\t\t\t\tfollow_button = find_many_elements_by_xpath(@follow_xpath)\n\t\t\t\tfollow_button.each { |follow_element| follow_element.submit; sleep 1 }\n\n\t\t\t\tnext_button = find_by_link_text('Next')\n\t\t\t\tnext_button.nil? ? break : next_button.click\n\t\t\tend\n\t\tend\n\tend",
"def get_dashboard user_id\n task = self.tasks.my_uncompleted(user_id).sorted.first\n if task.nil?\n if self.start_on > Date.today || self.expires_on < Date.today\n -1\n else\n -2 # -2 : no task currently - create one!\n end\n else\n task.percent_complete\n end\n end",
"def show\n @user = User.find(params[:id])\n #redirect_to new_user_profiles_path if @user.profile.nil?\n \n if params[:date_change] && params[:date_change][:date]\n if params[:date_change][:date].split(\"/\").size > 1\n session[:day] = Date.strptime(params[:date_change][:date], \"%m/%d/%Y\")\n elsif params[:date_change][:date].split(\"-\").size > 1\n session[:day] = Date.strptime(params[:date_change][:date], \"%Y-%m-%d\") \n end\n end\n \n @day = session[:day]\n @day_entries = @user.day_entries(@day)\n @day_target = @user.day_target(@day)\n \n @activities = @user.activities || []\n \n @from_date, @through_date = @user.get_digest_dates(session[:day])\n\n respond_to do |format|\n format.html { render \"show.html.haml\" }# show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n realtime_page_next_by_time Integer(params[:post_id]), Integer(params[:after]), Integer(params[:limit])\n end",
"def getNext(next_val, restriction, next_restriction)\n #if restriction.to_i == -20 && !session[:is_business_home] \n # next_restriction\n \tif restriction.to_i == -20 && session[:uso_de_suelo]\n \t\tnext_restriction\n \telse\n \t\tnext_val\n \tend\n end",
"def getNext(next_val, restriction, next_restriction)\n if restriction.to_i == -3 && session[:impacto_usuario] == -2\n next_restriction\n elsif restriction.to_i == 50 && session[:aforo] != nil && session[:aforo].to_i > 49\n next_restriction\n else\n next_val\n end\n end",
"def bill_user(user)\n active_merchant_stubs_payeezy\n Time.zone = user.club.time_zone\n diff_between_next_bill_date_and_today = user.next_retry_bill_date - Time.zone.now\n next_bill_date = user.next_retry_bill_date + user.terms_of_membership.installment_period.days\n user.update_attribute(:next_retry_bill_date, Time.zone.now)\n\n Time.zone = 'UTC'\n answer = user.reload.bill_membership\n Time.zone = user.club.time_zone\n user.update_attribute(:next_retry_bill_date, user.next_retry_bill_date + diff_between_next_bill_date_and_today)\n assert (answer[:code] == Settings.error_codes.success), answer[:message]\n\n visit show_user_path(partner_prefix: user.club.partner.prefix, club_prefix: user.club.name, user_prefix: user.id)\n within('#table_membership_information') do\n find('#td_mi_next_retry_bill_date', text: I18n.l(next_bill_date, :format => :only_date))\n assert page.has_content?(I18n.l user.active_credit_card.last_successful_bill_date, :format => :only_date)\n end\n\n within('.nav-tabs') { click_on 'Operations' }\n within('#operations') { assert page.has_content?(\"Member billed successfully $#{user.terms_of_membership.installment_amount}\") }\n\n within('.nav-tabs') { click_on 'Transactions' }\n within('#transactions') do\n assert page.has_selector?('#transactions_table')\n Transaction.all.each do |transaction|\n assert(page.has_content?('Transaction Normal - Approved with Stub') || page.has_content?('Sale : This transaction has been approved with stub'))\n end\n assert page.has_content?(user.terms_of_membership.installment_amount.to_s)\n end\n\n within('#transactions_table') { assert page.has_selector?('#refund') }\n user.transactions.where('operation_type = 101').order(:created_at).last\n end",
"def seek #DESC by date.here\n \n args = {sort: \"-contribution_receipt_date\", api_key: API_KEY[:fec], committee_id: id, per_page: 100, last_index: @last_index, last_contribution_receipt_date: @last_date}\n json = JSONByURL.new(\"https://api.open.fec.gov/v1/schedules/schedule_a?\" + args.build_params)\n\n res = json.snag.json #fix \n\n #log page info, number results, last index retrieved\n donations = res[\"results\"]\n @record_count = res[\"pagination\"][\"count\"] if @record_count.nil? #initial population of instance variable that knows total records in dataset for user experience info\n if @save_record_info_to_db\n @committee.update(num_records_available: @record_count) #update committee with total available on first download this instance\n @save_record_info_to_db = false\n end\n\n @num_accessed += donations.count #Log how many records we have accessed so far so we don't download Nancy Pelosi's donor base from 1987 and blow our API KEY\n donations.select! {|d| d[\"is_individual\"]} #MUTATES ARRAY!!!! KEEPS ONLY WHERE FIELD is_individual = true, AVOIDING DUPLICATE RECORDS FROM INTERNAL MEMOS\n \n #build an array of hashes of 2-element hashes (:donation & :donor) to pass to save_donation method\n page = donations.map {|d| {:donation=> {amount: d[\"contribution_receipt_amount\"], date: d[\"contribution_receipt_date\"]}, :donor=> {zip: d[\"contributor_zip\"], name: d[\"contributor_name\"], street_1: d[\"contributor_street_1\"], street_2: d[\"contributor_street_2\"], employer: d[\"contributor_employer\"], state: d[\"contributor_state\"], city: d[\"contributor_city\"], occupation: d[\"contributor_occupation\"], line_number: d[\"line_number\"]}}} \n @last_index = res[\"pagination\"][\"last_indexes\"][\"last_index\"] #set pagination\n @last_date = res[\"pagination\"][\"last_indexes\"][\"last_contribution_receipt_date\"] #set pagination part 2\n \n # puts \"#{last_index} #{last_date}\"\n page.each {|item| save_donation(item)}\n pct_done = (@num_accessed.to_f / @stop_after * 100).round(1) #xx.x% format for progress downloading records per flags [flags to:do]\n puts \"#{pct_done}% complete. Downloaded #{@num_accessed} of #{@stop_after} from a total of #{@record_count} records.\"\n @num_accessed < @stop_after ? seek : @committee.update(last_date: @last_date, last_index: @last_index, num_records_downloaded: @num_accessed + (@committee.num_records_downloaded || 0)) #keep seeking.....if done, push last record retrieved into db\n # res #un-comment to view JSON data for this page\n end",
"def user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation, period_attributes:[:start_date, :end_date, :user_id])\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def schedule_future_check_out(user, future_date)\n\n end",
"def next_service_billing_period\n if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending?\n payment = self.purchase_order.payments.recurring.find(:all, :order => \"payments.id ASC\").last\n (self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.interval_length.to_i.send(payment.interval_unit || :month)))\n end\n end",
"def next_cycle\n pre_cycle\n user_cycle\n after_cycle\n end",
"def api_url(period)\n %r{https://api.meetup.com/2/events.*status=#{period}}\nend",
"def retrieve_date_range\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\n end",
"def next_follow\n end",
"def calculate_next(date, vendor, lead_time)\n next_at = nil\n if self.frequency_id == 1\n #\n # Daily frequency:\n # is based on incrementing from tomorrow until first selected day is found\n #\n if self.frequency_data_1_days.include?(true)\n next_at = date #+ 1.day\n next_at += 1.day until self.frequency_data_1_days[WEEKDAYS[next_at.wday] - 1]\n end\n elsif self.frequency_id == 2\n #\n # Weekly frequency\n # is based on looking for beginning of week with shifting to selected\n # weekday and in case that found weekday is before current weekday\n # it will shift to next cycle.\n #\n day_index = self.frequency_data_2_day_of_week - 1\n # skip_difference = ((date.beginning_of_week.to_date - self.start_at.in_time_zone(vendor.time_zone).beginning_of_week.to_date).to_i / 7) % self.frequency_data_2_every\n # skip = self.frequency_data_2_every - (skip_difference + 1)\n next_at = date.beginning_of_week + day_index.days #+ skip.week\n if next_at < date\n next_at += self.frequency_data_2_every.weeks\n end\n elsif self.frequency_id == 3\n if self.frequency_data_3_type == \"day\"\n #\n # Monthly frequency with day of a month\n # is based on looking for beginning of month with shifting to selected\n # monthday and in case that found monthday is before current monthday\n # it will shift to next cycle.\n #\n # day of a month\n day_index = self.frequency_data_3_month_number - 1\n # skip_difference = (date.month - self.start_at.in_time_zone(vendor.time_zone).month) % self.frequency_data_3_every\n # skip = self.frequency_data_3_every - (skip_difference + 1)\n next_at = (date.beginning_of_month + day_index.days) #+ skip.month\n if next_at < date\n next_at += self.frequency_data_3_every.month\n end\n else\n # Monthly frequency with weekday of a month\n # is based on looking for beginning of month and selected 1st/2nd/3rd/4th\n # weekday of a month and in case that found monthday is before current\n # monthday it will shift to next cycle.\n # skip = (date.month - self.start_at.in_time_zone(vendor.time_zone).month) % self.frequency_data_3_every\n next_at = self.month_weekday_date(date, 0, self.frequency_data_3_week_number, self.frequency_data_3_type.to_i - 1)\n if next_at < date\n next_at = self.month_weekday_date(next_at, self.frequency_data_3_every, self.frequency_data_3_week_number, self.frequency_data_3_type.to_i - 1)\n end\n end\n else\n next_at = nil\n end\n\n # check if standing_order end_at options apply\n if next_at && ( ( self.end_at_id == 1 && self.standing_order_schedules.where(visible: true).count >= self.end_at_data_1_after ) || ( self.end_at_id == 2 && next_at >= self.end_at_data_2_by.in_time_zone(vendor.time_zone) ) )\n next_at = nil\n end\n if next_at && next_at <= (Date.current + 3.months).end_of_month\n schedule = self.standing_order_schedules.find_or_create_by(deliver_at: next_at.in_time_zone(vendor.time_zone))\n schedule.visible = true\n schedule.recalculate_dates(vendor, self, lead_time)\n schedule.save\n next_at = find_next_date(next_at)\n self.calculate_next(next_at.to_date, vendor, lead_time) if next_at\n end\n end",
"def index\n @activities = if params[:past]\n @group.activities\n .where('start < ?', Time.zone.now)\n .order(start: :desc)\n .paginate(page: params[:page], per_page: 25)\n else\n @group.activities\n .where('start > ?', Time.zone.now)\n .order(start: :asc)\n .paginate(page: params[:page], per_page: 25)\n end\n end",
"def show\n @user=User.find(params[:id])\n @question=Question.where(:user_id => @user.id).paginate(:per_page => 14, :page => params[:page])\n @answer=Answer.where(:user_id => @user.id).paginate(:per_page => 14, :page => params[:page])\n @followers=@user.followers(User)\n end",
"def index\n @days = current_user.days.paginate(page: params[:page], per_page: 7)\n end",
"def lecture_period\n @event = Event.first\n if (@event.activity_begin_day < DateTime.now && DateTime.now < @event.activity_end_day) || !current_user.adm?\n redirect_to lectures_path\n flash[:info] = \"Palestra nao disponivel!\"\n end\n end",
"def next_by(field)\n \t\t\tstep_by(field, :next)\n \t\tend",
"def next_seven_days\n\t\tif signed_in? \n\t\t\t@user = User.find(current_user.id)\n\t\t\t# @overdue_tasks = overdue_tasks(@user.id)\n\t\t\tputs \"calling overdue_tasks\"\n\t\t\tset_overdue_tasks(@user.id)\n\t\t\t# puts @overdue\n\t\t\tputs \"IN next_seven_days ACTION OF USERS\"\n\t\t\t#puts \"current user: \" + current_user.id.to_s\n\t\t\t@next_seven = get_next_seven_days(current_user.id)\n\t\t\t@next_seven.each do |day|\n\t\t\t\tputs day.day + \" id: \" + day.id.to_s\n\t\t\tend\n\t\t\tputs \"count: \" + @next_seven.count.to_s\n\t\t\t@first_day = @next_seven[0]\n\t\t\t@second_day = @next_seven[1]\n\t\t\t@third_day = @next_seven[2]\n\t\t\t@fourth_day = @next_seven[3]\n\t\t\t@fifth_day = @next_seven[4]\n\t\t\t@sixth_day= @next_seven[5]\n\t\t\t@seventh_day = @next_seven[6]\n\n\t\t\t@tags = get_tags_for_next_seven_days(@next_seven)\n\t\t\t@alltags = Tag.where(user_id: @user.id)\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\tend",
"def show\n #temp current user\n # @current_user = User.last\n\n\n if @current_user.id == @user.id\n\tredirect_to setting_path\n else \n @tab_class = Hash.new\n @tab_class = {\n :profile => 'btn-deactive', \n :message => 'btn-deactive', \n }\n @tab = params[:tab]? params[:tab] : 'profile'\n @tab_class[@tab.to_sym] = 'btn-active'\n\n respond_to do |format|\n\n # following, alarm event를 선택했을 \n if params[:trigger_element]\n trigger_element = params[:trigger_element]\n \n @rel = @current_user.relations.where(:user_from => @current_user.id, :user_to => @user.id)\n\n if trigger_element == 'following'\n if @rel.count == 0\n @rel = Relation.create!(:user_from => @current_user.id, :user_to=> @user.id)\n else\n @rel = @rel[0]\n @rel.destroy\n end\n else\n @rel = @rel[0]\n case trigger_element\n when 'event_entry'\n @rel.event_entry =! @rel.event_entry\n when 'event_exit'\n @rel.event_exit =! @rel.event_exit\n when 'event_post'\n @rel.event_post =! @rel.event_post\n end\n @rel.save\n end\n format.js {render action: 'show'}\n else\n if params[:tab] == 'message'\n page_num = params[:page]? params[:page] : 1\n @messages = @user.messages.page(page_num)\n end\n\n format.html { render action: 'show' }\n end\n end\nend\n end",
"def set_fabmoment\n @fabmoment = Fabmoment.find(params[:id])\n end",
"def user_payment_callback\n @user = User.find_by(bill_id: params[:id])\n @user.skip_icpassport_validation = true\n @last_ezi = User.all.where.not(:ezi_id => nil).order(:ezi_id).last.ezi_id.gsub(/[^0-9]/, '').to_i\n @ezi_id = @last_ezi + 1\n @ezi_id_string = \"Q\" + @ezi_id.to_s.rjust(4,'0')\n @expiry = @user.package * 365\n response = BillplzReg.check_status(@user.id)\n if (response['paid'] == true) && (response['state']=='paid')\n @user.update_attributes(status: 1, :ezi_id => @ezi_id_string, :expiry => @expiry.days.from_now)\n render body: nil\n end\n end",
"def periode\n @debut = params[:debut]\n @fin = params[:fin]\n @query = Alerte.where(created_at: params[:debut]..params[:fin]).order(created_at: :desc)\n render layout: 'fylo'\n end",
"def next_calendar_url\n if params[:event_search_form].present?\n events_path(date: (@start_date + 1.month), event_search_form: params[:event_search_form])\n else\n events_path(date: (@start_date + 1.month))\n end\n end",
"def referral\n time_key = Time.now.strftime \"%Y-%m-%dT%H\"\n $redis.sadd \"rfr:#{@account}:days\", Date.today\n $redis.incr \"rfr:#{@account}:#{@client}:#{Date.today}\"\n $redis.incr \"rfr:#{@account}:#{Date.today}\"\n $redis.incr \"rfr:#{@account}:#{@client}:#{time_key}\"\n $redis.expire \"rfr:#{@account}:#{time_key}\", 3.weeks.to_i\n\n render :json => { :status => \"Success\" }\n end",
"def next\n self.class.where(:created_at.gt => created_at).order(created_at: :desc).first\n end",
"def previous(id)\n\t\t@language = MessengerBot.new.get_language(id)\n\t\tcolumns = VaccinationSchedule.column_names \n\t\ttoday = Date.today\n\t\tprevious_vaccine = []\n\t\tfor i in VACCINE_COLUMNS_INDEX_STARTS_AT..columns.length-1 \n\t\t\tuser = VaccinationSchedule.select(\"#{columns[i]}\").where(\"#{columns[i]} < ? AND parent_facebook_userid = ?\",today,id).to_a\n\t\t\tdefault_record = DefaultVaccineSchedule.where(\"vaccine_name = ?\",columns[i])\n\t\t\tif user.any? then\n\t\t\t\tnew_vaccine_date = user[0][\"#{columns[i]}\"]\n\t\t\t\tvaccine_url \t = default_record[0][\"url\"]\n\t\t\t\tnew_vaccine ={\n\t\t\t\t\t\"vaccine_name\": \"#{columns[i]}\",\n\t\t\t\t\t\"due_date\": \"#{new_vaccine_date}\",\n\t\t\t\t\t\"url\": \"#{vaccine_url}\"\n\t\t\t\t}\n\t\t\t\tprevious_vaccine.insert(0,new_vaccine)\n\t\t\tend\n\t\tend\n\t\tif previous_vaccine.length > 0 then\n\t\t\tMessengerBot.say(id,LIST_OF_PROVIDED_VACCINES_TEXT[\"#{@language}\"])\n\t\t\tMessengerBot.new.display_vaccination_dates(id,previous_vaccine)\n\t\telse\n\t\t\tMessengerBot.say(id,REGISTERED_WITH_FUTURE_DATE_TEXT[\"#{@language}\"])\n\t\tend\n\t\t\n\n\t\tBot.on :message do |message|\n\t\t\tid = message.sender[\"id\"]\n\t\t\tMessengerBot.call_message(id,message.text)\n\t\tend\n\n\t\tBot.on :postback do |postback|\n\t\t\tid = postback.sender[\"id\"]\n\t\t\tMessengerBot.call_postback(id,postback.payload)\n\t\tend\n\tend",
"def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend",
"def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend",
"def show\n\n # Get base API Connection\n @graph = Koala::Facebook::API.new(session[:access_token])\n\n # Get public details of current application\n #@app = @graph.get_object(ENV[\"FACEBOOK_APP_ID\"])\n\n\n @user = User.find(params[:id])\n @plans = @user.plans.all\n\n @upcoming_plans = @user.plans.find(:all, :conditions => [\"plandate >= ?\", Date.today]).sort_by { |obj| obj.plandate }\n #@past_plans = @user.plans.find(:all, :conditions => [\"plandate < ?\", Date.today]).sort_by { |obj| obj.plandate }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @meetings = current_user.meetings \n \n @meeting_prev = current_user.meetings.where('date < ?' ,Date.today).order(:date)\n @meeting_next = current_user.meetings.where('date > ?' ,Date.today).order(:date)\n @meeting_curr = current_user.meetings.where('date = ?' ,Date.today).order(:date)\n end",
"def next_recurring_order\n if actual_order = self.last_active_recurring_order\n self.orders.recurring.find(:all, :conditions => [\"orders.id > ?\", actual_order.id],\n :order => \"orders.id ASC\").first\n end\n end",
"def go_to_change_period_section\n change_subscription_link.click\n end",
"def index\n @user = User.find(params[:user_id])\n respond_to do |format|\n format.html do\n @callbacks = @user.call_backs.select{|cb| cb.callback_at >= Time.now}.paginate :page => params[:page] || 1\n render\n end\n format.json do\n @callbacks = @user.call_backs || []\n # @callbacks = (5.days.ago..10.days.from_now).map{ |d| CallBack.new( :user => @user, :lead => Lead.first, :callback_at => d)}\n # @callbacks = [CallBack.new(:user => @user, :lead => Lead.first, :callback_at => Chronic.parse(\"#{Date.today} 12:00pm\"))]\n full_calendar_response = @callbacks.uniq.map do |cb|\n mapping_base = {\n :id => cb.id,\n :title => cb.lead.company,\n # :url => lead_url(cb.lead),\n :start => cb.callback_at.iso8601\n }\n \n if cb.callback_at.seconds_since_midnight == 0\n mapping_base.merge({ :allDay => true })\n else\n mapping_base.merge({ :allDay => false, :end => cb.callback_at + 15.minutes})\n end\n end\n render :json => full_calendar_response\n end\n end\n end",
"def index\n # @entries = Entry.all\n days_ago = (params[:days_ago] || 0).to_i\n @entries = for_date_offset(days_ago)\n @_date = days_ago.days.ago.to_date\n\n @prev_link = view_context.link_to '<span class=\"tooltiptext\">Previous Day</span><i class=\"fa fa-calendar-minus-o\"></i>'.html_safe, entries_path(:days_ago => days_ago + 1)\n if (days_ago == 0)\n @today_link = view_context.link_to '<i class=\"fa fa-ban\"></i>'.html_safe, entries_path, {:class => \"disabled\"}\n else\n @today_link = view_context.link_to '<span class=\"tooltiptext\">Today</span><i class=\"fa fa-calendar-check-o\"></i>'.html_safe, entries_path\n end\n if (days_ago > 0)\n @next_link = view_context.link_to '<span class=\"tooltiptext\">Next Day</span><i class=\"fa fa-calendar-plus-o\"></i>'.html_safe, entries_path(:days_ago => days_ago - 1)\n else\n @next_link = view_context.link_to '<i class=\"fa fa-ban\"></i>'.html_safe, entries_path, {:class => \"disabled\"}\n end\n\n end",
"def next(from, sec, fin)\n from ||= Time.at(0)\n sec ||= 0\n fin ||= Time.now\n #after is after or equal\n nxt = self.reports.next(from, sec).first\n # or it's the fist from the next second\n nxt ||= self.first(from+1, fin) \n end",
"def previous\n self.class.first(\n conditions: ['contract_id = ? AND id != ? AND effective_from <= ?', contract_id, id, effective_from],\n order: 'effective_from DESC',\n )\n end",
"def previous\r\n\r\n User.first(:order => 'users.id DESC', :conditions => [\"users.id < ?\", self.id])\r\n end",
"def next!\n self.start = self.send(:\"next_#{frequency}_in_recurrence\") \n self\n end",
"def next_invoice_date\n self.invoices.length > 0 ? self.invoices.order(:id).last.issue_date + period.send(period_type) : starting_date\n end",
"def history(account_omrl,currency_omrl,options = {})\n config = {\n :count => 20,\n :page => 0,\n }.update(options)\n params = {:in_currency => currency_omrl }\n params[:with] = account_omrl if account_omrl\n flows = Flow.find(:all, :params => params)\n end",
"def next\n # Check if we have any form data - Startup form or Youtube url or\n # @user = current_user\n # if !params[:user_form].blank? and !params[:user].blank?\n # if @user.update_attributes(params[:user])\n # onboarding_step_increment!\n # else\n # flash.now[:alert] = \"Hm, we had some problems updating your account.\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # elsif params[:user]\n # if !params[:user][:intro_video_url].blank? and @user.update_attributes(params[:user])\n # onboarding_step_increment!\n # else\n # flash[:alert] = \"Looks like you forgot to paste in your Youtube URL\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # elsif params[:startup]\n # if @startup.update_attributes(params[:startup])\n # onboarding_step_increment!\n # else\n # flash.now[:alert] = \"Hm, we had some problems updating your account.\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # else\n # onboarding_step_increment!\n # end\n onboarding_step_increment!\n redirect_to :action => :current_step\n end",
"def find_following(limit=1)\n limit == 0 ? self : Period.where([\"begins_at >= ?\", self.ends_at]).order(\"begins_at ASC\").limit(limit)\n end",
"def edit_before_tournament_starts\n team = Team.find(params[:id])\n redirect_to root_path unless \n (team.users_ids.include?(current_user.id) && \n (team.tournament.status == GlobalConstants::TOURNAMENT_STATUS[:future]))\n end",
"def retrieve_date_range_14\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 end",
"def set_next_run\n self.next_run_at = calc_next_run_at_date\n end",
"def employee\n @employee = current_user.employee\n @past_shifts = Shift.past.for_employee(@employee.id).paginate(:page => params[:pasts_page]).per_page(10)\n @shifts = Shift.for_employee(@employee.id).for_next_days(14).paginate(:page => params[:shifts_page]).per_page(10)\n end",
"def index\n if params[:user_id]\n @tasks = Task.where('user_id = ? AND (done = ? OR (updated_at > ?))', params[:user_id], '0', DateTime.now.beginning_of_day).all\n else\n @tasks = Task.where('done = ? OR (updated_at > ?)', 0, DateTime.now.beginning_of_day).all\n end\n end",
"def period_param\n query_params&.dig(:period)&.downcase\n end",
"def upgrade_plan_from_admin(plan_id, renewal_date, fin_year)\n new_plan = Plan.find_by_id(plan_id.to_i)\n transaction do\n subscription_history = SubscriptionHistory.create!(\n :company_id => self.company_id,\n :plan_id => self.plan_id,\n :start_date => self.start_date,\n :end_date => self.end_date,\n :renewal_date => self.renewal_date,\n :first_subscription_date => self.first_subscription_date,\n :ip_address => self.ip_address,\n :amount => self.amount,\n :allocated_storage_mb => self.allocated_storage_mb,\n :allocated_user_count => self.allocated_user_count\n )\n\n user_count = self.allocated_user_count - self.plan.user_count + new_plan.user_count\n self.update_attributes!(\n :plan_id => new_plan.id,\n :renewal_date => renewal_date,\n :end_date => renewal_date,\n :allocated_user_count => user_count\n )\n\n if Subscription.find(self.id).plan.is_inventoriable? && self.company.warehouses.blank?\n Warehouse.create_default_warehouse(self.company_id, self.company.users.first.id)\n end\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.leave_types.blank?\n LeaveType.create_default_leave_types(self.company_id, self.company.users.first.id)\n end\n\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.holidays.blank?\n year = (Time.zone.now.to_date.month.to_i < fin_year.start_date.month ? fin_year.end_date.year : fin_year.start_date.year )\n holiday_date1 = Date.new(year.to_i, 1, 26)\n holiday_date2 = Date.new(year.to_i, 8, 15)\n holiday_date3 = Date.new(year.to_i, 10, 02)\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Republic day\", :holiday_date => holiday_date1, :description =>\"Republic day of India\")\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Independance Day\", :holiday_date => holiday_date2, :description =>\"Independance day of India\")\n holiday = Holiday.create(:company_id => self.company_id, :created_by => self.company.users.first.id, :holiday=> \"Mahatma Gandhi Jayanti\", :holiday_date => holiday_date3, :description =>\"Gandhi Jayanti celebrated in India to mark the occasion of the birthday of Mahatma Gandhi.\")\n\n end\n\n if Subscription.find(self.id).plan.payroll_enabled? && self.company.payheads.blank?\n accounts = Account.where(:name => [\"Basic\",\"House Rent Allowance\", \"Dearness Allowance\", \"Travelling Allowance\", \"Bonus\"], :company_id => self.company_id)\n if accounts.blank?\n # Account.create_default_accounts(self.company_id, self.company.users.first.id)\n end\n Payhead.create_default_payheads(self.company_id, self.company.users.first.id)\n end\n if !Subscription.find(self.id).plan.free_plan? && self.company.custom_fields.blank?\n CustomField.create_default_record(self.company_id)\n end\n logger.debug \"After subscription attributes\"\n #update users enrolled with appropriate roles in new plans\n if subscription_history.plan_id != self.plan_id\n self.company.users.each do |user|\n # user.roles[0] = new_plan.roles.find_by_name(user.roles[0].name)\n\t\t\t\t\t# user.save\n # logger.debug \"Updated roles\"\n new_role = new_plan.roles.find_by_name(user.roles[0].name)\n assignment = Assignment.find_by_user_id(user.id)\n assignment.update_attribute(:role_id, new_role.id)\n end\n end\n end\n end",
"def show_next\n get_item\n @pcp_subject = @pcp_item.pcp_subject\n # try to find next item, check access to remaining item later\n ps = @pcp_item # save original record\n loop do\n pi = @pcp_item.find_next\n if pi.nil? then\n flash.now[ :notice ] = t( 'pcp_items.msg.last_reached' )\n @pcp_item = ps # revert back to original record\n else\n @pcp_item = pi\n @pcp_step = @pcp_subject.current_step\n next unless user_has_permission?( :to_access )\n next unless user_may_view_item?\n end\n break\n end\n # now check permissions - worst case: original item was already inaccessible!\n @pcp_step = @pcp_subject.current_step\n unless user_has_permission?( :to_access )\n render_bad_logic t( 'pcp_items.msg.nop_to_view' )\n return\n end\n unless user_may_view_item? \n render_bad_logic t( 'pcp_items.msg.nop_not_yet' )\n return\n end\n parent_breadcrumb( :pcp_subject, pcp_subject_path( @pcp_subject ))\n set_breadcrumb_path( pcp_subject_pcp_items_path( @pcp_subject ))\n set_final_breadcrumb( :show )\n get_item_details\n render :show\n end",
"def prev_follow\n end",
"def user_next_step\n if (@user = User.find_by_id(params[:id]))\n \n if (UserNextStep.exist_step?(params[:step])) and (user_next_step = UserNextStep.find_or_create_by(:user_id => @user.id)) and (!user_next_step[params[:step].to_sym])\n # Petición POST?\n if request.post?\n \n user_next_step.update_attributes(:dashboard_help => true)\n respond_to do |format|\n format.html { render :nothing => true }\n format.js { render :nothing => true }\n end\n\n else\n @step = params[:step]\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js { render :template => 'users/user_next_step/next_step' }\n end\n end\n else\n error404\n end\n else\n error404\n end\n end"
] | [
"0.75222033",
"0.70780116",
"0.65194535",
"0.6234198",
"0.5811905",
"0.55975586",
"0.55639964",
"0.54987097",
"0.5474077",
"0.5444344",
"0.5439489",
"0.54295886",
"0.5351375",
"0.53465503",
"0.533704",
"0.53105617",
"0.52771693",
"0.5246108",
"0.5236079",
"0.52124244",
"0.52082944",
"0.51473266",
"0.5129994",
"0.5115715",
"0.50520295",
"0.5039582",
"0.5039559",
"0.5039559",
"0.5033464",
"0.50212365",
"0.50078154",
"0.5005803",
"0.49964118",
"0.49875262",
"0.49808148",
"0.49770153",
"0.49598962",
"0.4958411",
"0.49463767",
"0.49429765",
"0.49376172",
"0.49147394",
"0.49112022",
"0.490905",
"0.49069223",
"0.48907492",
"0.4877537",
"0.4866415",
"0.4859861",
"0.4858558",
"0.4851922",
"0.4851922",
"0.4851922",
"0.48435125",
"0.48401517",
"0.4838062",
"0.4834704",
"0.4831591",
"0.48174602",
"0.48148096",
"0.48064008",
"0.4800107",
"0.47883326",
"0.4776098",
"0.47689983",
"0.476829",
"0.47647858",
"0.4761165",
"0.47601914",
"0.47527656",
"0.47382516",
"0.47371882",
"0.47351423",
"0.47340378",
"0.47317967",
"0.47317967",
"0.47236055",
"0.47129783",
"0.47124365",
"0.46972045",
"0.46878323",
"0.46874025",
"0.46872783",
"0.46853086",
"0.46844444",
"0.46832758",
"0.46829256",
"0.4678014",
"0.46757117",
"0.4675389",
"0.46702182",
"0.46549505",
"0.46475923",
"0.46389145",
"0.46388108",
"0.46380597",
"0.46378958",
"0.4636521",
"0.46244568",
"0.46237198"
] | 0.71977055 | 1 |
Sometimes a fab doesn't exist, so we might have to build one to use as a base to find prev or next | def find_or_create_base_fab(user, params)
t = DateTime.parse(params[:fab_period])
user.fabs.where(period: t..(t+7)).limit(1).first or
user.fabs.build(period: t)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_fab\n user = User.find(params[:user_id])\n current_fab = Fab.find(params[:fab_id])\n @fab = current_fab.next_fab\n\n render text: \"no such fab\" and return if @fab.nil?\n\n @previous_fab_exists, @next_fab_exists = @fab.which_neighbor_fabs_exist?\n\n render '/tools/ajax_forward_back.html.erb', layout: false\n end",
"def next_fab\n fab = self.user.fabs.where('period > ?', self.period).last\n end",
"def exactly_next_fab(include_hypothetical_fab = true)\n fab = self.user.fabs.where(period: period+1.week-1.day..period+2.weeks-1.day).last\n fab = self.user.fabs.build(period: period+1.week) if include_hypothetical_fab and fab.nil?\n fab\n end",
"def exactly_previous_fab(include_hypothetical_fab = true)\n fab = self.user.fabs.where(period: period+1.day-2.week..period+1.day-1.week).last\n fab = self.user.fabs.build(period: period-1.week) if include_hypothetical_fab and fab.nil?\n fab\n end",
"def cycle_fab_by_period(direction, params)\n user = User.find(params[:user_id])\n current_fab = find_or_create_base_fab(user, params)\n @fab = (direction == :forward) ? current_fab.exactly_next_fab : current_fab.exactly_previous_fab\n end",
"def which_neighbor_fabs_exist?\n [!self.previous_fab.nil?, !self.next_fab.nil?]\n end",
"def previous_fab\n self.user.fabs.where('period < ?', self.period).first\n end",
"def resolveF\r\n if(@@bLastUsed == false)\r\n puts \"b was not used last. returning.\"\r\n elsif(@@forwardClasses.empty?)\r\n puts \"No more forward classes available. Please visit use command b to move back.\"\r\n else\r\n @@previousClasses.append(@@currClass.class.name)\r\n newClass = @@forwardClasses[@@forwardClasses.length - 1]\r\n newClassObj = Kernel.const_get(newClass).new\r\n @@currClass = newClassObj\r\n @@forwardClasses.pop\r\n defaultInfo\r\n puts 'List of forward classes: ' + @@forwardClasses.to_s\r\n end\r\n end",
"def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end",
"def fib(n, prev = 1, sum = 1)\n n == 1 ? sum : fib(n - 1, sum, sum + prev)\nend",
"def get_fibonacci(num)\n f = [0,1]\n for i in (2..num)\n f << (f[-1] + f[-2])\n end\n if num == 0\n f = 0\n end\n f[-1]\nend",
"def findFCPath(fcName)\n fcPath = \"\"\n parentDir = Array.new\n\n # This represents location where to search for flowcell\n rootDir = \"/stornext/snfs0/next-gen/Illumina/Instruments\"\n\n dirEntries = Dir.entries(rootDir)\n\n # In the rootDir of the data copied over from the sequencers, find \n # directories corresponding to each sequencer and populate the \n # parentDir array\n dirEntries.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(rootDir + \"/\" + dirEntry.to_s)\n parentDir << rootDir + \"/\" + dirEntry.to_s\n end\n end\n\n parentDir.each{ |path|\n if File::exist?(path + \"/\" + fcName) &&\n File::directory?(path + \"/\" + fcName)\n fcPath = path + \"/\" + fcName\n end\n }\n\n if fcPath.eql?(\"\")\n puts \"Error : Did not find path for flowcell : \" + fcName\n raise \"Error in finding path for flowcell : \" + fcName\n end\n return fcPath.to_s\n end",
"def find_upwards(target, start_dir = nil)\n previous = nil\n current = PDK::Util::Filesystem.expand_path(start_dir || Dir.pwd)\n\n until !PDK::Util::Filesystem.directory?(current) || current == previous\n filename = File.join(current, target)\n return filename if PDK::Util::Filesystem.file?(filename)\n\n previous = current\n current = PDK::Util::Filesystem.expand_path('..', current)\n end\n end",
"def find_prev(*args)\n find(:prev, *args)\n end",
"def find_prev(*args)\n find(:prev, *args)\n end",
"def cd(f)\n if f>=0\n puts f\n cd(f-1)\n else\n puts \"all done!\"\n end\nend",
"def next_f\n raise \"implement in subclass\"\n end",
"def fabricator\n @fabricator ||= Fabricator.find_by(id: params[:id])\n end",
"def fabric(fabricid)\n result = @fabrics.fabric(fabricid)\n result[1]\n end",
"def faster_fib_helper(solution_arr, current, n)\n # n is negative\n if n < 0\n raise ArgumentError, \"Fib(n) error - n must be 0 or larger.\"\n\n # base cases n = 0 , n = 1\n elsif n == 0 || n == 1\n return n\n\n # the other case we check for is if current has reached n\n # this means we can end the recursion\n # and the final return value will be the sum of the previous two\n # elements in solution_arr we have been saving up until this point\n elsif current == n\n # n or current works here since they're the same value at this point\n # can do this because now the array only holds two elements at a time.\n return solution_arr[0] + solution_arr[1]\n\n # otherwise we shovel the next fib # to the back of the array\n # again, found by summing the two elements in front\n # and recusively call the helper with current incremented\n else\n # we only have current number of elements at this point\n # we have to specifically save this in solution_arr, if we do it in the function call\n # it will create a new slot instead of re-using the old one i think\n solution_arr = [solution_arr[1], solution_arr[0] + solution_arr[1]]\n return faster_fib_helper(solution_arr, current + 1, n)\n end\n\nend",
"def test_next_prev\n # list parent\n i1 = C::Int.new\n i2 = C::Int.new\n list = Chain[i1, i2]\n assert_same(i2, i1.next)\n assert_nil(i2.next)\n assert_same(i1, i2.prev)\n assert_nil(i1.prev)\n\n # node parent\n i1 = C::IntLiteral.new(1)\n i2 = C::IntLiteral.new(2)\n a = C::Add.new(i1, i2)\n assert_same(i2, i1.next)\n assert_nil(i2.next)\n assert_same(i1, i2.prev)\n assert_nil(i1.prev)\n\n # no parent\n i = C::Int.new\n assert_raises(C::Node::NoParent){i.next}\n assert_raises(C::Node::NoParent){i.prev}\n end",
"def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end",
"def prev_scan\n scan_ids = Scan.find(:all, :conditions => [\"dir = ?\", scan.dir], :order => \"complete\", :select => \"id\")\n index = scan_ids.index(scan)\n return nil if index == 0\n Scan.find(scan_ids[index - 1])\nend",
"def findBaseCallsDir(fcName)\n fcPath = \"\"\n\n # This represents directory hierarchy where GERALD directory\n # gets created.\n baseCallsDirPaths = Array.new\n baseCallsDirPaths << \"Data/Intensities/BaseCalls\"\n baseCallsDirPaths << \"BCLtoQSEQ\"\n \n fcPath = findFCPath(fcName)\n \n baseCallsDirPaths.each{ |bcPath|\n if File::exist?(fcPath + \"/\" + bcPath) &&\n File::directory?(fcPath + \"/\" + bcPath)\n return fcPath.to_s + \"/\" + bcPath.to_s\n end\n }\n raise \"Did not find Base calls directory for flowcell : \" + fcName\n end",
"def get_method_for_next_state\n if end_of_layer_stack?\n # check next superclass\n top_of_composition_stack!\n advance_current_class!\n get_method_for_this_state\n else\n if end_of_runtime_layer_superclass_hierarchy?\n advance_runtime_layer!\n get_method_for_this_state\n else\n advance_current_layer!\n get_method_for_this_state\n end\n end\n end",
"def resolve_dependencies(prev_deps, curr_deps)\n added = curr_deps - prev_deps\n deleted = prev_deps - curr_deps\n split_dependencies(added, deleted)\n end",
"def nxt_fish\n\t# Get the index of the next fish\n\ttmp_index = ($fish.index(get_fish) + 1).modulo($fish.length)\n\t\n\t# Move to the next fish pair\n\t$cur_fish = $fish[tmp_index]\nend",
"def next_step\n if goto_true.present?\n fs = FlowStep.job_flow_step(job_id: job_id, flow_step: goto_true)\n if fs.entered?\n job.quarantine!(msg: \"Broken flow, step already entered #{fs.step}, called from #{self.step}\")\n return nil\n else\n return fs\n end\n end\n nil\n end",
"def fancy_fib(num, arr = [0,1])\n if arr.length != num\n arr= fancy_fib(num, arr.push(arr[-1]+ arr[-2]))\n end\n arr\nend",
"def prev_next_needed(prev_doc, next_doc, prev_bookmark=nil, next_bookmark=nil)\n if (params[:controller] == 'bookmarks' || (prev_bookmark.present? || next_bookmark.present?) || (prev_doc.present? || next_doc.present?))\n return true\n end\n end",
"def has_next?; end",
"def find_fib_nth(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n return (find_fib_nth(n - 2) + find_fib_nth(n - 1))\n end\nend",
"def fib_rec(n)\n return [0] if n == 1\n return [0, 1] if n == 2\n prev = fib_rec(n - 1)\n next_fib = prev[-1] + prev[-2]\n prev << next_fib\nend",
"def get_next_entry; end",
"def find_recur_target\n nil\n end",
"def find_next_and_prev(*args)\n return find(:next, *args), find(:prev, *args)\n end",
"def rec_fib(n)\r\n return [0] if n == 0\r\n return [0,1] if n ==1\r\n return [0,1,1] if n ==2\r\n \r\n rec_fib(n-1) << (rec_fib(n-1)[-1] + rec_fib(n-2)[-1]) \r\n\r\nend",
"def removeFutureEdges5(currentComp,rootTx,currentTxID,subTxID,depMgr)\n #assert_equal(currentComp,depMgr.compLifecycleMgr.compObj.identifier )\n logger = depMgr.logger\n if currentComp == depMgr.compLifecycleMgr.compObj.identifier\n logger.debug \"cur == dep...id\"\n else\n outs \"removeFutureEdges , not equal current& depMgr...id\"\n end\n port = depMgr.compLifecycleMgr.compObj.componentVersionPort\n \n key = currentComp +\":\" + port\n logger.debug \"vc.removeFutureEdges5, curComp = #{currentComp} , \"\n outDepRegistry = depMgr.outDepRegistry\n inDepRegistry = depMgr.inDepRegistry\n \n outFutureDeps = outDepRegistry.getDependencesViaType(FUTURE_DEP)\n outFutureOneRoot = Set.new # HashSet<Dependence>\n \n outFutureDeps.each{|dep|\n logger.debug \"outFutureDeps : dep #{dep}\"\n if dep.rootTx == rootTx && dep.srcCompObjIdentifier != dep.targetCompObjIdentifier\n logger.debug \"if , add one out future #{dep}\"\n outFutureOneRoot << dep\n else\n logger.debug \"else , rootTx = #{rootTx} , dep.rootTx = #{dep.rootTx} , \"\n logger.debug \"src = #{dep.srcCompObjIdentifier},target = #{dep.targetCompObjIdentifier}\" \n end\n \n }\n \n inFutureFlag = false\n futureDeps = inDepRegistry.getDependencesViaType(FUTURE_DEP)\n \n futureDeps.each{|dep|\n logger.debug \"vc.remove5 futureDep : dep= #{dep}\"\n if dep.rootTx == rootTx && dep.srcCompObjIdentifier!= dep.targetCompObjIdentifier\n logger.debug \"vc.remove5: inFutureFlag change to true\"\n inFutureFlag = true\n break\n end\n } \n \n if !inFutureFlag\n txDepMonitor = Dea::NodeManager.instance.getTxDepMonitor(key)\n logger.debug \"in future flag == false\"\n outFutureOneRoot.each{|dep|\n logger.debug \"outFutureOneRoot : dep = #{dep}\"\n isLastUse = txDepMonitor.isLastUse(currentTxID, dep.targetCompObjIdentifier, currentComp)\n if isLastUse\n payload = Dea::ConsistencyPayloadCreator.createPayload4(dep.srcCompObjIdentifier, dep.targetCompObjIdentifier, dep.rootTx,DepOperationType::NOTIFY_FUTURE_REMOVE)\n # notify testing \n logger.debug \"#{currentComp}.vc: notify future_remove \\n\\t payload = #{payload}\"\n depNotify(dep.srcCompObjIdentifier,dep.targetCompObjIdentifier,payload)\n else\n logger.debug \"isLastUse false\" \n end\n }\n else\n logger.debug \"inFutureFlag = true\" \n end \n logger.debug \"vc.remove5 inFutureFlag = #{inFutureFlag}\"\n return true\n \n end",
"def fibs(num)\n return [] if num == 0\n return [0] if num == 1\n return [0, 1] if num == 2\n\n prev_fibs = fibs(num - 1)\n prev_fibs << prev_fibs[-1] + prev_fibs[-2]\n\n prev_fibs\nend",
"def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend",
"def prev_follow\n end",
"def previous\n end",
"def previous\n end",
"def get_next\n\t\t\n\tend",
"def findentry(f, name, start)\n f.seek(start)\n myname = getname(f, start)\n if name == myname\n return start\n end\n left = leftchild(f, start)\n right = rightchild(f, start)\n if name < myname\n if left < f.stat.size and left != 0\n res = findentry(f, name, leftchild(f, start))\n else\n res = nil # this should perolate up\n end\n end\n if name > myname\n if right < f.stat.size and right != 0\n res = findentry(f, name, rightchild(f, start))\n else\n res = nil\n end\n end\n return res\n end",
"def fibonacci_series(input)\n fib = 2\n while(fib < input) do\n if(fib == 2)\n previous = fib\n fib += 1\n ap(1)\n ap(1)\n ap(previous)\n else\n tmp_previous = fib # number we got from current iteration will be previous value to next value\n fib = fib + previous \n previous = tmp_previous # setting the previous value\n end\n ap(fib)\n end\nend",
"def fibonacci?(idx, current = 1, before = 0)\n return true if current == idx || idx == 0\n return false if current > idx\n fibonacci?(idx , current + before, current)\nend",
"def try_this_changelist(changelist)\n # yield changelist\n return FAKED_CHANGELISTS[changelist]\n end",
"def fibo_finder(n) \n if n == 0\n return 0\n elsif n ==1\n return 1\n else\n return (fibo_finder(n - 1) + fibo_finder(n - 2))\n end\nend",
"def fib(n)\n return [0,1].take(n) if n <= 2\n prev = fib(n-1)\n prev << prev[-1] + prev[-2]\nend",
"def fib(sum, curr, prev)\n if curr > 4_000_000\n puts sum\n return\n end\n if curr % 2 == 0\n sum += curr\n end\n fib(sum, prev + curr, curr)\nend",
"def has_next\n\t\tend",
"def fibo_fast(last, current, n)\n n == 0 ? last : fibo_fast(current, last + current, n - 1)\nend",
"def get_nth_fib(n)\n if n == 2\n return 1\n elsif n == 1\n return 0\n else\n return get_nth_fib(n - 1) + get_nth_fib(n - 2)\n end\nend",
"def find_fibonacci_index_by_length(num_digits)\n prev = 1\n curr = 1\n index = 2\n return 1 if num_digits == 1\n while curr.digits.size < num_digits\n # puts \"number: #{curr} size: #{curr.digits.size} num_digits: #{num_digits}\"\n new = curr + prev \n prev = curr\n curr = new\n index += 1\n end\n # puts \"We reached number #{curr} with a length of #{num_digits} at index #{index}\"\n index \nend",
"def breadth_first_scan_old(root, &block)\n if root.file?\n yield root\n return\n end\n\n children = Pathname(root).children.sort\n begin\n children.each { |child| yield child } # breadth\n children.each { |child| breadth_first_scan(child, &block) if child.directory? }\n rescue Errno::EACCES, Errno::EPERM => e\n STDERR.puts(\"Error: #{e}\".red)\n end\nend",
"def next_child_index (returning_fei)\n\n next_id = if returning_fei.is_a?(Integer)\n returning_fei + 1\n elsif returning_fei == self.fei\n 0\n else\n returning_fei.child_id.to_i + 1\n end\n\n loop do\n\n break if next_id > raw_children.length\n\n raw_child = raw_children[next_id]\n\n return next_id \\\n if raw_child.is_a?(Array) or raw_child.is_a?(FlowExpressionId)\n\n next_id += 1\n end\n\n nil\n end",
"def bfs(target = nil, &prc)\n raise \"Need a proc or target\" if [target, proc].none?\n prc ||= Proc.new { |node| node.value == target }\n\n nodes = [self]\n until nodes.empty?\n node = nodes.shift\n return node if prc.call(node)\n nodes.concat(node.children)\n end\n nil \nend",
"def fibo_finder(n)\n if n <= 1\n \tn\n else\n fibo_finder(n-1) + fibo_finder(n-2)\n end\nend",
"def is_fib?(target)\n a = 0\n b = 1\n\n loop do\n return true if b == target\n a, b = [b, b + a]\n break if b > target\n end\n\n false\nend",
"def findNewFlowcells()\n @newFC = Array.new\n\n dirList = Dir.entries(@instrDir)\n\n dirList.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(@instrDir + \"/\" + dirEntry) &&\n !@fcList.key?(dirEntry.strip)\n @newFC << dirEntry\n end\n end \n end",
"def findNewFlowcells()\n @newFC = Array.new\n\n dirList = Dir.entries(@instrDir)\n\n dirList.each do |dirEntry|\n if !dirEntry.eql?(\".\") && !dirEntry.eql?(\"..\") &&\n File::directory?(@instrDir + \"/\" + dirEntry) &&\n !@fcList.key?(dirEntry.strip)\n @newFC << dirEntry\n end\n end \n end",
"def prev_day(days = 1)\n advance(days: -days)\n end",
"def find_shortcut(name)\n unless defined? Fast::Shortcut\n require 'fast/shortcut'\n Fast.load_fast_files!\n end\n\n shortcut = Fast.shortcuts[name] || Fast.shortcuts[name.to_sym]\n shortcut || exit_shortcut_not_found(name)\n end",
"def get_nth_fib(n)\n if n == 0 || n == 1\n return 0\n elsif n == 2\n return 1\n else\n return get_nth_fib(n-1) + get_nth_fib(n-2)\n end\n\nend",
"def select_prev_field\n return :UNHANDLED if @widgets.nil? or @widgets.empty?\n #$log.debug \"insdie sele prev field : #{@active_index} WL:#{@widgets.length}\" \n if @active_index.nil?\n @active_index = @widgets.length \n else\n f = @widgets[@active_index]\n begin\n on_leave f\n rescue => err\n $log.error \" Caught EXCEPTION #{err}\"\n Ncurses.beep\n# $error_message = \"#{err}\" # changed 2010 \n $error_message.value = \"#{err}\"\n return\n end\n end\n\n f = @widgets[@active_index]\n index = @focusables.index(f)\n if index > 0\n index -= 1\n f = @focusables[index]\n if f\n select_field f\n return\n end\n end\n \n ## added on 2008-12-14 18:27 so we can skip to another form/tab\n # 2009-01-08 12:24 no recursion, can be stack overflows if no focusable field\n if @navigation_policy == :CYCLICAL\n f = @focusables.last\n select_field @widgets.index(f) if f\n end\n\n return :NO_PREV_FIELD\n end",
"def is_fibonacci?(num, loc = 1, start = 0)\n\t if num == loc\n\t \ttrue\n\t elsif num < loc\n\t \tfalse\n\t else\n\t \tis_fibonacci?(num,loc + start, loc)\n\t end\nend",
"def cool_fib(number)\n (0..number).inject([1,0]) {|i_arr| [i_arr.last, i_arr.first + i_arr.last]}.first\nend",
"def has_next()\n \n end",
"def has_next()\n \n end",
"def fib(n)\n return [] if n < 1\n return [1] if n == 1\n return [1, 1] if n == 2\n\n prev_fib = fib(n - 1)\n num1 = prev_fib[-1]\n num2 = prev_fib[-2]\n prev_fib << num1 + num2\n prev_fib\nend",
"def bfs(target_value)\n queue = [self]\n until queue.empty?\n checkme = queue.shift\n return checkme if checkme.value == target_value\n queue.concat(checkme.children)\n end\n nil\n\n end",
"def find_next(*args)\n find(:next, *args)\n end",
"def find_next(*args)\n find(:next, *args)\n end",
"def fibs_rec(num)\n return [] if num == 0\n return [0] if num == 1\n return [0, 1] if num == 2\n\n prev_nums = fibs_rec(num - 1)\n prev_nums << prev_nums[-1] + prev_nums[-2]\nend",
"def recursive_fib(number)\n _recursive_fib(number, 0, 1)\nend",
"def rec_fib(n)\n # return 0 if n==1\n # return 1 if n==2\n # rec_fib(n-1) + rec_fib(n-2)\n\n arr=[0, 1]\n\n if n <= 2 # returning array make base case in if/else\n arr[0...n]\n else\n prev_result = rec_fib(n-1) # output is array\n prev_result << prev_result[-1] + prev_result[-2]\n # don't need explicit return\n end\nend",
"def next_follow\n end",
"def fib(n)\n if n <= 2\n return [0, 1].take(n)\n end\n previous_fib = fib(n-1)\n next_ele = previous_fib[-1] + previous_fib[-2]\n previous_fib << next_ele\nend",
"def next\n\t\tTask.order(:position).where(\"position > ?\", position).first\n\tend",
"def is_fib?(target)\n return true if target == 1\n a = 1\n b = 1\n\n loop do\n c = a + b\n return true if c == target\n break if c > target\n a = b \n b = c\n end\n\n false\nend",
"def fibonacci(current_num)\n return current_num if current_num < 2\n fibonacci(current_num -1) + fibonacci(current_num -2)\nend",
"def fib_helper(solution_arr, current, n)\n # n is negative\n if n < 0\n raise ArgumentError, \"Fib(n) error - n must be 0 or larger.\"\n\n # base cases n = 0 , n = 1\n elsif n == 0 || n == 1\n return n\n\n # the other case we check for is if current has reached n\n # this means we can end the recursion\n # and the final return value will be the sum of the previous two\n # elements in solution_arr we have been saving up until this point\n elsif current == n\n # n or current works here since they're the same value at this point\n return solution_arr[n - 1] + solution_arr[n - 2]\n\n # otherwise we shovel the next fib # to the back of the array\n # again, found by summing the two elements in front\n # and recusively call the helper with current incremented\n else\n # we only have current number of elements at this point\n solution_arr << (solution_arr[current - 1] + solution_arr[current - 2])\n return fib_helper(solution_arr, current + 1, n)\n end\nend",
"def previous\n validates_possibility_of :previous\n self.index -= 1\n self.current\n end",
"def recursive => nil",
"def set_prev_btn txn, inv\n txn.pixi? ? inv.listings.first : inv\n end",
"def fir_home_setup\n\n # Get all design_review_results with role_id = 31 (fir) and reviewer_id = @logged_in_user\n # \n\n #@design_reviews_firs = get_active_reviews_firs_current_user_fir_role\n @design_reviews_firs = get_active_reviews_firs_all_user_fir_role\n @new_fab_issue = FabIssue.new\n @fab_failure_modes = FabFailureMode.order(\"name\").find_all_by_active(true)\n fab_deliverables = FabDeliverable.order(\"parent_id DESC, id ASC\").find_all_by_active(true) \n @fab_deliverables = {\"Other\" => []}\n \n fab_deliverables.each do |fd| \n # A) if fd parent id not empty then check if its parent is already in hash\n # if not add it then add fd as first item in its array otherwise just add it\n # B) if fd parent id is empty then check if fd item is already used in hash\n # if not then add it to Other\n if !fd.parent_id.nil?\n parent = FabDeliverable.find(fd.parent_id)\n if !@fab_deliverables.has_key?(parent.name)\n @fab_deliverables[parent.name] = []\n end\n @fab_deliverables[parent.name] << [fd.name, fd.id]\n else\n if !@fab_deliverables.has_key?(fd.name)\n @fab_deliverables[\"Other\"] << [fd.name, fd.id]\n end\n end\n end\n\n end",
"def reset_next(io = $stdout)\n begin\n latest_dir.contcar\n prepare_next\n clean_queue_files\n rescue Errno::ENOENT\n latest_dir.reset_initialize(io)\n clean_queue_files\n rescue VaspUtils::Poscar::ParseError\n latest_dir.reset_initialize(io)\n clean_queue_files\n end\n end",
"def fibs_rec(count)\n return [0,1,1].take(count) if count < 3\n prev_fibs = fibs_rec(count - 1)\n prev_fibs + [prev_fibs[-2] + prev_fibs[-1]]\nend",
"def fib_element(value)\n first_number = 0\n second_number = 1\n next_element = 1\n (value - 1).times do\n next_element = first_number + second_number\n first_number = second_number\n second_number = next_element\n end\n if value == 0\n first_number\n else\n next_element\n end\nend",
"def find_next\n status = `git status -s`.lines.reject(&:nil?).grep(/.. (PCL|tsion|steveklabnik)\\//)\n return nil if status.empty?\n\n first = status.map{|x| x.gsub(/^.. /, '') }.first.strip\n \n if File.directory?(first) \n return [first, [first]]\n else\n name = first.split('/')[-1].split('_', 2)[1]\n end\n\n pcl = find_file('PCL', name)\n tsion = find_file('tsion', name)\n steve = find_file('steveklabnik', name)\n\n [name, [pcl, tsion, steve]]\n end",
"def recursive_fib(num)\r\n\treturn num if num == 0 || num == 1\r\n\trecursive_fib(num - 1) + recursive_fib(num - 2)\r\nend",
"def previous\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) > 0\n return master_files_sorted[master_files_sorted.find_index(self)-1]\n else\n return nil\n end\n end",
"def finder\n parent_finder = content_item.dig(\"links\", \"finder\", 0)\n Airbrake.notify(\"Finder not found\",\n error_message: \"Finder not found in #{base_path} content item\"\n ) if parent_finder.nil?\n\n parent_finder\n end",
"def bfs(target)\n queue = [self]\n until queue.empty?\n return queue.first if queue.first.position == target\n queue += queue.first.children\n queue.shift\n end \n end",
"def fibonacci(n , solutions = [0,1], current = 2)\n raise ArgumentError.new (\"n must be greater than or equal to 0\") if n < 0\n return n if n == 0 || n == 1\n\n if current == n\n return solutions[0] + solutions[1] \n end\n\n value = solutions[0] + solutions[1] \n solutions[0] = solutions[1]\n solutions[1] = value\n \n return fibonacci(n , solutions, current + 1)\nend",
"def focus_prev\n i = focusables.index(@focused) || 0\n new_i = i.zero? ? focusables.length - 1 : i - 1\n self.focused = focusables[new_i] if focusables[new_i]\n end",
"def fibs(n)\n return [] if n == 0\n return [0] if n == 1\n return [0, 1] if n == 2\n prev_fibs = fibs(n - 1)\n prev_fibs << (prev_fibs[-1] + prev_fibs[-2])\nend",
"def get_next_history\r\n false\r\n end",
"def previous_autolist; end"
] | [
"0.6754162",
"0.6349706",
"0.6183872",
"0.60250163",
"0.5774865",
"0.55258304",
"0.52473295",
"0.5052278",
"0.48793095",
"0.48759642",
"0.48594382",
"0.48481086",
"0.48429623",
"0.48416245",
"0.48416245",
"0.48228523",
"0.48210976",
"0.47890007",
"0.47687873",
"0.47675318",
"0.47587618",
"0.4749776",
"0.47196475",
"0.47189248",
"0.4711654",
"0.47083664",
"0.46840867",
"0.4681369",
"0.4678497",
"0.4671026",
"0.4657692",
"0.4629014",
"0.46278423",
"0.46276677",
"0.46252292",
"0.46248347",
"0.4616921",
"0.46118104",
"0.4609466",
"0.4601121",
"0.45994088",
"0.45923936",
"0.45923936",
"0.45912784",
"0.45911214",
"0.45882082",
"0.45854294",
"0.45745614",
"0.4570993",
"0.45674202",
"0.45601106",
"0.45591578",
"0.45576805",
"0.4556025",
"0.4552885",
"0.45525262",
"0.4539406",
"0.45322105",
"0.45277226",
"0.4525406",
"0.4519735",
"0.45193103",
"0.45172223",
"0.45165858",
"0.45159712",
"0.45133623",
"0.45103058",
"0.45030856",
"0.45026264",
"0.45026264",
"0.449962",
"0.4485628",
"0.4483009",
"0.4483009",
"0.4481185",
"0.44803345",
"0.4476022",
"0.44755384",
"0.44614574",
"0.44551867",
"0.445221",
"0.4451752",
"0.44514343",
"0.4447445",
"0.4444869",
"0.44415587",
"0.44405586",
"0.44393525",
"0.44367075",
"0.44366744",
"0.44357404",
"0.44260308",
"0.44249228",
"0.44226906",
"0.44217625",
"0.44204265",
"0.44181734",
"0.44174102",
"0.4413594",
"0.44116208"
] | 0.53841627 | 6 |
Registration params: email, full_name, password, password_confirmation, invite | def create
user = User.new params.require(:user).permit(:email, :full_name, :password, :password_confirmation, :invite)
user.should_validate_invite!
user.should_validate_name!
if user.valid?
if user.invite.data && user.invite.data[:email] == user.email
# Activate and login
#
user.save!
if user.invite.owner.instance_of?(Company)
user.invite.update(data: user.invite.data.merge({ user_id: user.id }) )
else
user.invite.destroy
end
warden.set_user(user, scope: :user)
respond_to do |format|
format.json { render json: { state: :login, previous_path: previous_path }}
end
else
# Create activation token and send email
#
token = Token.create(
name: :activation,
data: {
full_name: user.full_name,
address: user.email,
password_digest: user.password_digest,
invite_id: user.invite.id
}
)
ProfileMailer.activation_email(token).deliver
SlackWebhooksWorker.perform_async(
text: t('user.activities.started_to_sign_up', name: user.full_name, email: user.email)
) if should_perform_sidekiq_worker?
respond_to do |format|
format.json { render json: { state: :activation }}
end
end
else
respond_to do |format|
format.json { render json: { errors: user.errors }, status: 403 }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registration_params\n params.require(:registration).permit(:name, :grr, :email, :cpf, :turn)\n end",
"def registration_params\n params.require(:registration).permit(:email, :password, :password_confirmation)\n end",
"def registration_params\n params.require(:registration).permit(:name, :last_name, :email, :phone, :country, :city, :member, :need_place, :days, :comment, :gender, :arriving)\n end",
"def registration_params\n params.require(:registration).permit(:email, :password, :terms, :password_confirmation, :email_confirmation)\n end",
"def registration_params\n params.require(:registration).permit(:full_name, :email_address, :phone_number, :ussa_number, :fis_number, :street_address, :city, :state, :zip, :athlete_previous_sponsorship_level, :athlete_previous_sponsorship_brand, :athlete_previous_sponsorship_brand_other, :athlete_team_club_name, :athlete_birth_year, :athlete_coach_name, :athlete_preferred_race_center, :coach_team_club_name, :coach_position, :coach_preferred_race_center, :sponsorship_brand, :notes)\n end",
"def registration_params\n params.require(:registration).permit(:firstname, :lastname, :email, :language, :last_attended, :coding_level, :os, :other_languages, :project, :idea, :want_learn, :group, :join_group, :notes)\n end",
"def registration_params\n # params.require(:registration).permit(:firstname, :lastname, :email, :language, :last_attended, :coding_level, :os, :other_languages, :project, :idea, :want_learn, :group, :join_group, :notes)\n params\n end",
"def registration_params\n params.permit(:title, :user_id, registration: {})\n end",
"def sign_up_params\n {\n email: registration_state.email,\n password: registration_state.password, # pragma: allowlist secret\n # we check this matches in 'start_post'\n password_confirmation: registration_state.password,\n }\n end",
"def registration_params\n @params = params.require(:registration).permit(:poster_id, :full_name, :company, :email, :phone, :organization, :client_ip)\n end",
"def registration_params\n if params[:registration]\n params.require(:registration).permit(:regid, :name, :email) \n else\n { }\n end\n end",
"def registration_params\n params.require(:user).permit(:name,\n :email, :password, :password_confirmation, :role)\n end",
"def register_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end",
"def user_params\n params.require(:invite).permit(:email)\n end",
"def register_params\n params.require(:register).permit(:name, :hospitalID, :email, :password, :lname, gender)\n end",
"def registration_params\n params.require(:registration).permit(:tournament_id, :name, :first_name, :email, :classing, :classing_value, :comment, :phone, \n draw_registrations_attributes: [:id, :partner, :draw_id, :is_registered])\n end",
"def registration_params\n begin\n p = params.require(:user)\n rescue\n return false\n end\n p.permit(:username, :email, :password, :password_confirmation)\n end",
"def registrant_params\n params[:registrant].permit(:name, :email, :pass, :level, :role, :signed_in, :paid, :paid_at_event, :pass_id)\n end",
"def profile_invite_params\r\n params.require(:profile_invite).permit(:email)\r\n end",
"def registration_params\n params.require(:user).permit(:login,:email, :username,:firstname, :lastname, :password, :password_confirmation, :remember_me)\n\n end",
"def registration_params\n params.require(:registration).permit(:rsvp, :comment, :user_id, :event_id)\n end",
"def registration_params\n params.require(:registration).permit(:is_paid, :shirt_size, :name, :subtype, :phone, :email, registration_members_attributes: [:id, :name, :email, :phone, :_destroy, :shirt_size])\n end",
"def reg_invitation\n if request.post?\n if (params[:email])\n if (params[:email] != params[:email_confirm])\n flash[:notice] = \"Emails don't match; better try again\"\n else\n email = params[:email]\n user = User.find_by_email(email)\n if user\n password = User.new_random_password(email)\n user.password = password\n RegistrationMailer.invitation_with_new_password(email, password)\n flash[:notice] = \"Registration invitation sent to #{email}\"\n Event.log(\"Admin invitation to #{email}\")\n redirect_to(:controller => :admin, :action => :index)\n else\n password = User.new_random_password(email)\n user = User.new(:email => email, :password => password)\n unless user.save\n raise(\"Save failed on new user with #{email}!\")\n end\n RegistrationMailer.invitation_with_new_password(email, password)\n Event.log(\"Individual invitation to new user #{email} with password #{password}\")\n flash[:notice] = \"Registration invitation sent to #{email}\"\n redirect_to(:controller => :admin, :action => :index)\n end\n end\n end\n end\n end",
"def register_params\n params.permit(:email, :password, :password_confirmation, :username, :display_name)\n end",
"def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create¶m='\r\n register_path << stgu_json.to_s\r\n register_path << '¶m=' + stgma_json.to_s\r\n register_path << '¶m=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end",
"def invite_params\n params.require(:invite).permit(:email, :sender_id, :recipient_id, :token)\n end",
"def member_invite_params\r\n params.require(:member).permit(:email)\r\n end",
"def sign_up_params\n params.require(resource_name).permit(\n :name,\n :email,\n :profile,\n :password,\n :password_confirmation\n )\n end",
"def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end",
"def create_params\n params.require(:member).permit(:role, :invitee_email)\n end",
"def registration_params\n params.require(:registration).permit(:Registration_id, :group_id, \n :registerable_type, :paid_for,\n :training_id, :code, :amt_paid, :sign_up_date, :auth_code, :refunded,\n :training_code, :owner_email, :reg_type, :registrant_email, :group_handle)\n end",
"def sign_up_params(params)\n params.permit(:password, :password_confirmation, :name, :email)\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n #save_without_session_maintenance\n end",
"def register\n if request.get? then\n @user = User.new\n end\n # Запрос на создание нового пользователя\n if request.post? then\n @user = User.new(params[:user])\n # Если включена регистрация по инвайтам - проверяем правильность введённого кода\n if SiteGlobal.invite_reg && !Invite.valid?(params[:invite]) then\n @user.errors[:base] << \"Invalid invation code\"\n render :register and return\n end\n # Пользователь может создать только аккаунт студента или преподавателя\n render_403 and return unless User.in_user_group?(@user)\n # Если запись успешно создана\n if @user.save then\n # Создание записи в дополнительной таблице\n if @user.student? then\n Student.create(user_id: @user.id)\n elsif @user.lecturer? then\n Lecturer.create(user_id: @user.id, confirm_level: Lecturer::CONFIRM_LEVELS[:unconfirmed])\n end\n if SiteGlobal.invite_reg\n Invite.use(params[:invite])\n end\n login, password = params[:user][:login], params[:user][:password]\n session[:user_id] = User.authenticate(login, password).id\n if @user.lecturer? then\n redirect_to settings_lecturer_path(reg: 1)\n elsif @user.student? then\n redirect_to settings_student_path(reg: 1)\n else\n redirect_to :root\n end\n else\n render :register\n end\n end\n end",
"def signup_params\n params.permit(:email, :password, :name)\n end",
"def userRegisterPost(email, name, password, password_confirmation)\n post register_path, params: {user: {email: email, name: name,\n password: password, password_confirmation: password_confirmation}}\n end",
"def registration_params\n params.require(:registration).permit(:name, :ic_number, :date_of_birth, :contact_number, :email, :instagram_account, :facebook_ads, :facebook_newsfeed, :facebook_video, :instagram, :friends_card_id, :expiry_date, :card_number, :processing, :pending, :completed, :address_1, :address_1, :city, :zipcode, :notes, card_attributes: [:first_name, :last_name, :card_type, :card_number, :card_verification, :card_expires_on] )\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n generate_temporary_password!\n save_without_session_maintenance\n end",
"def invitee_params\n params.require(:invitee).permit(:email)\n end",
"def invitation_params\n # params.require(:invitation).permit(:email, :profile, :status, :reason)\n params.require(:invitation).permit(:username, :email, :status, :reason)\n end",
"def reg_params\n params.require(:user).permit(:email,:name,:role)\n end",
"def configure_invite_params\n devise_parameter_sanitizer.permit(:invite, keys: [:email, :name, :username])\n end",
"def registration_params\n params.require(:registration)\n .permit(:nickname, :first, :middle, :last,\n :relation, :status, :house_id)\n end",
"def device_signup_params\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :name) }\n end",
"def registration_params\n params.require(:registration).permit(:team_id, :tournament_id)\n end",
"def registration_params\n params.require(:registration).permit(:course_id, :full_name, :company, :email, :telephone, \n :first_name, :last_name, :card_type, :card_number,\n :card_verification, :card_expires_on)\n end",
"def registration_params\n params[:registration]\n end",
"def register_params\n params.require(:user).permit(:name, :email, :password)\n end",
"def configure_sign_up_params\n params.require(:artist).permit(:invite_code, :first_name, :last_name, :email, :password, :password_confirmation, :current_password)\n end",
"def pre_registration_params\n params.require(:pre_registration).permit(:name, :email, :phone, :unity_type_id, :unity_id)\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def create\n if User.where(:email => params[:user][:email]).count.zero?\n @invited_user = User.invite!(params[:user], current_user)\n \n params[:freight_train] = true\n params[:ft] = {:partial => \"users/user\"}\n respond_with(@invited_user)\n else\n show_error \"That email address is already taken\"\n end\n end",
"def invitation_params\n params['invitation']['user_name'] = session[:user_name]\n params['invitation']['user_email'] = session[:user_email]\n params.require(:invitation).permit(:email, :trip_id, :user_name, :user_email)\n end",
"def sign_up_params\n params.permit(:password, :password_confirmation, :name, :email)\n end",
"def myregistration_params\n params.require(:myregistration).permit(:name, :email, :cell, :gender, :category, :subject)\n end",
"def create\n super\n\n if new_usuario_params[:password].blank?\n new_usuario_params.delete(:password)\n new_usuario_params.delete(:password_confirmation)\n end\n\n @usuario = Usuario.invite!(new_usuario_params,current_usuario)\n\n #current_taller.add_usuario(@usuario)\n\n\n respond_to do |format|\n if @usuario.valid?\n format.html { usuarios_path }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def registration_form_params\n params.require(:registration_form).permit(:name, :phone)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :avatar, :last_name, :display_name, :gender, :phone, :email, :password, :password_confirmation, )\n end",
"def registrar_params\nparams.require(:registrar).permit(:fullname, \n:titulo, :carrera, :institucion, :direccion, \n:ciudad, :postal, :pais, :telefono, :correo, \n:cartel, :delser, :adultez, :construccion, \n:quien, :como, :newmun, :desigualdad, :vende, :sustenta, :futuro)\n end",
"def registration_params\n params.require(:registration).permit(:member_id, :seat_number, :start_date, :end_date, :employee_id)\n end",
"def invite_params\n # params[:invite]\n params.require(:invite).permit(:email).merge(project_id: params[:project_id], exp_date: DateTime.now.tomorrow.to_date, token: @random_token)\n end",
"def create\n @user = User.new(params[:user])\n # todo: generate reasonably secure random passwords\n @user.password = \"qweprojisa2398dsl\"\n @user.password_confirmation = \"qweprojisa2398dsl\"\n \n # Save without session maintenance to skip auto-login, since we require\n # activation first.\n if @user.save_without_session_maintenance\n @user.send_registration_instructions!\n redirect_to(users_url, :notice => 'Invitation sent.')\n else\n render(:action => 'new', :notice => 'There was an error creating the invitation.')\n end\n end",
"def registration_params\n @registration_params ||= course_user_invitation_params[:registration_key] == 'checked'.freeze\n end",
"def registrer_params\n params.require(:registrer).permit(:registration, :name, :course, :module, :date_of_registration)\n end",
"def create\n # Init Member\n @member = Member.new(member_params)\n @member.invited = true\n if @member.save\n flash[:info] = \"Registration successful!\"\n @member.send_activation_email\n render 'activate'\n else\n render 'new'\n end\n end",
"def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end",
"def registration_params\n # params.fetch(:registration, {})\n params.require(:registration).permit(:created_at, :updated_at, :flight_id, :user_id, :class_seats)\n end",
"def invite(user_params, email)\n raise StandardError, 'The account can not be activate' if email.nil?\n self.username = user_params[:username] # set the username\n self.passwd = user_params[:passwd] # set the password\n self.passwd_confirmation = user_params[:passwd_confirmation]\n\n # save user and activate\n User.save_user_and_email(self, email, true)\n end",
"def configure_sign_up_params\n if request.content_type == 'application/json'\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n else\n params[:user].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n end\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def partner_invite_params\n params.require(:partner_invite).permit(:first_name, :last_name, :email)\n end",
"def sign_up_params\r\n params.require(:user).permit(:email, :password, :password_confirmation, :full_name, :amka, :father_amka, :mother_amka, :gender)\r\n end",
"def preregistration_params\n params.require(:preregistration).permit(:email)\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def registration_params\n @registration_params ||= course_user_invitation_params[:registration_key] == 'checked'\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def registration_params\n params.require(:registration).permit(:first_name, :middle_initial, :last_name, :email, :age, :date_of_birth, :accept_terms, :sex, :favorite_color, { prog_language_ids: [] }, address_attributes: [ :id, :street, :city, :state, :zip, county_attributes: [:id, :name] ])\n end",
"def user_invitation_params\n params.require(:user_invitation).permit(:reciever_email, :reciever_name, :company_id)\n end",
"def mobile_register_params\n params.permit(user: [:email, :password], experience: [:start_date, :end_date, :country_id, :committee_id])\n end",
"def registration_params\n params.require(:registration).permit(:id, :user_id, :registration_id, :device_name)\n end",
"def registration_params\n params.require(:registration).permit(:colonist_name, :colonist_age, :colonist_birtday, :colonist_gender, :colonist_dni, :colonist_address, :colonist_telephone, :colonist_email, :colonist_school_name, :colonist_grade, :colonist_school_address, :colonist_school_phone, :colonist_medical_insurance, :colonist_trauma, :colonist_surgery, :colonist_illness_asthma, :colonist_illness_allergy, :colonist_illness_heart_failure, :colonist_illness_diabetes, :colonist_illness_other, :colonist_medical_observation, :colonist_doctor, :colonist_know_swim, :colonist_swim_school, :colonist_swim_leave_reasons, :how_know_us, :parents_relation, :father_name, :father_age, :father_lives, :father_visit, :father_email, :father_profession, :father_work_phone, :mother_name, :mother_age, :mother_lives, :mother_visit, :mother_email, :mother_profession, :mother_work_phone, :who_register, :i_attest, :group_id, :admission)\n end",
"def sign_up_params\r\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\r\n end",
"def registration_params\n params.require(:registration).permit(:student_id, :evidence_id, :proof, :approved, :date, :justification, :assigned_points, :file_proof)\n end",
"def signup_params\n params.require(:signup).permit(:name, :email, :phone_number, :shift_id, :team_affiliation)\n end",
"def tour\n params.merge!({:email => 'tour@megam.io', :password => 'faketour'})\n create\n end",
"def sign_up_params\n params.require(:sign_up).permit(:first_name, :last_name, :email, :company_name, :company_mailing_address, :city, :state, :zip, :company_phone_number, :password, :password_confirmation, :company_type, :user_name)\n end",
"def sign_up_params\n params.require(:user).permit(:email, :user_name, :password,\n :password_confirmation)\n end",
"def new_registration\n if request.post? && params[:email] && params[:confirm_email]\n if params[:email] == params[:confirm_email]\n user = User.find_by_email(params[:email])\n user = User.create(:email => params[:email], :password => User.new_random_password(params[:email])) unless user\n session[:reg_form_callback] = [:admin, :index]\n redirect_to :controller => :registration, :action => :new, :user_id => user.id, :admin => true\n else\n flash[:notice] = \"Email addresses do not match.\"\n end\n end\n end",
"def register_params\n params.require(:employee).permit(:first_name, :last_name, :email, :contact, :user_name, :emp_password)\n end",
"def registration_params\n params.require(:registration).permit(:nama, :tempat_lahir, :tanggal_lahir, :jenis_kelamin, :alamat, :kontak_person, :asal_sekolah, :tahun_lulus, :fakultas_peminat, :jurusan_peminat, :referal, :kode_formulir)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :second_name, :email, :password, :password_confirmation)\n end",
"def create\n @registration = Registration.new(registration_params)\n logger.info(registration_params)\n @registration.tournament = Tournament.find(params[:tournament_id])\n\n if @registration.valid?\n @registration.save\n RegistrationMailer.confirmation_email(@registration).deliver\n flash[:notice] = 'Danke für deine Anmeldung. Du wirst in Kürze eine Bestätigungsmail erhalten.'\n redirect_to tournament_registration_path(@registration.tournament, @registration)\n else\n render :new\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n #@participant.password = Devise.friendly_token.first(8)\n respond_to do |format|\n if @participant.save\n #RegistrationMailer.welcome(user, generated_password).deliver\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up_params\n params.permit(:name, :email, :password, :password_confirmation)\n end",
"def configure_sign_up_params\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def sign_up_params\n\t\tparams.require(:user).permit(:firstname, :lastname, :age, :email, :password, :password_confirmation)\n\tend",
"def student_invite_params\n params.require(:student_invite).permit(:name, :email)\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n @invitation.sender = current_user\n\t path = request.host_with_port\n if @invitation.save\n if user_signed_in?\n Mailer.invite_friend(@invitation,current_user, path+new_user_registration_path(:invitation_token => @invitation.token)).deliver\n flash[:notice] = \"Thank you, invitation sent.\"\n redirect_to users_url\n else\n flash[:notice] = \"Thank you, we will notify when we are ready.\"\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end",
"def make_user(params = {})\n self.user= account.users.build_with_fields params.reverse_merge(:email => email, :invitation => self)\n end"
] | [
"0.7402331",
"0.7370224",
"0.7314875",
"0.7313359",
"0.7295393",
"0.723803",
"0.71251875",
"0.71043974",
"0.7102159",
"0.7093123",
"0.7057471",
"0.7006555",
"0.69879895",
"0.6956516",
"0.6944094",
"0.68957096",
"0.68836075",
"0.68494767",
"0.6847324",
"0.68035",
"0.6801838",
"0.67629397",
"0.6743414",
"0.6736785",
"0.6729881",
"0.6727439",
"0.6722257",
"0.67201644",
"0.6713579",
"0.6711513",
"0.6710494",
"0.6705333",
"0.6703387",
"0.6695589",
"0.66752875",
"0.66742635",
"0.66703653",
"0.66368127",
"0.6633904",
"0.66338015",
"0.662719",
"0.66269886",
"0.66263276",
"0.66207826",
"0.6601626",
"0.65978694",
"0.65877366",
"0.6586122",
"0.65840274",
"0.65765107",
"0.655773",
"0.65511876",
"0.6549668",
"0.6546826",
"0.65438414",
"0.65411496",
"0.6537877",
"0.6514691",
"0.65100175",
"0.64972794",
"0.64930576",
"0.6490853",
"0.64859325",
"0.64857894",
"0.64852065",
"0.64840055",
"0.64826",
"0.64822644",
"0.6480885",
"0.6475878",
"0.6475225",
"0.64692616",
"0.6467437",
"0.64640504",
"0.64632",
"0.6462123",
"0.6462123",
"0.6459343",
"0.64574146",
"0.64534175",
"0.64495593",
"0.64486355",
"0.64466035",
"0.64465034",
"0.6441893",
"0.6439563",
"0.64380187",
"0.64377564",
"0.6427368",
"0.64270127",
"0.6420697",
"0.64170027",
"0.64166945",
"0.64066136",
"0.6400504",
"0.63921237",
"0.63914865",
"0.63890696",
"0.6385304",
"0.63822335"
] | 0.687102 | 17 |
derived from DFS in nested hashes | def dfs(n)
case n
when Hash
n.each do |k,v|
@stack.push k
dfs(v)
@stack.pop
end
else
stripped = Array.new(@stack)
stripped.shift #strip off the :development or :production tag
if @stack.first == @environment
@env_vars[stripped.join('__').upcase] = n
end
tmp = Array.new(@stack).push "<%= ENV['#{stripped.join('__').upcase}'] %>"
@new_config.deep_merge!(tmp.reverse.inject { |mem, var| {var => mem}})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n # begin workaround removing depencency to order of Hash#each\n if @index.empty? then\n preference_of_nodes = nil\n else\n preference_of_nodes = {}.merge(@index)\n i = preference_of_nodes.values.max\n @graph.each_key do |node0|\n preference_of_nodes[node0] ||= (i += 1)\n end\n end\n # end workaround removing depencency to order of Hash#each\n\n dfs_visit = Proc.new { |from|\n visited[from] = true\n timestamp[from] = [count += 1]\n ary = @graph[from].keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |to|\n if visited[to]\n if timestamp[to].size > 1\n if timestamp[from].first < timestamp[to].first\n \t# forward edge (black)\n \tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n \tforward_edges[from] = to\n else\n \t# cross edge (black)\n \tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n \tcross_edges[from] = to\n end\n else\n # back edge (gray)\n p \"#{from} -> #{to} : back edge\" if $DEBUG\n back_edges[from] = to\n end\n else\n # tree edge (white)\n p \"#{from} -> #{to} : tree edge\" if $DEBUG\n tree_edges[to] = from\n dfs_visit.call(to)\n end\n end\n timestamp[from].push(count += 1)\n }\n\n ary = @graph.keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |node|\n unless visited[node]\n dfs_visit.call(node)\n end\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end",
"def dfs(root)\n return if root.nil?\n @stack << root\n @hash[root] = [root.val]\n @stack.each do |node|\n @hash[node] << root.left&.val\n @hash[node] << root.right&.val\n end\n dfs(root.left)\n dfs(root.right)\n @stack.pop\nend",
"def dfs\n visited = {}\n vertexes.keys.each {|v| visited[v] = false}\n unvisited = find_first_unvisited visited\n search_results = []\n until unvisited.is_nothing?\n #find a depth first search tree and hash containing the order that each node is visited\n dpst = explore(unvisited.from_just)\n if dpst.is_nothing?\n return Nothing.new\n else\n dpst = dpst.from_just\n end\n if search_results.empty?\n search_results.push dpst\n else\n search_results.each_with_index do |result, i|\n tree = dpst[:tree]\n found = false\n result.each do |v|\n if tree[v] and result.length < tree.keys.length\n results[i] = dpst\n found = true\n break\n end\n end\n break if found\n end\n end\n # Mark each point in the path as visited\n dpst[:visit_order].each do |k|\n visited[k] = true\n end\n unvisited = find_first_unvisited visited\n end\n search_results\n end",
"def dfs\n visited = Hash.new(false)\n @v.each do |vertex| \n visited.merge(explore(vertex)) if !visited[vertex]\n end\n return visited\n end",
"def dfs(graph)\n visited = Hash.new\n\n graph.each do |vertex, _|\n visited[vertex] = Hash.new\n visited[vertex][:state] = \"not visited\"\n end\n\n # This is to enable passing by reference in the dfs_visit method, otherwise\n # simply having a variable for integer will get passed by value and does not\n # behave/increment as expected.\n order = Hash.new\n order[:time] = 0\n\n graph.each do |vertex, _|\n dfs_visit(graph, vertex, visited, order) unless visited[vertex][:state] == \"done\"\n end\n\n visited\nend",
"def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n dfs_visit = Proc.new { |from|\n\tvisited[from] = true\n\ttimestamp[from] = [count += 1]\n\t@graph[from].each_key do |to|\n\t if visited[to]\n\t if timestamp[to].size > 1\n\t if timestamp[from].first < timestamp[to].first\n\t\t# forward edge (black)\n\t\tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n\t\tforward_edges[from] = to\n\t else\n\t\t# cross edge (black)\n\t\tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n\t\tcross_edges[from] = to\n\t end\n\t else\n\t # back edge (gray)\n\t p \"#{from} -> #{to} : back edge\" if $DEBUG\n\t back_edges[from] = to\n\t end\n\t else\n\t # tree edge (white)\n\t p \"#{from} -> #{to} : tree edge\" if $DEBUG\n\t tree_edges[to] = from\n\t dfs_visit.call(to)\n\t end\n\tend\n\ttimestamp[from].push(count += 1)\n }\n\n @graph.each_key do |node|\n\tunless visited[node]\n\t dfs_visit.call(node)\n\tend\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end",
"def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend",
"def dehash(hash, depth); end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend",
"def build_deep_hash( value, hash, levels )\n\t\tif levels.length == 0\n\t\t\tvalue.untaint\n\t\telsif hash.nil?\n\t\t\t{ levels.first => build_deep_hash(value, nil, levels[1..-1]) }\n\t\telse\n\t\t\thash.update({ levels.first => build_deep_hash(value, hash[levels.first], levels[1..-1]) })\n\t\tend\n\tend",
"def all_structural_subhashes\n hashes = []\n self.deep_each do |node|\n hashes << node.structural_hash\n end\n hashes\n end",
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def indifferent_dig hsh, keys\n keys.reduce(hsh) do |nested, key|\n next nil unless nested\n\n case key\n when String\n nested.key?(key) ? nested[key] : nested[key.intern]\n when Symbol\n nested.key?(key) ? nested[key] : nested[key.to_s]\n else\n nested[key]\n end # case\n end # method reduce\n end",
"def dfs(mapping, field)\n\n # Recurse is stop if mapping is not Hash or Array if Hashes.\n # We need to have hash, because in function use keys of hash and in mapping there are only \n # hash or array od hashes\n if (!mapping.class.equal?(Hash) & !mapping.class.equal?(Array) )\n return\n end\n\n # If we are in field set up field to true, to better mapping string -> text/keyword\n # In field string convert to keyword\n if (mapping.has_key?(\"field\") | mapping.has_key?(\"fields\"))\n field = true\n end\n\n # if we find hash with key \"type\" and value \"string\" it calls function replace_type_string\n # to map string to keyword or text\n # - string + analyzer -> text\n # - string + index.analyzed -> text\n # - string + index.not_analyzed -> keyword\n # - string + index.no -> text\n # - string in field -> keyword\n # - string not in field and without analyzer and index -> text\n #\n # if in hash is type value is not string and there are key index it calls function\n # replace_index to map values of index no/analyzed/not_analyzed to false / true / true \n # (except index belongs to string)\n # - no -> false\n # - analyzed -> true\n # - not_analyzed -> true\n if (mapping.has_key?(\"type\"))\n if (mapping[\"type\"] == \"string\")\n replace_type_string(mapping, field)\n else\n if (mapping.has_key?(\"index\"))\n replace_index(mapping)\n end\n end\n end\n\n # Recurse over all keys of hash of mapping with field\n mapping.keys.each do |key|\n dfs(mapping[key], field)\n end\n\n end",
"def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end",
"def build_deep_hash( value, hash, levels )\n\t\tif levels.length == 0\n\t\t\tvalue\n\t\telsif hash.nil?\n\t\t\t{ levels.first => build_deep_hash(value, nil, levels[1..-1]) }\n\t\telse\n\t\t\thash.update({ levels.first => build_deep_hash(value, hash[levels.first], levels[1..-1]) })\n\t\tend\n\tend",
"def recursive_find_hash(charity_hash,field_names,values)\n charity_hash.each do |key,value|\n # If value is a hash, call the function again\n if value.is_a? Hash \n recursive_find_hash(value,field_names,values)\n elsif value.is_a? Array \n if (value.first.is_a? Hash) == false\n if field_names.include? (key.to_s)\n key += @counter.to_s\n @counter += 1\n end\n field_names.push(key.to_s)\n values.push(value.to_s)\n else\n value.each do |array|\n recursive_find_hash(array, field_names, values)\n end \n end\n else\n # If value is not a hash, key is the header and the value is the value\n if field_names.include? key.to_s\n key += @counter.to_s\n @counter += 1\n end\n field_names.push(key.to_s)\n values.push(value.to_s)\n end\n end\n \n end",
"def get_tree_height(d,cnt = 0 )\n \n if ( d['l'] == {} && d['r'] == {} )\n @depth = cnt if @depth < cnt\n else\n cnt = cnt + 1\n get_tree_height(d['l'],cnt) if d.key?('l')\n get_tree_height(d['r'],cnt) if d.key?('r')\n end\n \n return @depth\n \nend",
"def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end",
"def deep_transform_keys(&block); end",
"def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend",
"def depth; end",
"def dfs(a_lists)\n @count = 0\n id = {}\n preorder, postorder, visited = [], [], []\n a_lists.each do |v|\n if !visited.include?(v.name)\n dfs_visit(v.name, a_lists, id, visited, preorder, postorder)\n end\n end\n return preorder, postorder.reverse\n end",
"def build_parents(data)\n data.inject({}) do |h, d|\n (1...d.length).each { |i| h[d[i]] = d[0] }; h\n end\nend",
"def deeper(hash, remainingLevels, value)\n node = remainingLevels.shift\n node.gsub!(\"$\", \"-s-\")\n if (hash[node].nil?)\n hash[node] = remainingLevels.empty? ? value : Hash.new\n else\n hash[node] = value if remainingLevels.empty?\n end\n deeper(hash[node], remainingLevels, value) if !remainingLevels.empty?\n end",
"def deep_munge(hash)\r\nhash.each do |k, v|\r\ncase v\r\nwhen Array\r\nv.grep(Hash) { |x| deep_munge(x) }\r\nv.compact!\r\nhash[k] = nil if v.empty?\r\nwhen Hash\r\ndeep_munge(v)\r\nend\r\nend\r\nhash\r\nend",
"def dfs(i, j, visited, m, group)\n # These arrays are used to get row and\n # column numbers of 4 neighbours\n # of a given cell\n rowNbr = [-1, 0, 0, 1]\n colNbr = [ 0, -1, 1, 0]\n\n # Mark this cell as visited\n visited[i][j] = true\n group += 1\n #puts \"dfs #{i}, #{j} group:#{group}\"\n # Recurse for all connected neighbours\n 0.upto(4 - 1) do |k|\n if isSafe(i + rowNbr[k], j + colNbr[k], visited, m)\n # puts \"k:#{k} i:#{i + rowNbr[k]}, j:#{j + colNbr[k]}\"\n group = dfs(i + rowNbr[k], j + colNbr[k], visited, m, group)\n end\n end\n #puts \"RETURN:#{group}\"\n return group\nend",
"def dfs(root, depth)\n return if root.nil?\n @f[depth] = @f[depth].to_i + root.val\n dfs(root.left, depth + 1) if root.left\n dfs(root.right, depth + 1) if root.right\nend",
"def deep_transform_keys!(&block); end",
"def deep_hash(hash)\n break_keys(hash).tap do\n hash.each do |key, value|\n hash[key] = deep_hash_value(value)\n end\n end\n end",
"def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend",
"def produce_tree(ary); end",
"def nest_hash(query, index, value)\n return value if query[index].nil? \n { query[index] => nest_hash(query, index + 1, value) }\nend",
"def dig_deep(*args)\n full_args = args.dup\n parent_key = args.shift\n result = nil\n if parent_key.is_a?(Integer)\n result = dig(parent_key)\n unless result.nil? || args.length.zero?\n result = result.dig_deep(*args)\n end\n end\n if result.nil?\n each do |x|\n if x.respond_to?(:dig_deep) || x.is_a?(Array)\n result = x.dig_deep(*full_args)\n end\n return result unless result.nil?\n end\n end\n return result\n end",
"def dfs(list)\n s = []\n visited = Set.new\n\n s.push(start_node)\n\n while !s.empty?\n current_node = s.shift\n next if visited.include?(current_node)\n visited.add(current_node)\n current_node.neighbors.each do |n|\n s.push(n)\n end\n puts current_node.name\n p s.map(&:name)\n p visited.map(&:name)\n end\nend",
"def build_struct_tree data\n data.to_hashugar\n end",
"def parse(ds)\n final_hash = {}\n current_key, inner_key = nil, nil\n current_hash = final_hash\n ds.each_with_index do |value, index|\n if value.is_a? Hash\n if current_key == nil\n current_hash.merge!(value)\n elsif inner_key\n current_hash[inner_key].merge!(value)\n else\n current_hash[current_key].merge!(value)\n end\n elsif value.is_a? Array\n value = value.first\n parent_key = value.count > 1 ? value[-2] : value.first\n if parent_key == current_key\n current_hash = final_hash[current_key]\n inner_key = value.last\n current_hash[inner_key] = {}\n elsif inner_key && parent_key == inner_key\n current_hash = current_hash[inner_key]\n inner_key = value.last\n current_hash[inner_key] = {}\n elsif value.count > 1\n value.each_with_index do |key, nindex|\n current_hash[key] = {}\n current_hash = current_hash[key] if nindex + 1 < value.count\n end\n inner_key = value.last\n current_key = value.first\n else\n current_hash = final_hash\n current_key = value.first\n inner_key = nil\n final_hash[current_key] = {}\n end\n end\n end\n final_hash\n end",
"def depth=(_arg0); end",
"def count_structure_levels(obj)\n if obj.respond_to?(:keys)\n # empty hash also has depth 0.\n max_depth = 0\n obj.keys.each do |key|\n child_levels = 1 + count_structure_levels(obj[key])\n max_depth = [max_depth, child_levels].max\n end\n max_depth\n elsif obj.is_a?(Array)\n # empty array also has depth 0.\n max_depth = 0\n obj.each do |child|\n child_levels = 1 + count_structure_levels(child)\n max_depth = [max_depth, child_levels].max\n end\n max_depth\n else\n 0\n end\nend",
"def member_id_tree h, id, dont_visit = Set.new\n id_member_ids = Set.new [(member_ids h, id)].flatten(1)\n dont_visit << id\n visit = (id_member_ids - dont_visit)\n result = visit.map { |member_id|\n [member_id,( member_id_tree h, member_id, dont_visit ) ]\n }.to_h\n result\n end",
"def depth_first(node, visited = Set.new())\n return nil if visited.include?(node.val)\n\n puts node.val\n visited.add(node.val)\n\n node.neighbors.each do |neighbor|\n depth_first(neighbor, visited);\n end\nend",
"def dfs(root, result)\n return if root.nil?\n result << root.val if root.left.nil? && root.right.nil?\n dfs(root.left, result)\n dfs(root.right, result)\nend",
"def deep_merge(source, hash); end",
"def deep_merge(source, hash); end",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def to_deep_hash \n new_array = []\n self.each_index do |index|\n new_array[index] = deeply_to_hash(self[index])\n end\n new_array\n end",
"def ways_traverse_brute(map)\n visited = Array.new(map.length) { Array.new(map[0].length, false) }\n saved = Array.new(map.length) { Array.new(map[0].length, 0) }\n\n visited[0][0] = true\n ways_traverse_brute_rec(0, 0, visited, map)\nend",
"def bfs\n return [] unless @root\n q = [@root]\n out = []\n\n until q.empty? do\n current = q.shift\n out << { key: current.key, value: current.value }\n q << current.left if current.left\n q << current.right if current.right\n end\n\n return out\n end",
"def kruskal\n # initialize\n rel = self.to_relations.sort{|a, b| a <=> b}\n index = []\n for i in 0 .. (rel.size - 1) do\n for j in (i + 1) .. (rel.size - 1) do\n if rel[i] == rel[j]\n index << j\n end\n end\n end\n index.sort{|x, y| y<=>x}.each do |idx|\n rel[idx, 1] = []\n end\n mst = []\n seen = Hash.new()\n @graph.each_key do |x|\n seen[x] = nil\n end\n i = 1\n # initialize end\n\n rel.each do |r|\n if seen[r.node[0]] == nil\n seen[r.node[0]] = 0\n end\n if seen[r.node[1]] == nil\n seen[r.node[1]] = 0\n end\n if seen[r.node[0]] == seen[r.node[1]] && seen[r.node[0]] == 0\n mst << r\n seen[r.node[0]] = i\n seen[r.node[1]] = i\n elsif seen[r.node[0]] != seen[r.node[1]]\n mst << r\n v1 = seen[r.node[0]].dup\n v2 = seen[r.node[1]].dup\n seen.each do |k, v|\n if v == v1 || v == v2\n seen[k] = i\n end\n end\n end\n i += 1\n end\n return Pathway.new(mst)\n end",
"def dfs(node, visited, component = [])\n visited << node\n component << node.object\n\n node.adjacents.each do |adjacent_node|\n dfs(adjacent_node, visited, component) unless visited.include?(adjacent_node)\n end\n end",
"def dfs_rec(data)\n @root.each { |node| return node if data == node.data }\n end",
"def dfs(node)\n preorder, visited = [], []\n dfs_visit(node, visited, preorder)\n preorder\nend",
"def deep_merge_hashes(master_hash, other_hash); end",
"def dfs_tree_from_vertex(start)\n tree_from_vertex(start, :dfs)\n end",
"def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend",
"def dfs_rec(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil \r\n return nil if tree.visited == true\r\n tree.visited = true\r\n return tree if tree.value == value\r\n puts \"current = #{tree}\" if verbose\r\n left = dfs_rec(tree.children[0], value, args)\r\n return left if left != nil\r\n right = dfs_rec(tree.children[1], value, args)\r\n return right # if right != nil\r\n end",
"def descendent_keyinfo\n \t self_and_descendents.map{ |f|\n\t\t{ id: f.id, name: f.name, parent: f.parent, level: f.level}\n\t\t}.flatten\n end",
"def deep_merge!(target, hash); end",
"def deep_merge!(target, hash); end",
"def deep_hash\n UniMap.deep_hash( self )\n end",
"def extract_nested_fact(fact_hashes, keys)\n fact_hashes.map do |fact_hash|\n hash = fact_hash['value']\n\n # Traverse the hash, setting `hash` equal to the next level deep each step\n keys[0..-2].each do |key|\n hash = hash.fetch(key, {})\n end\n\n # Lookup the final key. This will convert to nil if we've been defaulting\n # to empty hash beforehand.\n hash[keys.last]\n end\n end",
"def dfs(start_node)\n s = []\n visited = Set.new\n\n s.push(start_node)\n\n while !s.empty?\n current_node = s.shift\n next if visited.include?(current_node)\n visited.add(current_node)\n current_node.neighbors.each do |n|\n s.push(n)\n end\n puts current_node.name\n p s.map(&:name)\n p visited.map(&:name)\n end\nend",
"def depth_first_full(graph)\n visited = Set.new()\n graph.keys.each do |node|\n _depth_first(node, graph, visited)\n end\nend",
"def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend",
"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 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 dfs(target)\n visited = {}\n @graph.keys.each { |key| visited[key] = false }\n node = @graph.keys[0]\n res = search_dfs(node, target, visited) \n end",
"def get_direct_link_shorage_value(hash,source,child_hash)\r\n child_result = {}\r\n hash.each do|k,v_hash|\r\n v_hash.each do |ki,v|\r\n if ki == source\r\n if child_hash[ki] and child_hash[ki][0] < v[0]\r\n else\r\n child_result[k] = [v,ki]\r\n\t end\r\n end\r\n end \r\n end\r\n return child_result \r\n end",
"def convert_to_first_level\n hash = Hash.new\n proc = Proc.new {|k,v| v.is_a?(Hash) ? v.each(&proc) : hash[k] = v}\n each &proc\n hash\n end",
"def deep_thaw\n chilled = {}\n each do |k, v|\n chilled[k] = v.is_a?(Hash) ? v.deep_thaw : v.dup\n end\n\n chilled.dup\n end",
"def depth_first(value)\n\tend",
"def expand\n {}.to_tree_hash.tap do |hash|\n each do |k, v|\n hash.bridge(k => v)\n end\n end.value\n end",
"def helper(array)\n nest_it = {}\n\n array.each do |k_v_p|\n hashy = {}\n keys_array = parse_key(k_v_p.first)\n value = k_v_p.last\n\n hashy = hashify(keys_array, value) || {}\n nest_it = nest_it.deep_merge(hashy)\n\n end\n\n nest_it\n end",
"def optimize_depth_array()\n\n @root = @all_depths[0].first[1]\n\n # for each depth in tree\n @all_depths[1..@all_depths.length-1].each do |depth|\n # for each item in depth (could be node or array of nodes)\n depth.each do |sec_id, item|\n if (item.class == Node)\n node = item\n parent = get_parent(node.path)\n parent.add_child(node)\n else # item is array of nodes\n item.each do |node|\n parent = get_parent(node.path)\n parent.add_child(node)\n end\n end\n end\n end\n\n end",
"def dfs_rec knight, target, collector=[]\n\n if knight\n puts \"#{knight.position} and #{target}\"\n\n \n\n if knight.position == target\n collector.push knight\n end\n moves = knight.moves.size - 1\n moves.times do |num|\n dfs_rec knight.moves[num], target, collector\n end\n end\n\n return collector\nend",
"def flatten_hash(item, parent_name=nil, result=nil)\n result = Hash.new() if result.nil?\n if item.kind_of? Hash\n parent_name += \".\" if not parent_name.nil?\n item.each do |k,v|\n flatten_hash(v, \"#{parent_name}#{k}\", result)\n end\n else\n result[parent_name] = item\n end\n result\nend",
"def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend",
"def dfs\n closed = []\n fringe = initialize_fringe\n\n loop do\n return nil if fringe.empty? # No solution\n current = fringe.pop\n city = current[:city]\n return current if done? city # Found the solution?\n unless closed.include?(city) # Expand if we have not visited the city\n closed.push city\n fringe = fringe + expand(current) # Add to end for FILO\n end\n end\n end",
"def descendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n children.each do |kid|\n node = Array.new\n node[0] = kid\n kid_spice = kid.spice\n if (!kid_spice.nil? && kid_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n kid_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n kid.descendants(result, depth + 1)\n end \n \n return result\n \n end",
"def nested_find(obj, needed_key)\n return [] unless obj.is_a?(Array) || obj.is_a?(Hash)\n\n ret = []\n\n if obj.is_a?(Hash)\n ret.push obj if obj[needed_key]\n obj.each { |_hash, val| ret += nested_find(val, needed_key) }\n end\n obj.each { |val| ret += nested_find(val, needed_key) } if obj.is_a?(Array)\n ret\nend",
"def nested_find(obj, needed_key)\n return [] unless obj.is_a?(Array) || obj.is_a?(Hash)\n\n ret = []\n\n if obj.is_a?(Hash)\n ret.push obj if obj[needed_key]\n obj.each { |_hash, val| ret += nested_find(val, needed_key) }\n end\n obj.each { |val| ret += nested_find(val, needed_key) } if obj.is_a?(Array)\n ret\nend",
"def ids_recursive(vertex, goal_vertex, depth, max_depth)\n @stack.push(vertex) # Add vertex to frontier\n return 1 if vertex == goal_vertex # If goal_vertex is reached, return 1. ! Not necessarily shortest path !\n @stack.pop() && return if depth == max_depth\n @explored[vertex.label] = true # Mark vertex as being explored\n depth = depth + 1\n vertex.edges.each { |edge| # Expand current vertex\n unless @explored.has_key? edge.label # If already explored, then ignore the vertex\n return 1 if ids_recursive(edge, goal_vertex, depth, max_depth) == 1 # Recursively do depth_first on the vertices\n end\n }\n @stack.pop() #Backtracking so popping the vertex from the stack\n end",
"def pp_dfs(tree)\n arr = []\n pp_dfs_helper(tree, arr)\n return arr.inspect\n end",
"def my_depth\n 1\n end",
"def dfs(tree)\n # Return the tree if the root value matches the search value\n if @stack[-1].nil?\n return nil\n elsif @stack[-1]['value'] == @value || @stack[-1] == @value\n return @stack[-1]\n end\n \n # Add left tree to the stack if it exists, otherwise the right branch if it exists\n if @stack[-1]['branches']['left'].nil? == false\n @stack << tree['branches']['left']\n dfs(@stack[-1])\n elsif @stack[-1]['branches']['right'].nil? == false\n @stack << tree['branches']['right']\n elsif @stack[-1]['branches']['left'].nil? == false && @stack[-1]['branches']['right'].nil? == false\n @stack.pop\n end\n \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 test_hierarchical_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*856*0001~\n BSN*00*??*19700101*00000000*0001~\n DTM*011*19700101~\n HL*1**S~\n TD1*CTN*1****G*0.1773127753*LB~\n TD5*Z*2*??*ZZ*UPS3~\n REF*PK*?~\n DTM*011*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n HL*2*1*O~\n PRF*00000007397108***19700101~\n HL*3*2*P~\n MAN*SM*?~\n HL*4*3*I~\n LIN*1*UP*860001662184*VP*860001662184~\n SN1*1*1*EA**1*EA~\n SLN*1**O*1*EA*59.95*PE~\n CTT*2*159.85~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS856::TS.new(store)\n ts.BSN do |bsn|\n bsn.BSN01 = \"00\"\n bsn.BSN02 = \"??\"\n bsn.BSN03 = @epoch\n bsn.BSN04 = @epoch\n bsn.BSN05 = \"0001\"\n end\n ts.DTM do |dtm|\n dtm.DateTimeQualifier = \"011\" # Shipped\n dtm.Date = @epoch\n end\n ts.HL_SHIPMENT do |hl_s|\n hl_s.HL.HL01 = \"1\"\n hl_s.HL.HL03 = \"S\"\n hl_s.TD1.TD101 = \"CTN\"\n hl_s.TD1.TD102 = 1\n hl_s.TD1.TD106 = \"G\"\n hl_s.TD1.TD107 = (80.5 / 454) # 0.1773127753\n hl_s.TD1.TD108 = \"LB\"\n hl_s.TD5.TD501 = \"Z\"\n hl_s.TD5.TD502 = \"2\"\n hl_s.TD5.TD503 = \"??\"\n hl_s.TD5.TD504 = \"ZZ\"\n hl_s.TD5.TD505 = \"UPS3\"\n hl_s.REF.REF01 = \"PK\"\n hl_s.REF.REF02 = \"?\"\n hl_s.DTM.DTM01 = \"011\" # Shipped\n hl_s.DTM.DTM02 = @epoch\n hl_s.L_N1 do |n1|\n # N1\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n # N3\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n hl_s.HL_ORDER do |hl_o|\n hl_o.HL.HL01 = \"2\"\n hl_o.HL.HL02 = \"1\"\n hl_o.HL.HL03 = \"O\"\n hl_o.PRF.PRF01 = \"00000007397108\"\n hl_o.PRF.PRF04 = @epoch\n end\n hl_s.HL_TARE do |hl_t|\n hl_t.HL.HL01 = \"3\"\n hl_t.HL.HL02 = \"2\"\n hl_t.HL.HL03 = \"P\"\n hl_t.MAN.MAN01 = \"SM\"\n hl_t.MAN.MAN02 = \"?\"\n end\n hl_s.HL_ITEM do |hl_i|\n hl_i.HL.HL01 = \"4\"\n hl_i.HL.HL02 = \"3\"\n hl_i.HL.HL03 = \"I\"\n hl_i.LIN.LIN01 = \"1\"\n hl_i.LIN.LIN02 = \"UP\"\n hl_i.LIN.LIN03 = \"860001662184\"\n hl_i.LIN.LIN04 = \"VP\"\n hl_i.LIN.LIN05 = \"860001662184\"\n hl_i.SN1.SN101 = \"1\"\n hl_i.SN1.SN102 = 1\n hl_i.SN1.SN103 = \"EA\"\n hl_i.SN1.SN105 = 1\n hl_i.SN1.SN106 = \"EA\"\n hl_i.L_SLN do |rep|\n rep.SLN.SLN01 = \"1\"\n rep.SLN.SLN03 = \"O\"\n rep.SLN.SLN04 = 1\n rep.SLN.SLN05 = \"EA\"\n rep.SLN.SLN06 = 59.95\n rep.SLN.SLN07 = \"PE\"\n end\n end\n end\n ts.CTT do |ctt|\n ctt.CTT01 = 2\n ctt.CTT02 = 159.85\n end\n result = ts.render()\n assert_equal(want, result)\n end",
"def grab_children(father)\n local_list = []\n father.each_pair do |key, value| \n local_list.push(key)\n local_list.push(grab_children(value))\n end\n return local_list\nend",
"def kruskal\n # initialize\n rel = self.to_relations.sort{|a, b| a <=> b}\n index = []\n for i in 0 .. (rel.size - 1) do\n for j in (i + 1) .. (rel.size - 1) do\n if rel[i] == rel[j]\n index << j\n end\n end\n end\n index.sort{|x, y| y<=>x}.each do |i|\n rel[i, 1] = []\n end\n mst = []\n seen = Hash.new()\n @graph.each_key do |x|\n seen[x] = nil\n end\n i = 1\n # initialize end\n\n rel.each do |r|\n if seen[r.node[0]] == nil\n seen[r.node[0]] = 0\n end\n if seen[r.node[1]] == nil\n seen[r.node[1]] = 0\n end\n if seen[r.node[0]] == seen[r.node[1]] && seen[r.node[0]] == 0\n mst << r\n seen[r.node[0]] = i\n seen[r.node[1]] = i\n elsif seen[r.node[0]] != seen[r.node[1]]\n mst << r\n v1 = seen[r.node[0]].dup\n v2 = seen[r.node[1]].dup\n seen.each do |k, v|\n if v == v1 || v == v2\n seen[k] = i\n end\n end\n end\n i += 1\n end\n return Pathway.new(mst)\n end",
"def path_finder(value, structure, path = [])\n #i tracks the index of the current array\n if value == structure\n path << true\n end\n if !path.include?(true)\n # binding.pry\n if structure.respond_to?(:each)\n #test each element of the hash\n structure.each do |element_key, element_value|\n if !path.include?(true)\n #once we've captured \"true\", we don't need to add to the path anymore\n path << element_key\n end\n if element_value == value\n path << true\n else\n path = path_finder(value, element_value, path)\n if !path.include?(true)\n #if path comes back from a false branch, remove the last part\n path.pop\n end\n end\n end\n else\n return path\n end\n end\n path\nend",
"def bfs(char, the_set)\n q = [char]\n @visited[char] = true\n while ! q.empty?\n x = q.shift\n the_set.add(x)\n @map[x] = the_set\n @h[x].keys.each do |y|\n next if @visited[y]\n @visited[y] = true\n q.push(y)\n end\n end\nend",
"def dfs_for(coords, current_node = @tree, stack = [], hit_squares = [], benchmark = false)\n\t\tif is_current_square_match?(coords, current_node)\n\t\t\tmatch_found(coords, current_node, benchmark)\n\t\telse\n\t\t\thit_squares << get_coords_from_node(current_node)\n\t\t\tcurrent_node.children.each {|child| stack.unshift(child) unless hit_squares.include?(get_coords_from_node(child))} if current_node.children\n\t\t\tnext_node = stack.shift\n\t\t\tnext_node.nil? ? not_found(coords, benchmark) : dfs_for(coords, next_node, stack, hit_squares, benchmark) \n\t\tend\n\tend",
"def recursive => nil",
"def dfs(initial)\n nodes, seen = Set.new, Set.new\n stack = Array(initial).reverse\n\n while node = stack.pop\n if seen.include?(node)\n nodes.add(node)\n else\n seen.add(node)\n stack.push(node)\n stack.concat(Array(yield node).reverse)\n end\n end\n\n nodes\n end"
] | [
"0.6871196",
"0.67545426",
"0.6714706",
"0.6621068",
"0.6476852",
"0.64155054",
"0.6409428",
"0.63520736",
"0.6309223",
"0.62255555",
"0.61277616",
"0.6091271",
"0.60905826",
"0.6071523",
"0.60594124",
"0.60304475",
"0.5957895",
"0.5951898",
"0.59150136",
"0.5896607",
"0.589442",
"0.5892247",
"0.5859543",
"0.5849583",
"0.58387184",
"0.5814229",
"0.5799478",
"0.57800215",
"0.57631224",
"0.5747075",
"0.57414716",
"0.5739979",
"0.57391816",
"0.57343656",
"0.5732784",
"0.57159",
"0.5712758",
"0.57042253",
"0.5702748",
"0.5698923",
"0.5693977",
"0.5693914",
"0.56896526",
"0.56875706",
"0.5668722",
"0.56662756",
"0.5666132",
"0.56445646",
"0.56445646",
"0.5635126",
"0.56200796",
"0.56049746",
"0.5604443",
"0.5597609",
"0.5589279",
"0.55830616",
"0.55826896",
"0.5577117",
"0.5566359",
"0.5563716",
"0.5562583",
"0.55622184",
"0.55617094",
"0.55617094",
"0.55591035",
"0.5533781",
"0.5529409",
"0.5527232",
"0.55204874",
"0.55179137",
"0.55141413",
"0.55113536",
"0.55045426",
"0.54841864",
"0.5477524",
"0.5475931",
"0.54728174",
"0.5469936",
"0.54676265",
"0.5463483",
"0.54607135",
"0.5459241",
"0.5451392",
"0.54465336",
"0.5445983",
"0.54408234",
"0.54408234",
"0.54372907",
"0.5435631",
"0.54350483",
"0.5426288",
"0.54252154",
"0.5425061",
"0.5421423",
"0.54182404",
"0.54163593",
"0.54163",
"0.5415095",
"0.54137725",
"0.5408596"
] | 0.54265296 | 90 |
scores for each letter | def letter_scores
{ "A"=>1, "B"=>3, "C"=>3, "D"=>2,
"E"=>1, "F"=>4, "G"=>2, "H"=>4,
"I"=>1, "J"=>8, "K"=>5, "L"=>1,
"M"=>3, "N"=>1, "O"=>1, "P"=>3,
"Q"=>10, "R"=>1, "S"=>1, "T"=>1,
"U"=>1, "V"=>4, "W"=>4, "X"=>8,
"Y"=>4, "Z"=>10
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end",
"def score\n word_score = 0\n self.word.each_char do |letter|\n word_score += @letter_scores[letter.to_sym]\n end\n return word_score\n end",
"def score\n\n letters = word.split(//) #can also be typed .split(\"\")\n\n symbols = letters.map do|letter|\n letter.to_sym\n end\n\n word_score = symbols.reduce(0) do |sum, sym|\n sum + @letter_score[sym]\n end\n\n return word_score\n\n end",
"def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend",
"def calculate\n score = 0\n\n names.each do |name|\n current_score = 0\n name_score = 0\n\n name.split('').each do |letter|\n current_score += LETTER_SCORES[letter]\n name_score = current_score\n end\n\n current_score *= names.index(name) + 1\n score += current_score\n end\n\n score\n end",
"def score\n @score = 0\n self.to_array.each do |letter|\n @score += TILE_VALUES[letter]\n end\n \"Your word score: #{@score}\"\n end",
"def scrabble_score word\n scores = {\n 'a' => 1, 'e'=> 1, 'i' => 1, 'o' => 1, \n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2, \n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3, \n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4, \n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8, \n 'q' => 10, 'z' => 10\n }\n\n total = 0\n word.downcase.each_char do |letter|\n total += scores[letter]\n end\n total\nend",
"def score(word)\n LETTERS.zip(VALUES_OF_LETTERS).map{|x| word.count(x[0])*x[1] }.reduce(:+)\nend",
"def scrabble_score( word )\n # Start with a sum of zero and we can add the score of each letter to it\n total = 0\n\n # .chars turn a string into an array of the letters then we can loop through\n # .each of those\n # can also do .each_char\n # For each letter, look up the score for the letter in our scores hash\n word.chars.each do |letter|\n # puts \"letter: #{letter}\"\n # puts \"score: #{@scores[letter]}\"\n total += @scores[letter]\n end # end word.each_char\n\n puts \"The score of the word #{word} is #{total}.\"\n\n end",
"def score(word)\n score = 0\n word = word.upcase.split(//)\n word.each do |letter|\n score += scorer(letter)\n end\n score\n end",
"def score(name)\n name_score = 0\n name.each_char do |character|\n name_score = name_score + character_score(character)\n end\n name_score\nend",
"def alpha_score(word, alpha_values)\n score = 0\n word.split(\"\").each do |alphabet|\n score += alpha_values[alphabet]\n end\n return score\nend",
"def score_word (word)\n score = 0\n word = word.downcase\n word = word.split('')\n\n # award additional points per game rules\n if word.length >= 7 && word.length <= 10\n score =+ 8\n end\n\n # iterates over the input to assign score based on alphabet library\n letters = [\n { character: \"a\", quantity: 9, score: 1 },\n { character: \"b\", quantity: 2, score: 3 },\n { character: \"c\", quantity: 2, score: 3 },\n { character: \"d\", quantity: 4, score: 2 },\n { character: \"e\", quantity: 12, score: 1 },\n { character: \"f\", quantity: 2, score: 4 },\n { character: \"g\", quantity: 3, score: 2 },\n { character: \"h\", quantity: 2, score: 4 },\n { character: \"i\", quantity: 9, score: 1 },\n { character: \"j\", quantity: 1, score: 8 },\n { character: \"k\", quantity: 1, score: 5 },\n { character: \"l\", quantity: 4, score: 1 },\n { character: \"m\", quantity: 2, score: 3 },\n { character: \"n\", quantity: 6, score: 1 },\n { character: \"o\", quantity: 8, score: 1 },\n { character: \"p\", quantity: 2, score: 3 },\n { character: \"q\", quantity: 1, score: 10 },\n { character: \"r\", quantity: 6, score: 1 },\n { character: \"s\", quantity: 4, score: 1 },\n { character: \"t\", quantity: 6, score: 1 },\n { character: \"u\", quantity: 4, score: 1 },\n { character: \"v\", quantity: 2, score: 4 },\n { character: \"w\", quantity: 2, score: 4 },\n { character: \"x\", quantity: 1, score: 8 },\n { character: \"y\", quantity: 2, score: 4 },\n { character: \"z\", quantity: 1, score: 10 },\n ]\n word.each do |character|\n letters.each do |letter_ref|\n if character == letter_ref[:character]\n score = score + letter_ref[:score]\n end\n end\n end\n return score\nend",
"def scrabble(word)\n\tpoints = {\n\t\t1 => [A,E,I,O,U,L,N,R,S,T],\n\t\t2 => [D,G],\n\t\t3 => [B,C,M,P],\n\t\t4 => [F,H,V,W,Y],\n\t\t5 => [K],\n\t\t8 => [J, X],\n\t\t10 => [Q, Z]\n\t}\n \n def self.score(word)\n \ttotal_score = 0\n \tword.each_char do |char|\n \t\tSCORES.each do |score, letters|\n \t\t\tif letters.include? char.upcase\n \t\t\t\ttotal_score += score\n \t\t\tend\n \t\tend\n \tend\t\n\nend",
"def alphabet_score(string)\n alpha = ('a'..'z').to_a\n\n words_with_points = string.split(' ').map { |word| [word.chars.map { |char| alpha.index(char) + 1 }.sum, word] }\n words_with_points.max_by { |inner| inner[0] }.last\nend",
"def score_word(word)\n # - Each letter within `word` has a point value. The number of points of each letter is summed up to represent the total score of `word`\n # - Each letter's point value is described in the table below\n # - If the length of the word is 7, 8, 9, or 10, then the word gets an additional 8 points\n # return int points\nend",
"def calc_score(name)\n \n count = [0]*$alphabet.size\n count_letters(name, count)\n\n score = count.each_with_index {|val, idx| puts count[idx] *= $pscounts[idx]}.inject(:+)\n puts \"score: #{score}\"\n score = score / (name.size - name.count(' '))\n score *= 2 if $firstnames.include? name.downcase.split(' ').first\n\n score\nend",
"def score_word(word) \n points = {\n [\"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"] => 1,\n [\"D\", \"G\"] => 2,\n [\"B\", \"C\", \"M\", \"P\"] => 3,\n [\"F\", \"H\", \"V\", \"W\", \"Y\"] => 4,\n [\"K\"] => 5,\n [\"J\", \"X\"] => 8,\n [\"Q\", \"Z\"] => 10\n }\n\n score = 0 \n score += 8 if (word.length > 6) && (word.length < 11) \n\n tile_split = word.upcase.split(\"\")\n\n tile_split.each do |letter| \n points.each do |score_chart, point|\n score += point if score_chart.include?(letter) \n end \n end \n return score\nend",
"def score_word (word)\n\n this_letter = []\n this_letter << word.upcase.split(\"\")\n this_letter.flatten!\n\n score = 0\n this_letter.each do |value|\n\n case value\n when 'A', 'E', 'I', 'O' , 'U' , 'L' , 'N' , 'R' , 'S' , 'T'\n score += 1\n when 'D', 'G'\n score += 2\n when 'B', 'C', 'M', 'P'\n score += 3\n when 'F', 'H', 'V', 'W' , 'Y'\n score += 4\n when 'K'\n score += 5\n when 'J', 'X'\n score += 8\n when 'Q', 'Z'\n score += 10\n end\n end\n\n\n if word.length > 6 && word.length < 11\n score += 8\n end\n\n return score\nend",
"def hand_score(hand)\n points = {\n \"A\"=>4,\n \"K\"=>3,\n \"Q\"=>2,\n \"J\"=>1\n }\n\n score = 0\n hand.each_char { |char| score += points[char.upcase] }\n return score\nend",
"def score_word(word)\n word_letters = make_word_array(word)\n score = 0\n word_letters.each do |letter|\n score += LETTER_SCORES[letter]\n end\n score += 8 if word.length >= 7 && word.length <= 10\n return score\nend",
"def score_letter(ver, letter)\n ver.map do |point, list| \n if list.include?(letter.to_s)\n return point\n end\n end\n return 0 \n end",
"def high(string)\n letter_scores = ('a'..'z').zip(1..26).to_h\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores[char]}\n score \n end\n words[word_scores.index(word_scores.max)]\nend",
"def score_word(word)\n letter_values = {\n \"A\" => 1,\n \"B\" => 3,\n \"C\" => 3,\n \"D\" => 2,\n \"E\" => 1,\n \"F\" => 4,\n \"G\" => 2,\n \"H\" => 4,\n \"I\" => 1,\n \"J\" => 8,\n \"K\" => 5,\n \"L\" => 1,\n \"M\" => 3,\n \"N\" => 1,\n \"O\" => 1,\n \"P\" => 3,\n \"Q\" => 10,\n \"R\" => 1,\n \"S\" => 1,\n \"T\" => 1,\n \"U\" => 1,\n \"V\" => 4,\n \"W\" => 4,\n \"X\" => 8,\n \"Y\" => 4,\n \"Z\" => 10\n }\n total_score = 0\n word.upcase.split(//).each do |letter|\n total_score += letter_values[letter]\n end\n\n if word.length > 6\n total_score += 8\n end\n\n return total_score \nend",
"def high(string)\n letter_scores = ('a'..'z').to_a\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores.index(char}\n score \n end\n words[word_scores.index(word_scores.max)]\nend",
"def word_score(word, rack)\n # set our score to 0\n score = 0\n # loop through each letter and find the score from the list then add it\n # to our total\n word.chars.each do |letter|\n score += SCORES[letter.to_sym]\n end\n # return the total. Add 50 points if the word uses all the rack\n word.length == rack.join.length ? score + 50 : score\nend",
"def WordScore word\n\tscore = 0\n\tfor char in word.chars\n\t\tscore += char.ord - 64 # A = 65\n\tend\n\treturn score\nend",
"def get_score(word, tile_vals)\n\t\tscore = 0\n\t\tword.each do |w|\n\t\t\tscore+=letter_value(w, tile_vals)\n\t\tend\n\t\treturn score\n\tend",
"def calculate_letter_grade(*scores) # the asterisk allows any number of arguments and puts them in an array\n if scores.length == 0\n return nil\n end\n average = scores.sum / scores.length\n letter_threshholds = {90 => \"A\", 80 => \"B\", 70 => \"C\", 60 => \"D\", 0 => \"F\"}\n letter_threshholds.each do |threshhold, grade|\n if average >= threshhold\n return grade\n end\n end\nend",
"def high(x)\n arr = x.split(\" \")\n alphab = (\"a\"..\"z\").to_a\n scores = []\n \n arr.each do |word|\n score = 0\n word.split(\"\").each do |letter| \n score += (alphab.index(letter) + 1) \n end\n scores.push(score)\n end\n \n puts arr[scores.index(scores.max)]\nend",
"def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word, loser!'\n end\n else\n @answer = 'Sorry, your word is not contained in the letters grid'\n end\n end",
"def hand_score(string)\n cards = { A: 4, K: 3, Q: 2, J: 1 }\n score = 0\n string.each_char do |char|\n score += cards[char.upcase.to_sym]\n end\n\n score\nend",
"def score_word(word)\r\n sum = 0\r\n word.split(//).each {|letter| sum += SCORE[letter] }\r\n sum\r\nend",
"def high(x)\n\n x = ('abcdefghijklmnopqrstuvwxyz')\n\n letterScore = {\n 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8,\n 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16,\n 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24,\n 'y' => 25, 'z' => 26\n\n }\n\n end",
"def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend",
"def alphabet_score(str)\n alpha_chars = ('a'..'z').to_a\n max_score = 0\n max_word = ''\n arr = str.split(' ')\n arr.each do |word|\n word_score = word.chars.map { |char| alpha_chars.index(char) + 1 }.sum\n if word_score > max_score\n max_score = word_score\n max_word = word\n end\n end\n max_word\nend",
"def score_word(word)\n letter_values = word.upcase.split(\"\").map do |letter|\n case letter\n when \"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"\n 1\n when \"D\", \"G\"\n 2\n when \"B\", \"C\", \"M\", \"P\"\n 3\n when \"F\", \"H\", \"V\", \"W\", \"Y\"\n 4\n when \"K\"\n 5\n when \"J\", \"X\"\n 8\n when \"Q\", \"Z\"\n 10\n end\n end\n \n if word.length >= 7 && word.length <= 10\n letter_values << 8\n end\n \n return letter_values.sum\nend",
"def score_word(word)\n\n score = 0\n\n word.upcase.each_char do |letter|\n\n case letter\n when \"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"\n score += 1\n when \"D\", \"G\"\n score += 2\n when \"B\", \"C\", \"M\", \"P\"\n score += 3\n when \"F\", \"H\", \"V\", \"W\", \"Y\"\n score += 4\n when \"K\"\n score += 5\n when \"J\", \"X\"\n score += 8\n when \"Q\", \"Z\"\n score += 10\n end\n\n end\n\n if word.length >= 7\n score += 8\n end\n\n return score\n\nend",
"def score_text(txt)\n txt_length = txt.length.to_f\n total_score = 0\n\n e_ratio = txt.count('e') / txt_length\n t_ratio = txt.count('t') / txt_length\n a_ratio = txt.count('a') / txt_length\n o_ratio = txt.count('o') / txt_length\n i_ratio = txt.count('i') / txt_length\n\n space_ratio = txt.count(' ') / txt_length\n\n total_score += 1 if i_ratio > 0.01 && i_ratio < 0.10\n total_score += 2 if e_ratio > 0.10 && e_ratio < 0.20\n total_score += 2 if t_ratio > 0.08 && t_ratio < 0.26\n total_score += 2 if a_ratio > 0.07 && a_ratio < 0.20\n total_score += 2 if o_ratio > 0.05 && o_ratio < 0.20\n total_score += 4 if space_ratio > 0.1 && space_ratio < 0.4\n\n # capital_ratio = txt.scan(/[ABCDEFGHIOUT]/).count / txt_length\n # total_score += 4 if capital_ratio > 0 && capital_ratio < 0.2\n\n return total_score\nend",
"def scrabble(word)\n\npoints = {\n \t\"a\" => 1,\n \t\"e\" => 1,\n \t\"i\" => 1,\n \t\"o\" => 1,\n \t\"u\" => 1,\n \t\"l\" => 1,\n \t\"n\" => 1,\n \t\"r\" => 1,\n \t\"s\" => 1,\n \t\"t\" => 1,\n \t\"d\" => 2,\n \t\"g\" => 2,\n \t\"b\" => 3,\n \t\"c\" => 3,\n \t\"m\" => 3,\n \t\"p\" => 3,\n \t\"f\" => 4,\n \t\"h\" => 4,\n \t\"v\" => 4,\n \t\"w\" => 4,\n \t\"y\" => 4,\n \t\"k\" => 5,\n \t\"j\" => 8,\n \t\"x\" => 8,\n \t\"q\" => 10,\n \t\"z\" => 10,\n }\n puts word\n\n #create a varialbe to store a Score\n score =0\n #go to letter by letter througth word\n word.each_char do |letter|\n #check in proint for a key that matches letter from word\n #take it's value add it to word\n score += points[letter] #try with puts = points[letter] !access to points\n #output message with the full score result\n\nend\n puts \"#{word} is worth #{score} points\" # TRY TO PUT THIS BEFORE END!!\nend",
"def hand_score(hand)\n\tcards= {\"A\"=>4, \"K\"=>3, \"Q\"=>2, \"J\"=>1}\n \tscore = 0\n \thand.each_char { |char| score += cards[char.upcase] }\n \treturn score\nend",
"def score(word)\n point_values_hash = point_values\n point_values(word)\n end",
"def score\n\t@score = 0\n\tself.to_array.each do |character|\n\t\t@score += TILE_VALUES[character]\n end\n\t@score\n end",
"def scrabble_score(str)\n str = str.upcase.delete(\"^A-Z\")\n return 0 if str.nil? || str.empty?\n str.chars.map{ |chr| $dict[chr] }.reduce(:+)\nend",
"def score_text_two(text)\n txt = text.downcase\n txt_length = txt.length.to_f\n total_score = 0\n\n ALL_LETTERS.each_with_index do |l, i|\n l_freq = (txt.count(l) / txt_length) * 100\n total_score += (l_freq - CHAR_FREQ[i]).abs\n end\n\n space_ratio = txt.scan(/.\\s./).count / txt_length\n total_score += ((space_ratio * 100) - 14.0).abs\n\n return total_score\nend",
"def NameScore( s )\n\talphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ]\n\n\tsum = 0\n\n\tfor i in ( 0 .. s.length-1 )\n\t \tsum += alphabet.index( s[i] )+1\n\tend\n\n\treturn sum\nend",
"def get_grade(scores)\n score_total = 0\n\n scores.each { |x| score_total = x + score_total }\n\n average = score_total / (scores.length)\n\n case\n when average >= 90\n letter = 'A'\n when average >= 80\n letter = 'B'\n when average >= 70\n letter = 'C'\n when average >= 60\n letter = 'D'\n else\n letter = 'F'\n end\n \n return letter\nend",
"def high(sentence)\n alpha_score = (\"a\"..\"z\").zip(1..26).to_h\n arr_sentence = sentence.split\n \n score_array = []\n \n arr_sentence.each do |word|\n score = 0\n word.chars.each do |char|\n score += alpha_score[char]\n end\n score_array << score\n end\n score_of_words = arr_sentence.zip(score_array).to_h\n \n result = score_of_words.max_by {|k,v| v}\n result.first\nend",
"def score\n return @score unless @score.nil?\n\n @score = 0\n letters = @word.chars\n loop{ @score += @path.next * tiles_weights[letters.next] }\n @score\n end",
"def scrabble_score(str)\n str.gsub(/\\W+/, '').upcase.chars.inject(0){|sum,x| sum + $dict[x]}\nend",
"def scoring(answer)\n# everytime someone chooses a certain letter than 1 will be added on to their behind the senses score \n if answer == \"a\"\n @@action += 1\n elsif answer == \"b\"\n @@romance += 1\n elsif answer == \"c\"\n @@horror += 1\n elsif answer == \"d\"\n @@family += 1\n elsif answer == \"e\"\n @@comedy += 1\n else\n return \"nothing\"\n end\n\nend",
"def test_score_a_word_having_multiple_different_tiles\n\t\t\"LEWIS\".each_char { |x| @word.append x.to_sym }\n\t\tassert_equal 8, @word.score\n\tend",
"def score_word(word)\n score = 0\n\n word.upcase.each_char do |char|\n case char\n when \"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"\n score += 1\n when \"D\", \"G\"\n score += 2\n when \"B\", \"C\", \"M\", \"P\"\n score += 3\n when \"F\", \"H\", \"V\", \"W\", \"Y\"\n score += 4\n when \"K\"\n score += 5\n when \"J\", \"X\" \n score += 8\n when \"Q\", \"Z\"\n score += 10\n else \n puts \"Invalid char found.\"\n end\n end\n\n if [7,8,9,10].include? word.length\n score += 8\n end\n\n return score\nend",
"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 scrabble_calc( word )\n\n\tletters = {\n\t\t\"A\" => 1,\n\t\t\"E\" => 1,\n\t\t\"I\" => 1,\n\t\t\"O\" => 1,\n\t\t\"U\" => 1,\n\t\t\"L\" => 1,\n\t\t\"N\" => 1,\n\t\t\"R\" => 1,\n\t\t\"S\" => 1,\n\t\t\"T\" => 1,\n\t\t\"D\" => 2,\n\t\t\"G\" => 2,\n\t\t\"B\" => 3,\n\t\t\"C\" => 3,\n\t\t\"M\" => 3,\n\t\t\"P\" => 3,\n\t\t\"F\" => 4,\n\t\t\"H\" => 4,\n\t\t\"V\" => 4,\n\t\t\"W\" => 4,\n\t\t\"Y\" => 4,\n\t\t\"K\" => 5,\n\t\t\"J\" => 8,\n\t\t\"X\" => 8,\n\t\t\"Q\" => 10,\n\t\t\"Z\" => 10,\n\t}\n\n\tword_total = 0\n\tword.upcase.each_char do |key|\n\t\tword_total += letters[key]\n\tend\n\n\tputs \"The total score for \\\"#{word}\\\" is #{word_total}.\"\n\treturn word_total\nend",
"def score_in_words\n case score*10\n when 0..4 \n \"Sad\"\n when 4..7\n \"Meh\"\n when 7..9\n \"Good\"\n when 9..10\n \"Great\"\n else \"Unknown\"\n end\n end",
"def letter_grade(score)\n output = case score\n when 0...60\n 'F'\n when 60..69\n 'D'\n when 70..79\n 'C'\n when 80..89\n 'B'\n when 90..100\n 'A'\n end\n\n return output\nend",
"def high(string)\n letter_array = (\"a\"..\"z\").to_a\n score_hash = Hash.new(0)\n\n word_array = string.split\n word_array.each do |word|\n word.chars.each do |letter|\n score_hash[word] += letter_array.index(letter) + 1\n end\n end\n max_word_value = score_hash.values.max\n score_hash.key(max_word_value)\nend",
"def guess\n letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]}\n letter = letters.min {|letter1,letter2| letter1 <=> letter2 }\n letter[1]\n end",
"def score\n @score ||= phonetic_levenshtein_distance + penalties\n end",
"def score_convert(n) \n score = 0\n if n.length <= 2 #if the score is in \"A\", \"A+\", \"C-\" form\n case n[0] #to account for the first letter\n when \"A\"\n score = 95\n when \"B\"\n score = 85\n when \"C\"\n score = 75\n when \"D\"\n score = 65\n else\n score = 50\n end\n \n case n[1] #to account for + and -\n when \"+\"\n score += 3\n when \"-\"\n score -=3\n end\n end \n if n.include? \"/\" #if the score is in X/Y form\n score = (frac_to_float(n)*100).to_i\n end\n score\n end",
"def score_words\n @scores = @results.map do |word|\n { :word => word, :score => score_word(word) }\n end.sort { |a, b| a[:score] <=> b[:score] }.reverse\n end",
"def calculate\n avg_scores = ((@scores.inject(0){|sum,x| sum + x }) / @scores.length)\n if avg_scores >= 90 && avg_scores <= 100\n return 'O'\n elsif avg_scores >= 80 && avg_scores < 90\n return 'E'\n elsif avg_scores >= 70 && avg_scores < 80\n return 'A'\n elsif avg_scores >= 55 && avg_scores < 70\n return 'P'\n elsif avg_scores >= 40 && avg_scores < 55\n return 'D'\n elsif avg_scores < 40\n return 'T'\n end\n end",
"def score\n\t@score = 0\n\tself.to_array.each do |character|\n\t\t#could also be @score = @score + TILE_VALUES[character]\n\t\t@score += TILE_VALUES[character]\nend\n@score \nend",
"def getLetScoreArr(scoreHash,nameArray)\n\t#init scored array\n\tscored=[]\n\t#for each name\n\tfor name in nameArray \n\t\t#init/reset temp score to 0\n\t\ttempscore = 0\n\t\t#split name to chars\n\t\tname.split(\"\").each do |i|\n\t\t\t#add score of each char to tempscore\n\t\t\ttempscore += scoreHash[i]+1 \n\t\tend\n\t\t#add this name's tempscore to the scored array\n\t\tscored << tempscore\n\tend\n\t#return scored array\n\treturn scored\nend",
"def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend",
"def score(plaintext)\n score = 0\n @wordlist.each do |word|\n score += plaintext.scan(/\\b#{word}\\b/).count\n end\n return score\nend",
"def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n end",
"def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n end",
"def score(word=@word)\n before = 0\n alph = @alph.dup\n counts = @counts.dup\n\n # For each position in the word find the number of words that are\n # before word being ranked given the prior letters.\n for i in (0...word.size)\n ind = alph.index(word[i])\n prior = 0\n\n # Count possible words starting with earlier letters in the alphabet\n for j in (0...ind)\n # Possible words ignoring letter repeats\n possible = (word.size - i - 1).factorial\n # Remove number of ways to reorganize each letter\n for k in (0...counts.size)\n if j == k\n possible /= (counts[k] - 1).factorial\n else\n possible /= (counts[k]).factorial\n end\n end\n prior += possible\n end\n before += prior\n\n # Adjust the alphabet to remove the consumed letter\n counts[ind] -= 1\n if counts[ind] == 0\n counts.delete_at(ind)\n alph.delete_at(ind)\n end\n end\n\n # Add one to the number of prior words to get the rank\n return before + 1\n end",
"def score_word(word, rank)\n score = 0.0\n last = nil\n index = 0\n\n while index < word.size\n if word[index+1] && layout.include?(word[index] + word[index+1])\n letter = word[index] + word[index+1]\n else\n letter = word[index]\n end\n\n if layout.include?(letter)\n letter_score = 0.0\n\n #score += weight(letter)\n letter_score += weigh(letter, SCORE_BASE)\n letter_score += weigh(letter, SCORE_PRIMARY) if primary?(letter)\n letter_score += weigh(letter, SCORE_POINT) if point?(letter)\n letter_score += weigh(letter, SCORE_NONPOINT) if nonpoint?(letter)\n letter_score += weigh(letter, SCORE_PINKY) if pinky?(letter)\n letter_score += weigh(letter, SCORE_HORIZONTAL) if horizontal?(letter)\n letter_score += weigh(letter, SCORE_VERTICAL) if vertical?(letter)\n letter_score += weigh(letter, SCORE_DOUBLE_TAP) if double_tap?(letter)\n letter_score += weigh(letter, SCORE_CONCOMITANT) if concomitant?(last, letter)\n\n last = letter\n\n # first letters are more significant\n letter_score -= (index * 10)\n\n score += letter_score\n end\n\n index += letter.size\n end\n\n # weight the score by the word ranking\n score = score * rank\n\n score.to_i\n end",
"def score\n @word = params[:word || \"\"].upcase\n @grid = session[:letters]\n start_time = Time.parse(session[:start_time])\n end_time = Time.now\n time_taken = (end_time - start_time).to_f\n\n session[:scores] = @word.size * (60 - time_taken) # how to computed all scores ???\n\n @result = Game.run_game(@word, @grid, time_taken)\n end",
"def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3 \n end",
"def score \n return 'love' if @points == 0 \n return 'fifteen' if @points == 1 \n return 'thirty' if @points == 2 \n return 'forty' if @points == 3\n end",
"def score\n @score ||= (\n total = 0\n words.each do |word, rank|\n total += score_word(word, rank)\n end\n total\n )\n end",
"def score_freq(cs)\n \" eta\".each_char.map { |c| cs.index(c) || 9999 }.reduce(&:+)\nend",
"def get_letter\n\n puts \"What percent did oyu score on your test/assignment?\"\n print \"> \"\n score = gets.chomp.to_i\n\n grades = {\n :F+ (0 ... 49),\n D: (50 ... 59),\n C: (60 ... 69),\n B: (70 ... 79),\n A: (80 ... 100)\n }\n\n grades.each do |grade, percent|\n if percent.to_a.include?(score)\n return grade\n end\n end\nend",
"def letter_percentages(string)\n chars = string.split('')\n\n hash_of_percentages = { lowercase: 0.0, uppercase: 0.0, neither: 0.0}\n hash_of_percentages = calculate_chars(chars, hash_of_percentages)\n\n total_chars = chars.length\n hash_of_percentages = calculate_percentages(hash_of_percentages, total_chars)\n\n return hash_of_percentages\nend",
"def score\n @attempt = params[:word]\n @letters_list = params[:letters]\n @not_in_grid = \"Sorry but #{@attempt} can't be built out of #{@letters_list}\"\n @not_english = \"Sorry but #{@attempt} does not seem to be a valid English word...\"\n @success = \"Congratulation! #{@attempt} is a valid English word!\"\n @result = nil\n\n @word_check = english_word(@attempt)\n\n if grid_include?(@attempt, @letters_list) && @word_check[:found]\n @result = @success\n elsif grid_include?(@attempt, @letters_list) == false\n @result = @not_in_grid\n elsif @word_check[:found] == false\n @result = @not_english\n end\n end",
"def test_score_a_word_with_recurring_tiles\n\t\t\"BOGO\".each_char { |x| @word.append x.to_sym }\n\t\tassert_equal 7, @word.score\n\tend",
"def score(str)\n score = 0.0\n mine = @secret.each_byte.map{ |x| x.to_s(2) }.join\n theirs = str.each_byte.map{ |x| x.to_s(2) }.join\n\n mine.each_byte.zip(theirs.each_byte) do |a,b|\n score += 1 if a == b\n end\n (score / mine.length)\n end",
"def score\n # raise\n # binding.pry\n @lettres = params[:grid]\n @attempt = params[:games]\n if included?(@attempt.upcase, @lettres)\n if english_word?(@attempt)\n @score = compute_score(@attempt)\n @result = [@score, \"Congrats! #{@attempt} is a valid English word\"]\n else\n @result = [0, \"Sorry, but #{@attempt} isn't a valid English word\"]\n end\n else\n @result = [0, \"Sorry, but #{@attempt} can't be build out of #{@lettres}\"]\n end\n end",
"def letter_percentages(string)\n letter_case_count = letter_case_count(string)\n result = {}\n letter_case_count.each do |type, num|\n result[type] = (num / letter_case_count.values.sum.to_f * 100).round(1)\n end\n result\nend",
"def score\n h = @horizontal.reject { |(x,y),r| x==r }\n v = @vertical.reject { |(x,y),r| y==r }\n \n hs = h.map { |position,right|\n x,y = position\n value, mult = (x..right).reduce([0,1]) { |(total, word_multiple),x|\n value = @board.tile_at([x,y]).value\n word_multiplier = 1\n\n if @pending.at(x,y)\n space = @board.at(x,y)\n value *= space.letter_multiplier\n word_multiplier = space.word_multiplier\n end\n [total+value, word_multiple*word_multiplier]\n }\n value*mult\n }\n vs = v.map { |position,bottom|\n x,y = position\n value, mult = (y..bottom).reduce([0,1]) { |(total, word_multiple),y|\n value = @board.tile_at([x,y]).value\n word_multiplier = 1\n\n if @pending.at(x,y)\n space = @board.at(x,y)\n value *= space.letter_multiplier\n word_multiplier = space.word_multiplier\n end\n [total+value, word_multiple*word_multiplier]\n }\n value*mult\n }\n (hs.reduce(:+)||0) + (vs.reduce(:+)||0) \n end",
"def letter_grade(score)\n case score\n when 80..89\n \"B\"\n when 70..79\n \"C\"\n when 90..1000\n \"A\"\n when 60..69\n \"D\"\n when 0..59\n \"F\"\n end\n\nend",
"def calculateWeight word\n letters = word.split\n weight = 0\n hash_alphabet = generateHashWithLetterAndWeight()\n letters.each do |letter|\n (/[[:upper:]]/.match(letter)) ? weight += hash_alphabet[letter.downcase].to_i * 2 : weight += hash_alphabet[letter.downcase].to_i\n end\n weight\n end",
"def total_score\n total_score = 0\n plays.each do |word|\n total_score += Scrabble::Scoring.score(word)\n end\n return total_score\n end",
"def letter_percentages(str)\n hsh = { lowercase: 0, uppercase: 0, neither: 0 }\n\n str.chars.each do |elem|\n if elem =~ /[a-z]/\n hsh[:lowercase] += 1\n elsif elem =~ /[A-Z]/\n hsh[:uppercase] += 1\n else\n hsh[:neither] += 1\n end\n end\n hsh.transform_values! { |v| format('%.1f', v.fdiv(str.length) * 100).to_f }\nend",
"def score_title title, freq_list\n title\n .split\n .map{|word| is_initialism(word) ? 4 : score_for_frequency(freq_list[sanitize word])}\n .inject(:+)\n end",
"def test_single_letter_score\n scrabble = Scrabble.new(\"h\")\n expected_score = scrabble.score()\n assert_equal expected_score,4\n end",
"def scores\n @raw.map(&:score)\n end",
"def letter_percentages(string)\n case_hash = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.each_char do |char|\n case\n when char =~ /[A-Z]/ then case_hash[:uppercase] += 1\n when char =~ /[a-z]/ then case_hash[:lowercase] += 1\n else case_hash[:neither] += 1\n end\n end\n\n characters = string.length.to_f\n case_hash.keys.each do |key|\n case_hash[key] /= characters\n case_hash[key] *= 100\n end\n\n case_hash\nend",
"def average_text(score)\n case score\n when 0\n 'Not yet rated'\n when 1\n 'Not attractive'\n when 2\n 'Respectable'\n when 3\n 'Decent or Attractive'\n when 4\n 'Girlfriend Material'\n else\n 'Supper Hottie'\n end \n end",
"def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end",
"def test_score_working\n assert_equal score(\"abcdef\"), (1 + 3 + 3 + 2 + 1 + 4)\n assert_equal score(\"zebra\"), (10 + 1 + 3 + 1 + 1)\n end",
"def get_grade(test_scores)\n sum = 0.00\n test_scores.each {|score| sum += score}\n avg = sum / test_scores.length\n case avg\n when 90..100\n return \"A\"\n when 80...90\n return \"B\" \n when 70...80\n return \"C\"\n when 60...70\n return \"D\"\n else\n return \"F\"\n end\nend",
"def character_score(character)\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n alphabet.index(character) + 1\nend",
"def euler022\n def find_score(word)\n score = 0\n word.split('').each { |l| score += l[0].ord - 64 } # 64 is the offset to\n # convert uppercase ASCII\n # to alphabetical indices\n score\n end\n\n names = []\n File.open_euler('names.txt').each_line do |line|\n line_names = line.split(',')\n line_names.each { |n| names.push(n.gsub(/[^A-Z]/, '')) }\n end\n names.sort!\n\n score = 0\n names.each_with_index do |name, i|\n position = i+1\n score += find_score(name) * position\n end\n score\nend",
"def letter_percentages(string)\n total_count = string.size\n character_hash = {}\n\n character_hash[:lowercase] = (string.count(\"a-z\").to_f / total_count) * 100\n character_hash[:uppercase] = (string.count(\"A-Z\").to_f / total_count) * 100\n character_hash[:neither] = (string.count(\"^a-zA-Z\").to_f / total_count) * 100\n\n character_hash\nend",
"def final_letter_grades(grade_hash)\n letter_grade averages grade_hash\nend"
] | [
"0.824917",
"0.8168501",
"0.8113238",
"0.80915755",
"0.8042495",
"0.7853455",
"0.78430134",
"0.78368604",
"0.7829441",
"0.7805414",
"0.7702877",
"0.76888996",
"0.7581454",
"0.75517035",
"0.7524041",
"0.75231236",
"0.7522714",
"0.7490279",
"0.7487372",
"0.7485952",
"0.74232775",
"0.74026394",
"0.7381297",
"0.7373901",
"0.7350254",
"0.7344051",
"0.7254162",
"0.72364223",
"0.7233669",
"0.7218485",
"0.7148696",
"0.7141477",
"0.71335685",
"0.71279955",
"0.7127777",
"0.70368046",
"0.7020611",
"0.6999378",
"0.69985944",
"0.698595",
"0.69476616",
"0.6939019",
"0.69386595",
"0.6934617",
"0.6933087",
"0.6931324",
"0.6910955",
"0.69058645",
"0.6892945",
"0.6888695",
"0.6856868",
"0.6833026",
"0.68242025",
"0.68164533",
"0.67918116",
"0.67810965",
"0.67599106",
"0.675735",
"0.67408925",
"0.6734569",
"0.6715891",
"0.6692318",
"0.6687055",
"0.66829616",
"0.6676574",
"0.66762793",
"0.664719",
"0.6645965",
"0.6645965",
"0.6645591",
"0.66431624",
"0.6639409",
"0.66338485",
"0.6614526",
"0.6606098",
"0.6604256",
"0.66021544",
"0.6599655",
"0.6591536",
"0.65858465",
"0.6564575",
"0.6559975",
"0.65596724",
"0.65524364",
"0.6536596",
"0.6498642",
"0.64968175",
"0.64921844",
"0.6490602",
"0.6489455",
"0.6475855",
"0.6461722",
"0.6458806",
"0.64520305",
"0.6442814",
"0.64417917",
"0.6440491",
"0.6435256",
"0.6430192",
"0.6426669"
] | 0.8268655 | 0 |
Create a new good, and return the ActiveRecord | def import_bien b
# Good location
good_address = {}
loc = BienEmplacement.new
loc.pays = "France"
loc.code_postal = b['CodePostal']
loc.ville = b['Ville']
# Category & Transaction type
cat = BienType.find_or_create b['TypeBien'].up_first
transaction_type = BienTransaction.where(:nom => b['TypeTransaction'].up_first).first
return if transaction_type.nil?
# find if good already exist, unless create it
ref = b['Reference']
nb = Bien.where(:reference => ref).select{ |b| b.passerelle.installation == @passerelle.installation }.first
nb = Bien.new if nb.nil?
nb.is_accueil = false
#nb.is_accueil = true if b["TEXTE_MAILING"] && (b["TEXTE_MAILING"].to_s.downcase =~ /.*virtual.*touch.*/)
# update attributes
nb.passerelle = @passerelle
nb.reference = ref
nb.bien_type = cat
nb.bien_transaction = transaction_type
nb.bien_emplacement = loc
nb.nb_piece = b['NbPieces'].to_i
nb.nb_chambre = b['NbChambres'].to_i
nb.surface = b['SurfaceHabitable'].to_i
nb.surface_terrain = b['SurfaceTerrain1'].to_i
nb.titre = b['Titre']
if(nb.titre.nil? || nb.titre.empty?)
nb.titre = b['TypeBien'].up_first
end
if((transaction_type.nom == "Location") && b['ChargesMensuelles'] && (b['ChargesMensuelles'].to_i > 0))
nb.prix_hors_charges = b['Prix']
nb.prix_charges_comprises = b['Prix'].to_i + b['ChargesMensuelles'].to_i
else
nb.prix_charges_comprises = b['Prix']
end
nb.prix = nb.prix_charges_comprises
nb.honoraires_agence = b['Honoraires']
nb.description = b['Texte']
nb.valeur_dpe = b['Dpe_energie']
if(b['Dpe_energie_etiquette'] && !(b['Dpe_energie_etiquette'].empty?))
nb.classe_dpe = b['Dpe_energie_etiquette']
else
nb.classe_dpe = nb.classe_energie
end
nb.valeur_ges = b['Dpe_emission_ges']
if(b['Dpe_emission_ges_etiquette'] && !(b['Dpe_emission_ges_etiquette'].empty?))
nb.class_ges = b['Dpe_emission_ges_etiquette']
else
nb.class_ges = nb.classe_ges
end
nb.statut = 'new'
nb.save!
# If new images : Drop old images, add current images
if b['Photos'] && b['Photos']['Photo']
# un-attach old
nb.bien_photos.each{ |photo|
photo.bien = nil
photo.save!
}
pl = b['Photos']['Photo']
# When there only exists a single image, +pl+ will directly be the hash
pl = [pl] unless pl.kind_of? Array
# Map photo-hashes to medias, filter out failures, and add medias to good
number = 0
pl.map { |p| import_remote_media(p['UrlOriginal'], p['Position'], nb) }
end
nb.save!
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object\n class_name.create_from_database(id)\n end",
"def construct_new_object(db_object)\n end",
"def create(params_or_record)\n object = self.new(params_or_record).save\n return(object)\n end",
"def create(params = {})\n model = new(params)\n model.save\n model\n end",
"def create(attrs = {})\n val = new(attrs)\n R(val, self.database).save\n val\n end",
"def new_record(klass, &block)\n new_records(klass, 1, &block).first\n end",
"def create_from_database(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{id};\").first\n if rec.nil?\n self.new()\n else\n self.new(rec)\n end\n end",
"def create(params = {})\n record = new(params)\n record.save && record\n end",
"def build_new_record\n @record = record_class.new\n end",
"def build_new_record\n @record = record_class.new\n end",
"def do_new\n @record = new_model\n apply_constraints_to_record(@record)\n create_association_with_parent(@record) if nested?\n @record\n end",
"def new_record(params = {})\n @model_class.new(params)\n end",
"def new_record(params = {})\n @model_class.new(params)\n end",
"def create(*args)\n instance = self.new(*args)\n instance.save\n return instance\n end",
"def create(attrs = {})\n record = new(attrs)\n record.save\n record\n end",
"def create!(*args)\n instance = self.new(*args)\n instance.save!\n return instance\n end",
"def create(attributes={}, &block) # TODO: testme\n model = self.new(attributes)\n yield(model) if block_given?\n model.save\n model\n end",
"def create(atts = {})\n rec = self.new(atts)\n rec.save && rec\n end",
"def create_instance\n create_instances(1).first\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def first_or_create(query_attrs = {}, resource_attrs = {})\n conditions(query_attrs)\n klass = Parse::Model.find_class self.table\n if klass.blank?\n raise ArgumentError, \"Parse model with class name #{self.table} is not registered.\"\n end\n hash_constraints = constraints(true)\n klass.first_or_create(hash_constraints, resource_attrs)\n end",
"def create(attrs = {})\n instance = self.new(attrs)\n instance.save\n instance\n end",
"def sneaky_create\n if self.id.nil? && sneaky_connection.prefetch_primary_key?(self.class.table_name)\n self.id = sneaky_connection.next_sequence_value(self.class.sequence_name)\n end\n\n attributes_values = skeaky_attributes_values\n\n # Remove the id field for databases like Postgres which will raise an error on id being NULL\n if self.id.nil? && !sneaky_connection.prefetch_primary_key?(self.class.table_name)\n attributes_values.reject! { |key,_| key.name == 'id' }\n end\n\n new_id = if attributes_values.empty?\n self.class.unscoped.insert sneaky_connection.empty_insert_statement_value\n else\n self.class.unscoped.insert attributes_values\n end\n\n @new_record = false\n !!(self.id ||= new_id)\n end",
"def create(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.id = self.class.rpc_execute('create', vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end",
"def really_new\n return self.new\n end",
"def create input\n table = DB.from(@table) #DB[@table]\n \n result = table.insert input\n\n input[:id] = result\n \n # invalidate a cached range\n @@_cached_range = nil\n \n # return an instance of the model class with the data attributes\n get :id => input[:id]\n end",
"def create!(opts = {})\n instance = new(opts)\n instance.save!\n instance\n end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def create_record!(record)\n @created += 1\n begin\n ar_record = target_class.new(record_attributes(record))\n ar_record.save!\n return ar_record\n rescue ActiveRecord::RecordInvalid => e \n ar_record.save!(:validate => false)\n @invalid_records += 1\n raise e\n end\n end",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def one(model, sql, params={})\n model.new(sql_query(sql, params).first)\n end",
"def create\r\n if self.id.nil? && connection.prefetch_primary_key?(self.class.table_name)\r\n self.id = connection.next_sequence_value(self.class.sequence_name)\r\n end\r\n\r\n quoted_attributes = attributes_with_quotes\r\n\r\n statement = if quoted_attributes.empty?\r\n connection.empty_insert_statement(self.class.table_name)\r\n else\r\n \"INSERT INTO #{self.class.quoted_table_name} \" +\r\n \"(#{quoted_column_names.join(', ')}) \" +\r\n \"VALUES(#{quoted_attributes.values.join(', ')})\"\r\n end\r\n\r\n self.id = connection.insert(statement, \"#{self.class.name} Create\",\r\n self.class.primary_key, self.id, self.class.sequence_name)\r\n\r\n @new_record = false\r\n id\r\n end",
"def create(opts = {})\n instance = new(opts)\n instance.save\n instance\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def create\n check_fields\n sql = \"INSERT INTO #{table} VALUES (NULL,#{to_create_record_str})\"\n Database.transaction(sql)\n sql = \"SELECT id FROM #{table} WHERE #{to_find_id_str}\"\n @id = Database.execute(sql).last[0]\n @log.debug \"Record[#{self}] is added to Table[#{table}]\"\n end",
"def create!(attributes = {})\n object = klass.new(attributes)\n object.save!\n object\n end",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) if model.accessible_attributes && !model.accessible_attributes.include?(attr) || model.protected_attributes && model.protected_attributes.include?(attr)}\n record\n end",
"def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end",
"def create\n # TODO: implement create\n end",
"def create\n self.id = connection.insert(\n \"INSERT INTO #{self.class.table_name} \" +\n \"(#{quoted_column_names.join(', ')}) \" +\n \"VALUES(#{attributes_with_quotes.values.join(', ')})\",\n \"#{self.class.name} Create\",\n self.class.primary_key, self.id\n )\n \n @new_record = false\n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def as_new_record\n instance.stubs(:new_record?).returns(true)\n end",
"def deal_good\n return if good_id\n tmp = Good.where(name: title).first_or_create\n self.good_id = tmp.id unless self.good_id\n save if changed?\n end",
"def create(model={})\n create_new_model(model, :create)\n end",
"def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end",
"def find_or_create!()\n end",
"def create(attributes = {})\n returning(self.new(attributes)) { |res| res.save }\n end",
"def create!(*args, &block)\n @model_class.create!(*args, &block)\n end",
"def new_record(model, *args)\n attributes = valid_attributes_for(model, *args)\n record = model.new(attributes)\n attributes.each {|attr, value| record.send(\"#{attr}=\", value) }\n record\n end",
"def find_or_create_from_activedirectory local_params = {}\n ad_objs = find_activedirectory_objs local_params\n local_objs = []\n\n #Grab all of the objects in one query by GUID for efficiency\n guids = ad_objs.collect { |obj| obj[:objectguid] }\n db_objs_by_guid = {}\n\n #Make a hash map to do quick lookups\n where(:objectguid => guids).each do |db_obj|\n db_objs_by_guid[db_obj.objectguid] = db_obj\n end\n\n ad_objs.each do |ad_obj|\n guid = ad_obj[:objectguid]\n obj = db_objs_by_guid[guid] || new\n obj.copy_from_activedirectory!(:object => ad_obj) if obj.new_record?\n\n local_objs << obj\n end\n\n local_objs\n end",
"def _create(other_id, attrs, force)\n raise 'Cannot call create! on a non-join model' unless @find_method\n join = force ? nil : find(other_id)\n return join if (join && attrs.empty?)\n\n # create! short circuits if a join record already exists, and no\n # attrs are provided. otherwise a new or existing join model is\n # updated with attrs before being saved\n join ||= @target.new\n join.assign_attributes(attrs.merge!({\n \"#{@class_name}_id\" => @id,\n \"#{@other_name}_id\" => other_id\n }))\n join\n end",
"def create(attributes = {})\n record = build(attributes)\n record.save\n record\n end",
"def create(model)\n data = model.attributes\n record = store.create(data, table: table_name)\n model.attributes = record\n end",
"def new\n\t\t# create a new object for the yoyo with no data inside of it,\n\t\t# so that rails can figure out what type of data the yoyo will have\n\t\t@yoyo = Yoyo.new\t# we write `new` here to make the object in memory, but NOT save it into the database\n\t\t\t\t\t\t\t# we're just making an ActiveRecord object for our model,\n\t\t\t\t\t\t\t# NOT saving an object to our database\n\tend",
"def new_model(auto_migrate = true, &block)\n DB.create_table! :foo do\n primary_key :id\n column :state, :string\n end if auto_migrate\n model = Class.new(Sequel::Model(:foo)) do\n self.raise_on_save_failure = false\n def self.name; 'SequelTest::Foo'; end\n end\n model.plugin(:validation_class_methods) if model.respond_to?(:plugin)\n model.plugin(:hook_class_methods) if model.respond_to?(:plugin)\n model.class_eval(&block) if block_given?\n model\n end",
"def create_in_database(instance)\n return unless @strategy.build?(instance)\n @mapping.database_record_type.create!(instance)\n end",
"def create(params = {})\n item = build(params)\n item.save\n item\n end",
"def create(options = {})\n row = self.new(options)\n row.save\n row\n end",
"def create(options = {})\n row = self.new(options)\n row.save\n row\n end",
"def new_record?; end",
"def new_record?; end",
"def create\n \n end",
"def create\n # Submit de new, crea nueva instance en DB.\n end",
"def buildModel(json)\n classname = name.downcase\n\n model = where(\"id\").eq(json[\"id\"]).first\n if model.present?\n if model.wrap(json)\n model.lastSyncAt = Time.now if model.respond_to?(:lastSyncAt)\n return model\n end\n else\n newModel = self.new\n return newModel if newModel.wrap(json)\n end\n\n return nil\n end",
"def create(attributes)\n id = commit(\"create\", attributes)\n record = self.class.new(connection, attributes)\n record.id = id\n record\n end",
"def create_in_database(instance)\n return unless @mapping.strategy.build?(instance)\n\n created = @mapping.database_record_type.create!(instance)\n\n @runner.cache_timestamp instance\n @runner.cache_timestamp created\n rescue ActiveRecord::ActiveRecordError, Faraday::Error::ClientError => e\n DB.logger.error(SynchronizationError.new(e, instance))\n end",
"def find_or_create(owner_class, *args, &block); end",
"def create(attributes = nil)\n object = new(attributes)\n object.save\n object\n end",
"def build(attributes = {})\n params = attributes\n return self.new(params) unless self.request_new_object_on_build?\n\n path = self.build_request_path(params.merge(self.primary_key => 'new'))\n method = self.method_for(:new)\n\n resource = nil\n self.request(params.merge(:_method => method, :_path => path)) do |parsed_data, response|\n if response.success?\n resource = self.new_from_parsed_data(parsed_data)\n end\n end\n resource\n end",
"def create_record attributes\n creator = @creator_class.new attributes, @context\n FactoryGirl.create @clazz.name.underscore.to_sym, creator.factorygirl_attributes\n end",
"def instantiate(record)\n object = record_with_type?(record) ? compute_type(record[inheritance_column]).allocate : allocate\n object.instance_variable_set(\"@attributes\", record)\n return object\n end",
"def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end",
"def create(attributes = { })\n inst = self.new(attributes)\n inst.save\n\n inst\n end",
"def instantiate(name, table)\n Utils.model(name).new(table.hashes.first)\n end",
"def make_and_model; end",
"def create!\n raise NotImplementedError\n end",
"def new_transaction(res)\n transaction = Transaction.new\n transaction.new(res)\n end",
"def druid_db_obj\n @druid_db_obj ||= Druid.find_or_create_by!(druid: druid)\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Customer.new(row)\n return new_instance\n end",
"def to_new_record!\n store_before_to_new_record_values\n reset_persistence_values\n @new_record = true\n end",
"def create\n raise NotImplementedError\n end",
"def create\n raise NotImplementedError\n end",
"def create\n end",
"def create_model(model, sql, params=[])\n model.new(vertex_to_hash(run_sql(sql, params)))\n end",
"def create(extra_parameters = {})\n klass.create(params_without_modifiers(extra_parameters))\n end",
"def new\n @post = Post.new\n\n assert(@post.kind_of?(Post))\n\n return @post\n end",
"def new_model(name = :foo, &block)\n table_name = \"#{name}_#{rand(1000000)}\"\n @table_names ||= []\n @table_names << table_name\n\n model = Class.new do\n (class << self; self; end).class_eval do\n define_method(:name) { \"MongoidTest::#{name.to_s.capitalize}\" }\n define_method(:to_s) { self.name }\n end\n end\n\n model.class_eval do\n include Mongoid::Document\n store_in collection: table_name\n\n field :state, :type => String\n end\n model.class_eval(&block) if block_given?\n model\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Employee.new(row)\n return new_instance\n end",
"def create(attributes = {}, &block)\n new(attributes, &block).tap { |record| record.save }\n end",
"def create\n \t\n end",
"def create(attributes = {})\n resource = repository.scope { model.create(default_attributes.update(attributes)) }\n self << resource unless resource.new_record?\n resource\n end",
"def create data_object_class, opts={}\n data_object = make data_object_class, opts\n data_object.create\n data_object\n end",
"def create_new_empty_record(initial_data=nil) #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].new(initial_data)\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).new(initial_data) # new record\r\n end\r\nend",
"def create_new_empty_record(initial_data = nil) #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].new(initial_data)\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded children by ids\r\n @record = rec.send(@tables.last[1].pluralize).new(initial_data) # new record\r\n end\r\nend",
"def create(attribs={})\n obj = new\n obj.send :create, attribs\n obj\n end",
"def create\n id = dataset.insert(attributes)\n\n if id\n self.id = id\n\n self\n else\n nil\n end\n end"
] | [
"0.6964497",
"0.65887064",
"0.6538817",
"0.64822733",
"0.64737386",
"0.63603663",
"0.6355029",
"0.6294834",
"0.6272341",
"0.6272341",
"0.625979",
"0.6258831",
"0.6258831",
"0.62174654",
"0.6194798",
"0.6132328",
"0.6132287",
"0.6119409",
"0.6116578",
"0.61128473",
"0.6091623",
"0.6087371",
"0.60847473",
"0.6081747",
"0.6056868",
"0.60523343",
"0.6050971",
"0.6048591",
"0.60412323",
"0.6012977",
"0.60127175",
"0.5990089",
"0.5965554",
"0.5961911",
"0.59558004",
"0.5943717",
"0.59342074",
"0.59320986",
"0.59278286",
"0.5916685",
"0.5915143",
"0.5903765",
"0.5900238",
"0.5900238",
"0.5900238",
"0.5900238",
"0.58956176",
"0.5890763",
"0.5887595",
"0.5885954",
"0.5859956",
"0.58546746",
"0.5844685",
"0.5837034",
"0.58310467",
"0.5798224",
"0.5787952",
"0.5779878",
"0.57769114",
"0.5770508",
"0.5766465",
"0.57477576",
"0.5745427",
"0.5745427",
"0.5730031",
"0.5730031",
"0.5723977",
"0.57001376",
"0.56956744",
"0.56935465",
"0.5681434",
"0.56811184",
"0.56776804",
"0.56481564",
"0.56462383",
"0.56293947",
"0.56253374",
"0.5618876",
"0.5618326",
"0.5615846",
"0.56157184",
"0.5614317",
"0.56055915",
"0.56053936",
"0.55953705",
"0.5595339",
"0.5595339",
"0.55761665",
"0.5574162",
"0.55710614",
"0.55672514",
"0.55633867",
"0.555834",
"0.5554729",
"0.5554437",
"0.55450207",
"0.5542794",
"0.55420953",
"0.552788",
"0.552028",
"0.55198795"
] | 0.0 | -1 |
FIXME: use enumerize for delivery_shift | def set_driver
case delivery_shift
when 'M', 'E'
self.driver = User.drivers.find_by(shift: 1)
when 'A'
self.driver = User.drivers.find_by(shift: 2)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_transit_days\n \tresult = []\n \tdelivery_duration.times do |num|\n active_day = num_to_day((day_to_num(self.order_day) + num) % 7)\n \t\tresult << active_day if active_day != self.order_day && active_day != self.delivery_day\n \tend\n \tresult\n end",
"def delivery_day\n \tnum_to_day((day_to_num(self.order_day) + delivery_duration) % 7)\n end",
"def setup_deliveries(order)\n recent_deliveries = order.market.deliveries.recent.active.uniq\n future_deliveries = order.market.deliveries.future.active.uniq\n\n @deliveries = recent_deliveries | future_deliveries | [order.delivery]\n end",
"def delivery\n 50\n end",
"def delivery_days_to\n hash[\"DeliveryDaysTo\"]\n end",
"def find_undelivered_breakfast(delivery_ids)\n unique_delivery_id = 0\n\n delivery_ids.each_with_index do |id|\n unique_delivery_id ^= id\n end\n\n unique_delivery_id\nend",
"def price_by_worker(status, shift_dates_list)\n compteur = 0\n shift_dates_list.each do |wday|\n if wday == 0 || wday == 6\n compteur += 2 * price_by_status(status)\n else\n compteur += price_by_status(status)\n end\n end\n compteur\nend",
"def shift_in\n end",
"def calculate_next_delivery\n interval = @schedulable.repeat_every\n next_delivery_date =\n case\n when @schedulable.company_survey.counter == 0 || @schedulable.time.present?\n set_next_delivery\n when @schedulable.repeat_mode == 'd'\n @schedulable.next_delivery_at + interval.days\n when @schedulable.repeat_mode == 'w'\n @schedulable.next_delivery_at + interval.weeks\n end\n\n @schedulable.update_column(:next_delivery_at, next_delivery_date)\n next_delivery_date\n end",
"def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end",
"def shift; end",
"def shift; end",
"def delivery_action\n return @delivery_action\n end",
"def delivery\n source_node[:delivery]\n end",
"def shifts\n ORTH_SHIFTS\n end",
"def gifts_given_and_received\n return []\n gifts_given + gifts_received\n end",
"def shift\n end",
"def shift\n end",
"def shift\n end",
"def shifts\n @shifts || @shifts = _calculate_shifts\n end",
"def sequential_day\n ActionPlan.sequential_day_for(week,day)\n end",
"def busy_customers(deliveries)\n secs_in_month = 60 * 60 * 24 * 30\n hash = {} # {id: [time difference, # of deliveries]}\n ans = []\n deliveries.each do |id, time|\n if hash[id]\n last_time, delivery_num = hash[id]\n if time - last_time < secs_in_month\n delivery_num += 1\n hash[id][1] = delivery_num\n next\n end\n end\n\n hash[id] = [time, 1]\n end\n\n hash.each do |id, arr|\n ans << id if arr[1] >= 3\n end\n\n ans\nend",
"def get_deliveries\n @deliveries = Hash.new\n @dup_drivers = @drivers.clone\n\n # iterate through the orders\n @orders.each do |order|\n # generate a distance metric for each driver\n @distance = Hash.new\n\n # iterate through the drivers calculating the distance to the order\n @dup_drivers.each do |id, location|\n @distance.merge!Hash[id, (location - order[:origin]).abs]\n puts (\"#{order[:origin]}, #{id}, #{location}, #{(order[:origin] - location).abs}\")\n end\n\n # sort the drivers by distance and start trying to assign orders\n @distance.sort_by{|id, distance| distance}.to_h.each do |id, distance|\n puts(\"SORTED #{id}, #{distance}\")\n # handle a large order\n if order[:size] == \"large\" \n # ignore if the driver is not already busy\n if !@deliveries.key?(id)\n # add the delivery to the hash\n @deliveries.merge!Hash[id, [order]]\n puts (\"Assigning #{id} this order #{order}\")\n\n # this driver is full\n puts (\"REMOVING driver #{id}\")\n @dup_drivers.delete(id)\n\n # order filled\n break\n end\n elsif order[:size] == \"small\"\n # if the driver isn't busy, add the delivery\n if !@deliveries.key?(id)\n @deliveries.merge!Hash[id, [order]]\n puts (\"Assigning #{id} this order #{order}\")\n break\n else # add the order to the end of the delivery list\n puts (\"Assigning #{id} this order #{order}\")\n @deliveries[id].push(order)\n\n # check if the driver is full\n if MAX_ORDERS <= @deliveries[id].length\n puts (\"REMOVING driver #{id}\")\n @dup_drivers.delete(id)\n end\n break\n end\n else\n puts(\"Unrecognized order size #{order[:size]}\")\n end\n end\n end\n\n @deliveries\n end",
"def define_shifts(edge)\n along_iterator, across_iterator = define_shift_iterators(edge)\n shifts = []\n\n shifts << across_iterator.next if edge.add_across_line?(center_out)\n\n (1..edge.notch_count).to_a.each do |count|\n shifts << along_iterator.next\n shifts << across_iterator.next unless count == edge.notch_count\n end\n\n shifts << across_iterator.next if edge.add_across_line?(center_out)\n shifts\n end",
"def shift_out\n end",
"def routing_key; delivery_details[:routing_key]; end",
"def shift() end",
"def shift() end",
"def fetch_qoo10_delivered_orders(smp)\n @message = []\n @all_cart_numbers = []\n fba_complete_states = ['complete', 'customer_complete', 'self_collect_complete', 'collect_complete', 'return_complete']\n market_place = smp.market_place\n #qoo10_statuses = {\"5\"=>\"Delivered\", \"4\"=>\"On delivery\"}\n qoo10_statuses = {\"5\"=>\"Delivered\"}\n for j in 1..10\n begin\n s_date = j.day.ago.strftime(\"%Y%m%d\")\n e_date = (j-1).day.ago.strftime(\"%Y%m%d\")\n qoo10_statuses.keys.each do |k|\n uri = URI(market_place.domain_url+'/ShippingBasicService.api/GetShippingInfo')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>smp.api_secret_key,'ShippingStat'=>k,'search_Sdate'=>s_date,'search_Edate'=>e_date})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n if res.code == \"200\"\n res_body = Hash.from_xml(res.body).to_json\n res_body = JSON.parse(res_body, :symbolize_names=>true)\n begin\n if res_body[:ShippingAPIService][:ResultMsg] == \"Success\"\n for i in 1..res_body[:ShippingAPIService][:TotalOrder].to_i\n order = res_body[:ShippingAPIService][(\"Order\"+i.to_s).to_sym]\n # find out the order\n @order = nil\n @order = Spree::Order.where(\"market_place_order_no=? AND seller_id=?\", order[:orderNo], smp.seller_id).try(:first)\n # check order present or not and order should not be cancelled already\n if @order.present? && !@order.is_cancel?\n # code to delivered the order\n if @order.update_attributes!(:market_place_order_status => \"Delivered\")\n @all_cart_numbers << @order.cart_no if @order.market_place_order_status == \"Delivered\" && (!fba_complete_states.include?@order.fulflmnt_state)\n else\n @message << \"Order not found!\"\n end # End of success status change in SF if\n end # End if order nil\n end # End of for loop\n end # End of success if\n @all_cart_numbers = @all_cart_numbers.uniq\n #Call to FBA to change status\n Spree::Order.update_fba_state(@all_cart_numbers.uniq, smp, \"Completed\") if @all_cart_numbers.present?\n rescue Exception => e\n @message << e.message\n end\n else\n res_body = Hash.from_xml(res.body).to_json\n res_body = JSON.parse(res_body, :symbolize_names=> true)\n @message << res_body[:ShippingAPIService][:ResultMsg]\n end\n end # End of status do\n rescue Exception => e\n @message << e.message\n end\n end # End for loop for day\n return @message.join(\"; \")\n end",
"def delivery_days_from\n hash[\"DeliveryDaysFrom\"]\n end",
"def get_undelivered_order_ids\n\n #enable this one for previous restricted conditioned(pause/resume)\n #orders =self.orders.select('id, delivery_date').where('spree_orders.delivery_date > ?', Time.now).limit(3)\n orders = self.orders.select('id, delivery_date').where('spree_orders.state in (?) ', ['confirm', 'placed']).limit(3)\n\n order_ids = {}\n\n orders.each_with_index do |order, index|\n order_ids.merge!(index => order.id)\n end\n\n order_ids\n end",
"def dismissed_players_for(delivery)\n return '' unless delivery.key?('wicket')\n dismissals_for(delivery).map { |dismissal| dismissal['player_out'] }.join(', ')\nend",
"def change_delivery_time\n # get user info for confirmation email\n @customer = User.find_by_id(current_user.id)\n \n # get user's subscription\n @user_subscription = UserSubscription.where(account_id: current_user.account_id, currently_active: true).first\n \n # get current delivery address\n @current_delivery_address = UserAddress.where(account_id: current_user.account_id, current_delivery_location: true)[0]\n \n # get data\n @data = params[:format]\n @data_split = @data.split(\"-\")\n # first get correct address and delivery zone\n @address = @data_split[0].to_i\n #Rails.logger.debug(\"address: #{@address.inspect}\")\n @delivery_zone = @data_split[1].to_i\n \n # get delivery zone info for confirmation email\n @user_delivery_zone = DeliveryZone.find_by_id(@delivery_zone)\n \n if @user_subscription.subscription.deliveries_included != 0\n @delivery_date = @data_split[2]\n @date_adjustment = @delivery_date.split(\"_\") \n @final_delivery_date = \"20\" + @date_adjustment[2] + \"-\" + @date_adjustment[0] + \"-\" + @date_adjustment[1] + \" 13:00:00\"\n #Rails.logger.debug(\"date: #{@final_delivery_date.inspect}\")\n @final_delivery_date = DateTime.parse(@final_delivery_date)\n #Rails.logger.debug(\"Parsed date: #{@final_delivery_date.inspect}\")\n \n # set curator email for notification\n @admin_email = \"carl@drinkknird.com\"\n \n # get user's delivery info\n @all_upcoming_deliveries = Delivery.where(account_id: current_user.account_id).where.not(status: \"delivered\")\n # get next planned delivery\n @next_delivery = @all_upcoming_deliveries.order(\"delivery_date ASC\").first\n #Rails.logger.debug(\"first delivery date: #{@first_delivery.inspect}\")\n # get second planned delivery \n @second_delivery = @all_upcoming_deliveries.order(\"delivery_date ASC\").second\n \n # update the Account info\n Account.update(current_user.account_id, delivery_location_user_address_id: @address, delivery_zone_id: @delivery_zone)\n \n if @current_delivery_address.id == @address # address is not changing, just update the delivery time/zone\n # update the current delivery time/zone\n @current_delivery_address.update_attribute(:delivery_zone_id, @delivery_zone)\n # get new user delivery address info for confirmation email\n @new_delivery_address = @current_delivery_address\n @location_and_time_change = false\n else # both address and delivery time/zone need to be updated\n # update current delivery address\n @current_delivery_address.update_attributes(current_delivery_location: false)\n # get the new delivery address & update it\n UserAddress.update(@address, current_delivery_location: true, delivery_zone_id: @delivery_zone)\n # get new user delivery address info for confirmation email\n @new_delivery_address = UserAddress.find_by_id(@address)\n @location_and_time_change = true\n end\n \n # capture original delivery date for confirmation email before updating record\n @old_date = @next_delivery.delivery_date\n \n # set next view\n @next_view = user_delivery_settings_location_path\n \n # update delivery dates\n @next_delivery.update_attribute(:delivery_date, @final_delivery_date)\n @second_delivery_date = @final_delivery_date + 2.weeks\n @second_delivery.update_attribute(:delivery_date, @second_delivery_date)\n \n # send confirmation email to customer with admin bcc'd\n UserMailer.delivery_zone_change_confirmation(@customer, @location_and_time_change, @old_date, @final_delivery_date, @new_delivery_address, @user_delivery_zone).deliver_now\n AdminMailer.delivery_zone_change_notice(@customer, @admin_email, @location_and_time_change, @old_date, @final_delivery_date, @new_delivery_address, @user_delivery_zone).deliver_now\n else\n # update the Account info\n Account.update(current_user.account_id, delivery_location_user_address_id: @address, delivery_zone_id: @delivery_zone)\n # update current delivery address\n @current_delivery_address.update_attributes(current_delivery_location: false)\n # get the new delivery address & update it\n UserAddress.update(@address, current_delivery_location: true, delivery_zone_id: @delivery_zone)\n \n # get new user delivery address info for confirmation email\n @location_and_time_change = false\n @old_date = \"none\"\n @final_delivery_date = \"none\"\n # get new user delivery address info for confirmation email\n @new_delivery_address = UserAddress.find_by_id(@address)\n \n \n # send confirmation email to customer with admin bcc'd\n UserMailer.delivery_zone_change_confirmation(@customer, @location_and_time_change, @old_date, @final_delivery_date, @new_delivery_address, @user_delivery_zone).deliver_now\n \n # set next view\n @next_view = user_delivery_settings_location_path\n \n end\n \n # redirect back to next logical view, depending if this is a person starting a new plan\n redirect_to @next_view\n \n end",
"def dismissals_for(delivery)\n delivery['wicket'].is_a?(Array) ? delivery['wicket'] : [delivery['wicket']]\nend",
"def number(bus_stops)\n number_passengers = 0\n\n bus_stops.each do |stop|\n number_passengers += stop[0]\n number_passengers -= stop[1]\n end\n number_passengers\nend",
"def gifts_given_and_received\n gifts_given + gifts_received\n end",
"def find_undelivered_breakfast(delivery_ids)\n hash = {}\n\n delivery_ids.each_with_index do |i, index|\n hash[i] = index\n end\n\n hash[1]\nend",
"def generate_delivery_instructions(coordinate_array)\n # set start to the origin and instructions to empty before we begin\n instructions = \"\"\n start_point = [0, 0]\n\n # generate directions from current point to next\n coordinate_array.each do |x|\n north_south = x[0] - start_point[0]\n east_west = x[1] - start_point[1]\n\n if north_south > 0\n instructions += \"N\" * north_south\n elsif north_south <= 0\n instructions += \"S\" * (north_south * -1)\n end\n\n if east_west > 0\n instructions += \"E\" * east_west\n elsif east_west <= 0\n instructions += \"W\" * (east_west * -1)\n end\n\n # drop a pizza each time you reach a delivery point\n instructions += \"D\"\n\n # set the start point to the delivery point you've just reached\n start_point = x\n end\n\n # let user know we couldn't find any valid delivery points\n if coordinate_array == []\n instructions = \"There were no valid delivery points found in the input!\"\n end\n\n @logger.info \"Delivery instructions are: #{instructions}\"\n instructions\n end",
"def shift(count=1)\n\t self.class[to_a.shift(count)]\n\tend",
"def archweek(w)\n #for each day of the week\n for day in w.days\n \n #for each slotA of day\n for slot in day.slotAs\n #archive\n archive(slot)\n end\n \n #for each slotB of day\n for slot in day.slotBs\n #archive\n archive(slot)\n end\n \n #for each slotC of day\n for slot in day.slotCs\n #archive\n archive(slot)\n end\n \n #for each slotD of day\n for slot in day.slotDs\n #archive\n archive(slot)\n end\n \n #archive day\n archive(day)\n end\n #archive week\n archive(w)\nend",
"def test_0610_cycle\n @@log.debug \"test_0610_cycle starts\" if @@log.debug?\n assert_respond_to(@list, :cycle, \"test_0610_cycle_respond\")\n # Type check\n enum = @list.cycle\n result = enum.is_a? Enumerator\n assert(result,\"test_0610_cycle_class\") \n # One cycle\n assert_equal([@aen, @bsb, @cab, @dad], @list.cycle(1).to_a, \"test_0610_cycle_once\")\n # Two cycles\n assert_equal([@aen, @bsb, @cab, @dad, @aen, @bsb, @cab, @dad], \n @list.cycle(2).to_a, \"test_0610_cycle_twice\") \n @@log.debug \"test_0610_cycle ends\" if @@log.debug?\n end",
"def using_shift(arr)\n arr.shift\nend",
"def scheduled_delivery\n if date = scheduled_delivery_date\n year = date[0..3].to_i\n month = date[4..5].to_i\n day = date[6..7].to_i\n if time = scheduled_delivery_time\n hour = time[0..1].to_i\n minute = time[2..3].to_i\n second = time[4..5].to_i\n Time.utc(year, month, day, hour, minute, second)\n else\n Time.utc(year, month, day, 12, 0, 0)\n end\n end\n end",
"def processOrder\n \n end",
"def move(arr, letter)\nresult = []\narr.each{|a|\nlist = get_transition(a, letter)\nif list != nil\nresult = result | list\nend\n}\nresult\nend",
"def [](name)\n delivery_methods[name.to_sym]\n end",
"def shifttimes\n if @shifttimes.nil?\n\tsetshifttimes\n end\n @shifttimes\n end",
"def delivery_details; message[:delivery_details]; end",
"def get_actions(current_player_ix=@current_ix)\n player = @players[current_player_ix]\n free_types = ($goods - @ships.map {|s| s[:type]})\n actions = @ships.each_with_index.flat_map do |ship,ship_ix|\n if ship[:type] == :none\n types = free_types.select {|g| player.has g}\n types.map do |g|\n {:type => g,\n :ship => ship_ix,\n :player => current_player_ix,\n :amount => [player[g], ship[:capacity]].min}\n end\n elsif ship[:load] < ship[:capacity] && (player.has ship[:type])\n [{:type => ship[:type],\n :ship => ship_ix,\n :player => current_player_ix,\n :amount => [player[ship[:type]], ship[:capacity]-ship[:load]].min}]\n else\n []\n end\n end\n if player[:wharfs] > 0\n wharf_actions = $goods.select {|g| player.has g}.map do |g|\n {:type => g,\n :ship => :wharfs,\n :player => current_player_ix,\n :amount => player[g]}\n end\n actions = wharf_actions + actions\n end\n actions\n end",
"def add_package_to_subscriber_delivery\n # get params\n @package_id = params[:id]\n @customer_drink_quantity = params[:quantity].to_i\n\n # get package info\n @special_package = SpecialPackage.find_by_id(@package_id)\n \n # get delivery info\n @next_delivery = Delivery.where(account_id: current_user.account_id, status: [\"user review\", \"admin prep next\", \"admin prep\"]).order(delivery_date: :asc).first\n \n # now check if this inventory item already exists in the Order Drink Prep table\n @current_drink_order = AccountDelivery.where(user_id: current_user.account_id,\n order_prep_id: @next_delivery.id,\n special_package_id: @package_id)\n \n #Rails.logger.debug(\"Next Delivery Drink Check: #{@customer_drink_order.inspect}\")\n if !@customer_drink_order.blank? #update entry\n if @customer_drink_quantity != 0\n @special_package.decrement!(:quantity, @current_drink_order[0].quantity)\n @current_drink_order.update(quantity: @customer_drink_quantity)\n @special_package.increment!(:quantity, @customer_drink_quantity)\n else\n @special_package.decrement!(:quantity, @current_drink_order[0].quantity)\n @current_drink_order[0].destroy!\n \n # get related User Delivery info\n @related_user_delivery = UserDelivery.find_by_account_delivery_id(@customer_drink_order.id)\n end\n #Rails.logger.debug(\"Found this drink\")\n # put inventory back before updating based on current quantity chosen\n @inventory.increment!(:stock, @customer_drink_order.quantity)\n @inventory.decrement!(:reserved, @customer_drink_order.quantity)\n \n \n \n # make adjustments to both delivery and inventory info\n if @customer_drink_quantity != 0\n \n # update delivery info\n @customer_drink_order.update(quantity: @customer_drink_quantity)\n @related_user_delivery.update(quantity: @customer_drink_quantity, user_addition: true)\n @next_delivery.update(has_customer_additions: true)\n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n else\n # remove related delivery items\n @customer_drink_order.destroy!\n @related_user_delivery.destroy!\n # already put inventory back, so no need to do more with inventory\n end\n else # create new Account and User delivery entries and adjust Inventory\n #Rails.logger.debug(\"Did not find this drink\")\n # get cellarable info\n @cellar = @inventory.beer.beer_type.cellarable\n if @cellar.nil?\n @cellar = false\n end\n # get size format info\n if @inventory.size_format_id == 5 || @inventory.size_format_id == 12 || @inventory.size_format_id == 14\n @large_format = true\n else\n @large_format = false\n end\n # adjust drink price to wholesale if user is admin\n if current_user.role_id == 1\n if !@inventory.sale_case_cost.nil?\n @wholesale_cost = (@inventory.sale_case_cost / @inventory.min_quantity)\n else\n @wholesale_cost = (@inventory.regular_case_cost / @inventory.min_quantity)\n end\n @stripe_fees = (@wholesale_cost * 0.029)\n @drink_price = (@wholesale_cost + @stripe_fees)\n else\n # get correct price of drink based on user's address\n @drink_price = UserAddress.user_drink_price_based_on_address(current_user.account_id, @inventory.id)\n end\n #Rails.logger.debug(\"Drink Price: #{@drink_price.inspect}\")\n # create new Account Delivery table entry\n @account_delivery = AccountDelivery.create(account_id: current_user.account_id, \n beer_id: @inventory.beer_id,\n quantity: @customer_drink_quantity,\n cellar: @cellar,\n large_format: @large_format,\n delivery_id: @next_delivery.id,\n drink_price: @drink_price,\n times_rated: 0,\n size_format_id: @inventory.size_format_id,\n inventory_id: @inventory.id)\n if @account_delivery.save!\n # create new User Delivery entry\n UserDelivery.create(user_id: current_user.id,\n account_delivery_id: @account_delivery.id,\n delivery_id: @next_delivery.id,\n quantity: @customer_drink_quantity,\n projected_rating: @project_rating_info.projected_rating,\n drink_category: @inventory.drink_category)\n \n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n end\n end\n\n # update Delivery totals\n # get all drinks in the Account Delivery Table\n @account_delivery_drinks = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id)\n @subtotal = @account_delivery_drinks.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n if @subtotal > 35\n @delivery_fee = 0\n else\n @delivery_fee = 5\n end\n @grand_total = @total_drink_price + @delivery_fee\n \n # update price info in Delivery table and set change confirmation to false so user gets notice\n @next_delivery.update(subtotal: @subtotal, sales_tax: @sales_tax, \n total_drink_price: @total_drink_price,\n delivery_fee: @delivery_fee,\n grand_total: @grand_total)\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end",
"def shift(shift)\n check_pre((\n (shift.int?)\n ))\n\n day = self\n\n for n in 1 .. shift.abs\n if shift.int_pos?\n day = day.succ\n else\n day = day.pred\n end\n end\n\n return day\n end",
"def shift(shift)\n check_pre((\n (shift.int?)\n ))\n\n day = self\n\n for n in 1 .. shift.abs\n if shift.int_pos?\n day = day.succ\n else\n day = day.pred\n end\n end\n\n return day\n end",
"def redelivered; @message_impl.getRedelivered; end",
"def schedule\n unless (@schedule)\n schedule = []\n emails = @emails\n emails << 'n/a' if @emails.size.odd?\n\n top_row = emails[0...(emails.size/2)]\n (0...top_row.size).each do |shifts|\n weekly_pairs = []\n second_row = emails[(emails.size/2)...emails.size]\n\n shifts.times {second_row << second_row.shift}\n top_row.each_with_index do |top_row_email, index|\n weekly_pairs << [top_row_email, second_row[index]]\n end\n\n schedule << weekly_pairs\n end\n\n @schedule = schedule\n\n end\n\n @schedule\n end",
"def determine_state(order)\n return 'pending' if self.inventory_units.any? { |unit| unit.backordered? }\n return 'shipped' if state == 'shipped'\n return 'delivered' if state == 'delivered'\n # Original, that resulted in emails being delivered several times:\n # order.payment_state == 'balance_due' ? 'pending' : 'ready'\n # Updated version that should prevent that from happening:\n order.payment_state == 'balance_due' ? 'pending' : 'ready'\n \n end",
"def order_arrive_to(order)\n m = Setting::get('Order arrive before')\n if m == ''\n m = 55\n else\n m = m.to_i\n end\n order.updated_at + 55.minutes\n end",
"def add_stock_to_subscriber_delivery\n # get params\n @source_info = params[:id]\n @source_info_split = @source_info.split(\"-\")\n @page = @source_info_split[0]\n @related_id = @source_info_split[1]\n @customer_drink_quantity = params[:quantity].to_i\n \n # get delivery info\n @next_delivery = Delivery.where(account_id: current_user.account_id, status: [\"user review\", \"admin prep next\", \"admin prep\"]).order(delivery_date: :asc).first\n \n # get related info\n if @page == \"stock\"\n # get projected rating info\n @project_rating_info = ProjectedRating.find_by_id(@related_id)\n # get inventory info\n @inventory = Inventory.find_by_id(@project_rating_info.inventory_id)\n #Rails.logger.debug(\"Inventory: #{@inventory.inspect}\")\n # now check if this inventory item already exists in the Account Delivery table\n # get drink info\n @customer_drink_order = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id,\n inventory_id: @inventory.id).first\n else\n # get drink info\n @customer_drink_order = AccountDelivery.find_by_id(@related_id)\n # get inventory info\n @inventory = Inventory.find_by_id(@customer_drink_order.inventory_id)\n #Rails.logger.debug(\"Inventory: #{@inventory.inspect}\")\n # get projected rating info\n @project_rating_info = ProjectedRating.where(user_id: current_user.id, inventory_id: @inventory.id).first\n end\n #Rails.logger.debug(\"Next Delivery Drink Check: #{@customer_drink_order.inspect}\")\n if !@customer_drink_order.blank? #update entry\n #Rails.logger.debug(\"Found this drink\")\n # put inventory back before updating based on current quantity chosen\n @inventory.increment!(:stock, @customer_drink_order.quantity)\n @inventory.decrement!(:reserved, @customer_drink_order.quantity)\n \n # get related User Delivery info\n @related_user_delivery = UserDelivery.find_by_account_delivery_id(@customer_drink_order.id)\n \n # make adjustments to both delivery and inventory info\n if @customer_drink_quantity != 0\n \n # update delivery info\n @customer_drink_order.update(quantity: @customer_drink_quantity)\n @related_user_delivery.update(quantity: @customer_drink_quantity, user_addition: true)\n @next_delivery.update(has_customer_additions: true)\n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n else\n # remove related delivery items\n @customer_drink_order.destroy!\n @related_user_delivery.destroy!\n # already put inventory back, so no need to do more with inventory\n end\n else # create new Account and User delivery entries and adjust Inventory\n #Rails.logger.debug(\"Did not find this drink\")\n # get cellarable info\n @cellar = @inventory.beer.beer_type.cellarable\n if @cellar.nil?\n @cellar = false\n end\n # get size format info\n if @inventory.size_format_id == 5 || @inventory.size_format_id == 12 || @inventory.size_format_id == 14\n @large_format = true\n else\n @large_format = false\n end\n # adjust drink price to wholesale if user is admin\n if current_user.role_id == 1\n if !@inventory.sale_case_cost.nil?\n @wholesale_cost = (@inventory.sale_case_cost / @inventory.min_quantity)\n else\n @wholesale_cost = (@inventory.regular_case_cost / @inventory.min_quantity)\n end\n @stripe_fees = (@wholesale_cost * 0.029)\n @drink_price = (@wholesale_cost + @stripe_fees)\n else\n # get correct price of drink based on user's address\n @drink_price = UserAddress.user_drink_price_based_on_address(current_user.account_id, @inventory.id)\n end\n #Rails.logger.debug(\"Drink Price: #{@drink_price.inspect}\")\n # create new Account Delivery table entry\n @account_delivery = AccountDelivery.create(account_id: current_user.account_id, \n beer_id: @inventory.beer_id,\n quantity: @customer_drink_quantity,\n cellar: @cellar,\n large_format: @large_format,\n delivery_id: @next_delivery.id,\n drink_price: @drink_price,\n times_rated: 0,\n size_format_id: @inventory.size_format_id,\n inventory_id: @inventory.id)\n if @account_delivery.save!\n # create new User Delivery entry\n UserDelivery.create(user_id: current_user.id,\n account_delivery_id: @account_delivery.id,\n delivery_id: @next_delivery.id,\n quantity: @customer_drink_quantity,\n projected_rating: @project_rating_info.projected_rating,\n drink_category: @inventory.drink_category)\n \n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n end\n end\n\n # update Delivery totals\n # get all drinks in the Account Delivery Table\n @account_delivery_drinks = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id)\n @subtotal = @account_delivery_drinks.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n if @subtotal > 35\n @delivery_fee = 0\n else\n @delivery_fee = 5\n end\n @grand_total = @total_drink_price + @delivery_fee\n \n # update price info in Delivery table and set change confirmation to false so user gets notice\n @next_delivery.update(subtotal: @subtotal, sales_tax: @sales_tax, \n total_drink_price: @total_drink_price,\n delivery_fee: @delivery_fee,\n grand_total: @grand_total)\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end",
"def backtrack(stack)\n item = super(stack)\n size = item[:booking]\n @bookings.push(size)\n @all_moves[@last_index_tried] += size\n item\n end",
"def position\n purchase.deliveries\n .valid\n .order(scheduled_for: :asc)\n .find_index(self)\n end",
"def consume(delivery_info, properties, payload)\n #data = @transport.get_message(rmsg)\n #payload is a string\n env = @serializer.deserialize payload\n puts 'oeuaoeusatoehuntsaoheuntsahoeusnth'\n puts env\n deliver(env)\n end",
"def shipped\n OrderNotified.shipped\n end",
"def process_delivery_date_change\n @requested_delivery_date = params[:id]\n @new_delivery_date = DateTime.parse(@requested_delivery_date)\n #Rails.logger.debug(\"Date chosen: #{@new_delivery_date.inspect}\")\n \n # get user info\n @customer = User.find_by_id(current_user.id)\n \n # get user's delivery info\n @all_upcoming_deliveries = Delivery.where(account_id: current_user.account_id).where.not(status: \"delivered\")\n @first_delivery = @all_upcoming_deliveries.order(\"delivery_date ASC\").first\n #Rails.logger.debug(\"first delivery date: #{@first_delivery.inspect}\")\n @second_delivery = @all_upcoming_deliveries.order(\"delivery_date ASC\").second\n #Rails.logger.debug(\"second delivery date: #{@second_delivery.inspect}\")\n \n # create new date time for delivery start and end times\n @original_delivery_start = @first_delivery.delivery_start_time\n @new_delivery_start = DateTime.new(@new_delivery_date.year, \n @new_delivery_date.month, \n @new_delivery_date.day, \n @original_delivery_start.hour, \n @original_delivery_start.min)\n @new_delivery_end = @new_delivery_start + 4.hours\n # send a confirmation email about the change\n UserMailer.delivery_date_change_confirmation(@customer, @first_delivery.delivery_date, @new_delivery_date).deliver_now\n\n # send Admin an email about delivery date change \n AdminMailer.delivery_date_change_notice('carl@drinkknird.com', @customer, @first_delivery.delivery_date, @new_delivery_date).deliver_now\n \n # get and destroy drinks from account delivery table\n @account_delivery_drinks = AccountDelivery.where(delivery_id: @first_delivery.id)\n if !@account_delivery_drinks.blank?\n # adjust inventory accordingly\n @account_delivery_drinks.each do |drink|\n @inventory_transaction = InventoryTransaction.find_by_account_delivery_id(drink.id)\n @inventory = Inventory.find_by_id(@inventory_transaction.inventory_id)\n @inventory.increment!(:stock, @inventory_transaction.quantity)\n @inventory.decrement!(:reserved, @inventory_transaction.quantity)\n end\n # now destroy all related account delivery rows\n @account_delivery_drinks.destroy_all\n \n # get and destroy User Deliveries\n @user_delivery_drinks = UserDelivery.where(delivery_id: @first_delivery.id)\n if !@user_delivery_drinks.blank?\n @user_delivery_drinks.destroy_all\n end\n \n end\n \n # now update delivery date and status\n @next_delivery = Delivery.find_by_id(@first_delivery.id)\n @next_delivery.update(delivery_date: @new_delivery_date, \n subtotal: 0, \n sales_tax: 0, \n total_drink_price: 0,\n status: \"admin prep next\",\n share_admin_prep_with_user: false,\n delivery_start_time: @new_delivery_start,\n delivery_end_time: @new_delivery_end)\n if !@second_delivery.blank?\n @account = Account.find_by_id(current_user.account_id)\n @delivery_frequency = @account.delivery_frequency\n @second_delivery_date = @new_delivery_date + @delivery_frequency.weeks\n @second_delivery_start = DateTime.new(@second_delivery_date.year, \n @second_delivery_date.month, \n @second_delivery_date.day, \n @original_delivery_start.hour, \n @original_delivery_start.min)\n @second_delivery_end = @second_delivery_start + 4.hours\n @second_delivery.update(delivery_date: @second_delivery_date,\n delivery_start_time: @second_delivery_start,\n delivery_end_time: @second_delivery_end)\n end\n \n redirect_to change_delivery_date_path\n \n end",
"def distribute_production_result\n return nil if self.is_confirmed == false \n \n ok_quantity = self.ok_quantity\n repairable_quantity = self.repairable_quantity\n broken_quantity = self.broken_quantity \n \n sales_item_subcription = self.sales_item_subcription\n \n if sales_item_subcription.pending_production_sales_items.count == 0 \n raise ActiveRecord::Rollback, \"Call tech support!\" \n return\n end\n \n \n total_pending = sales_item_subcription.pending_production ## aggregate over all shite \n \n sales_item_subcription.pending_production_sales_items.each do |sales_item| \n assigned_ok_quantity = 0\n assigned_repairable_quantity = 0 \n assigned_broken_quantity = 0 \n \n # if there is nothing else to distribute, just break. \n # stop the shit. and move on \n if ok_quantity == 0 and repairable_quantity == 0 and broken_quantity == 0 \n break \n end\n \n if sales_item.pending_production >= ok_quantity and ok_quantity != 0 \n assigned_ok_quantity = ok_quantity \n ok_quantity = 0 \n else\n assigned_ok_quantity = sales_item.pending_production \n ok_quantity = ok_quantity - sales_item.pending_production \n end\n \n # the post production order is assigned only once in the beginning\n if repairable_quantity != 0 \n assigned_repairable_quantity = repairable_quantity\n repairable_quantity = 0 \n end\n \n if broken_quantity != 0 \n assigned_broken_quantity = broken_quantity\n broken_quantity = 0 \n end\n \n ProductionHistory.create_history( sales_item_subcription, self, sales_item , {\n :ok_quantity => assigned_ok_quantity, \n :repairable_quantity => assigned_repairable_quantity, \n :broken_quantity => assigned_broken_quantity \n }) \n end\n end",
"def shipped\n OrderNotifer.shipped\n end",
"def get_shift(i)\n i%BITS_PER_ITEM\n end",
"def project_phase_deliverables\n project_phase_deliverables = []\n stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n\n custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n project_phase_deliverables\n end",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def using_shift(array)\n array.shift\nend",
"def get_biweek()\n a = []\n week_days = DAYS.map { |day| day[:day] }\n @schedule.each_with_index do |row, i|\n row = row.compact.map { |a| a.upcase }\n if row.all? { |word| week_days.include?(word) } && row != []\n a.push(i + 1)\n end\n end\n return a\nend",
"def using_shift (array)\n return array.shift\nend",
"def shift_time_array\n time_shift = Time.now.in_time_zone(self.time_zone).utc_offset\n time_shift = (time_shift/3600).round\n\n if self.week_preferred != \"allday\"\n self.week_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.week_array.sort!\n end\n\n if self.weekend_preferred != \"allday\"\n self.weekend_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.weekend_array.sort!\n end\n end",
"def dismissal_methods_for(delivery)\n return '' unless delivery.key?('wicket')\n dismissals_for(delivery).map { |dismissal| dismissal['kind'] }.join(', ')\nend",
"def using_shift(array)\n array.shift\nend",
"def next_delivery_date\n self.release_dates.first.delivery_date\n end",
"def all_deliverables\n deliverables = self.deliverables.order(\"name ASC\")\n result = []\n deliverables.each do |deliverable|\n if deliverable.has_sub_item == true \n result << [ \"#{deliverable.name} -- SubItem: #{deliverable.sub_item_name} \"+\n \"-- Default SubItem Quantity: #{deliverable.sub_item_quantity} \"+\n \"-- Additional Extra SubItem Price: #{deliverable.independent_sub_item_price}\" , \n deliverable.id ]\n else\n result << [ \"#{deliverable.name}\" , \n deliverable.id ]\n end\n \n end\n return result\n end",
"def test_0050_shift_method\n @@log.debug \"test_0050_shift_method starts\" if @@log.debug?\n assert_equal(@aen, @list.shift)\n assert_equal(@bsb, @list.shift)\n assert_equal(@cab, @list.shift)\n assert_equal(@dad, @list.shift)\n assert_nil(@list.shift)\n @@log.debug \"test_0050_shift_method ends\" if @@log.debug?\n end",
"def actions_for(state)\n actions = []\n\n state.free_cells.each_with_index do |free_cell, i|\n next if free_cell.nil?\n m = FreeToFoundationMove.new(state, free_cell, i)\n actions << m if m.valid?\n end\n\n # last card in column moves\n state.columns.each_with_index do |column, i|\n card = column.last\n next if card.nil?\n\n m1 = ColumnToFoundationMove.new(state, card, i)\n actions << m1 if m1.valid?\n\n m2 = ColumnToFreeMove.new(state, card, i)\n actions << m2 if m2.valid?\n end\n\n\n # column to column -- for each end card in each column...\n state.columns.each_with_index do |column, i|\n card = column.last\n idx = [i, column.index(card)]\n next if card.nil? # no need to try moving a blank...\n\n opts = { :state => state.clone, :card => card, :card_index => idx }\n state.columns.each_with_index do |target_col, j|\n next if i == j\n\n opts[:target_idx] = j\n m = ColumnToColumnMove.new(opts)\n actions << m if m.valid?\n end\n end\n\n # free to column\n opts = {:state => state}\n state.free_cells.each_with_index do |free_cell, i|\n next if free_cell.nil?\n opts.merge!({:card => free_cell, :card_index => i})\n state.columns.each_with_index do |target_col, target_idx|\n opts[:target_idx] = target_idx\n m = FreeToColumnMove.new(opts)\n actions << m if m.valid?\n end\n end\n\n actions\n end",
"def delivered_products\n @delivered_products ||= begin\n products = order['OrderDetails']['OrderRows']\n products.each do |ol|\n if ol['OrderRowId'].to_s == line_id.to_s\n ol['QuantityToDeliver'] = quantity\n ol['PackageId'] = track_and_trace_reference\n end\n\n if ol['ProductId'] == 'Postage'\n ol['QuantityToDeliver'] = 1\n ol['PackageId'] = track_and_trace_reference\n end\n end\n products.collect do |pr|\n pr.slice 'OrderRowId', 'QuantityToDeliver', 'PackageId'\n end\n end\n end",
"def test_pick_up_from_stop\n @bus_stop = BusStop.new(\"Elm Row\", queue = [])\n @bus_stop.add_person_to_queue(@passenger1)\n @bus.pick_up_from_stop(@bus_stop)\n assert_equal(1, @bus.count_passengers())\n assert_equal(0, @bus_stop.count_queuers())\nend",
"def shipped\n \n end",
"def stock\n\n inventory = case presentation_unit_type_measurement.name\n when PresentationUnitTypeMeasurement::SUPERFICIAL\n inventory_for_superficie_presentation_unit_type_measurement\n when PresentationUnitTypeMeasurement::LOGITUDINAL\n inventory_for_longitudinal_presentation_unit_type_measurement\n else\n #TODO LOGGER\n 0\n end\n\n \n\n invoiced = case presentation_unit_type_measurement.name\n when PresentationUnitTypeMeasurement::SUPERFICIAL\n invoiced_for_superficie_presentation_unit_type_measurement\n when PresentationUnitTypeMeasurement::LOGITUDINAL\n invoiced_for_longitudinal_presentation_unit_type_measurement\n else\n #TODO LOGGER\n 0\n end\n\n inventory - invoiced\n end",
"def calculated_status\n if deliveries.any? {|delivery| delivery.status == \"not_sent\" }\n \"not_sent\"\n elsif deliveries.any? {|delivery| delivery.status == \"unknown\" }\n \"unknown\"\n elsif deliveries.any? {|delivery| delivery.status == \"hard_bounce\" }\n \"hard_bounce\"\n elsif deliveries.any? {|delivery| delivery.status == \"soft_bounce\" }\n \"soft_bounce\"\n elsif deliveries.all? {|delivery| delivery.status == \"delivered\" }\n \"delivered\"\n else\n raise \"Unexpected situation\"\n end\n end",
"def jimOrders(orders)\n n = orders.size\n serve_times = []\n orders.each do |i|\n serve_time = i[0] + i[1]\n serve_times << serve_time\n end\n customer_num = {}\n n.times do |i|\n customer_num[i+1] = serve_times[i]\n end\n turns = []\n customer_num.sort_by { |_, v| v }.to_h.each_key do |k|\n turns << k\n end\n return turns\nend",
"def ship_deployer(board)\n ship_deploy = [1,2]\n until ship_deploy == []\n sel2 = board.sample\n sel1 = sel2.sample\n if (sel2.index sel1) < 5\n count = 1\n 5.times do\n x = (board.index sel2).to_i\n y = ((sel2.index sel1).to_i + count)\n board[x][y] = ship_deploy[0]\n count += 1\n end\n ship_deploy.slice!(0)\n end\n end\nend",
"def create\n @order = current_order\n @delivery = Delivery.new(delivery_params)\n @delivery.order_id = @order.id\n @delivery.user_id = current_user.id\n @addresses = current_user.addresses\n @cards = current_user.cards\n \n respond_to do |format|\n if @delivery.save\n @order.order_items.each do |order_item|\n ordered_item = OrderedItem.new\n ordered_item.sale_item = SaleItem.find(order_item.sale_item_id)\n ordered_item.sale_item_id = order_item.sale_item_id\n ordered_item.delivery_id = @delivery.id\n ordered_item.quantity = order_item.quantity\n User.find(SaleItem.find(order_item.sale_item_id).user_id).ordered_items << ordered_item\n a = SaleItem.find(order_item.sale_item_id)\n a.amount -= order_item.quantity\n a.save\n end\n @order = Order.new\n session[:order_id] = @order.id\n current_order = @order\n format.html { redirect_to profile_url, notice: 'Order was successfully placed.' }\n format.json { render :show, status: :created, location: profile_url }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_weekend_activities\n i=0\n while i < 10\n item = {name: weekend_activities[i][:title], value: i+1.to_i} \n \n @processed_weekend << item\n \n i += 1 \n end \n \n end",
"def sequential_day\n puts \"AI.sequential_day = #{action_plan.sequential_day} + #{day-1}\"\n action_plan.sequential_day + day-1\n end",
"def coming_order\n NameCardOrderMailer.coming_order\n end",
"def assign_types\n @schedule[0].cost = :travel\n @schedule.each_cons(3) do |days|\n days[1].cost =\n if days[0].date + 1 == days[1].date && days[1].date+ 1 == days[2].date\n :full\n else\n :travel\n end\n end\n @schedule[-1].cost = :travel\n end",
"def leave_for_delivery(slot_number)\n @parcel.delivery(slot_number)\nend",
"def change_delivery_drink_quantity\n # get data to add/update\n @data = params[:id]\n @data_split = @data.split(\"-\")\n @add_or_subtract = @data_split[0]\n @user_delivery_id = @data_split[1]\n \n # get User Delivery info\n @account = Account.find_by_id(current_user.account_id)\n @user_subscription = UserSubscriptionn.where(account_id: current_user.account_id, currently_active: true).first\n @user_delivery_info = UserDelivery.find_by_id(@user_delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n @inventory = Inventory.find_by_id(@user_delivery_info.inventory_id)\n \n # adjust drink quantity, price and inventory\n @original_quantity = @user_delivery_info.quantity\n @drink_price = @user_delivery_info.inventory. + @user_subscription.pricing_model\n @current_inventory_reserved = @inventory.reserved\n if @add_or_subtract == \"add\"\n # set new quantity\n @new_quantity = @original_quantity + 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal + @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved + 1\n @inventory.update(reserved: @new_inventory_reserved)\n\n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n \n else\n # set new quantity\n @new_quantity = @original_quantity - 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal - @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved - 1\n @inventory.update(reserved: @new_inventory_reserved)\n \n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n end\n \n # update delivery info and note a confirmation email should be sent\n @delivery.update(subtotal: @new_subtotal, sales_tax: @new_sales_tax, total_drink_price: @new_total_price, delivery_change_confirmation: false)\n \n # add change to the customer_delivery_changes table\n @customer_delivery_change = CustomerDeliveryChange.where(user_delivery_id: @user_delivery_id).first\n if !@customer_delivery_change.blank?\n @customer_delivery_change.update(new_quantity: @new_quantity, change_noted: false)\n else\n @new_customer_delivery_change = CustomerDeliveryChange.new(user_id: current_user.id, \n delivery_id: @user_delivery_info.delivery_id,\n user_delivery_id: @user_delivery_id,\n beer_id: @user_delivery_info.beer_id,\n original_quantity: @original_quantity,\n new_quantity: @new_quantity,\n change_noted: false)\n @new_customer_delivery_change.save!\n end\n \n # set new delivery details and delivery info\n @next_delivery = UserDelivery.where(delivery_id: @user_delivery_info.delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n \n # count number of drinks in delivery\n @drink_count = @next_delivery.sum(:quantity)\n # count number of drinks that are new to user\n @next_delivery_cooler = 0\n @next_delivery_cellar = 0\n @next_delivery_small = 0\n @next_delivery_large = 0\n # cycle through next delivery drinks to get delivery counts\n @next_delivery.each do |drink|\n @quantity = drink.quantity\n if drink.cellar == true\n @next_delivery_cellar += (1 * @quantity)\n else\n @next_delivery_cooler += (1 * @quantity)\n end\n if drink.large_format == true\n @next_delivery_large += (1 * @quantity)\n else\n @next_delivery_small += (1 * @quantity)\n end\n end \n \n respond_to do |format|\n format.js\n end # end of redirect to jquery\n end"
] | [
"0.62125605",
"0.61787987",
"0.5518633",
"0.5471163",
"0.541295",
"0.53769916",
"0.5300807",
"0.5230528",
"0.51849806",
"0.5166091",
"0.5156801",
"0.5156801",
"0.51422685",
"0.51058495",
"0.5087933",
"0.506233",
"0.50599974",
"0.50599974",
"0.50599974",
"0.50506246",
"0.5050081",
"0.50388235",
"0.5033208",
"0.5023074",
"0.50210637",
"0.5005136",
"0.49533838",
"0.49533838",
"0.4944924",
"0.4933469",
"0.4932619",
"0.4923153",
"0.49207923",
"0.4919441",
"0.49036458",
"0.48976278",
"0.48850974",
"0.48529917",
"0.48434964",
"0.4841086",
"0.48331437",
"0.48326477",
"0.48244667",
"0.48098776",
"0.4802069",
"0.48001197",
"0.47963285",
"0.4793377",
"0.47844273",
"0.47800964",
"0.4770706",
"0.4770706",
"0.47638866",
"0.4752869",
"0.47413358",
"0.47385132",
"0.47291106",
"0.47155696",
"0.47054392",
"0.46988705",
"0.46981663",
"0.469497",
"0.46900868",
"0.46850386",
"0.46833083",
"0.4679592",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46779722",
"0.46699733",
"0.46617523",
"0.4658248",
"0.4653359",
"0.4651186",
"0.46454543",
"0.4645274",
"0.46400183",
"0.46382082",
"0.46359384",
"0.4628108",
"0.46280834",
"0.46274894",
"0.46217206",
"0.46215945",
"0.46196046",
"0.46193692",
"0.46128368",
"0.46121153",
"0.4607371",
"0.46073225",
"0.45977253",
"0.45958108"
] | 0.0 | -1 |
Create a Scalyr log endpoint Create a Scalyr for a particular service and version. | def create_log_scalyr(opts = {})
data, _status_code, _headers = create_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.create_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.create_log_scalyr\",\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: LoggingScalyrApi#create_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.create_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.create_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.create_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.create_log_loggly\",\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: LoggingLogglyApi#create_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.create_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogshuttleApi.create_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.create_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.create_log_logshuttle\",\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: LoggingLogshuttleApi#create_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end",
"def create_log_https(opts = {})\n data, _status_code, _headers = create_log_https_with_http_info(opts)\n data\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n scheme = config[:use_ssl] ? \"https\" : \"http\"\n @service_url = \"#{scheme}://#{SERVICE_HOST}#{SERVICE_PATH}\"\n end",
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.update_log_scalyr\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#update_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n host = SERVICE_HOSTS[config[:region]] || SERVICE_HOSTS[:uk]\n @service_url = \"http://#{host}:#{SERVICE_PORT}#{SERVICE_PATH}\"\n end",
"def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def create_log(param); end",
"def initialize(config, register, rpc_service)\n @register = register\n @rpc_service = rpc_service\n @config = config\n\n @server_address = \"0.0.0.0:#{config.data.dig('languageService','port')}\"\n @rpc_service.add_http2_port(@server_address, :this_port_is_insecure)\n @rpc_service.handle(self)\n @logger = Logger.new(config.data.dig('languageService','logger', 'file'))\n @logger.level = Logger::Severity.const_get(config.data.dig('languageService','logger', 'level'))\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def vertx_start\n @consul_client.request(:PUT, \"/v1/agent/service/register\") { |response|\n if response.status_code() == 200\n puts \"Registered foo service with Consul\"\n else \n puts \"Failed to register foo service with Consul\"\n end\n }.end({\n \"ID\" => \"foo_service\",\n \"Name\" => \"foo\",\n \"Tags\" => [\n \"service\"\n ],\n \"Port\" => SERVICE_PORT\n }.to_json)\nend",
"def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end",
"def generate_service_name\n service_module = ret_service_module\n assembly_name = request_params(:assembly_name)\n\n if version = request_params(:version)\n version = nil if BASE_VERSION_STRING.include?(version)\n else\n version = compute_latest_version(service_module)\n end\n\n assembly_template = service_module.assembly_template(assembly_name: assembly_name, version: version)\n rest_ok_response generate_new_service_name(assembly_template, service_module)\n end",
"def format_service\n\n end",
"def initialize(hostname, port=4119, logger, log_level)\n @hostname = hostname\n @port = port\n super(\"https://#{hostname}:#{port}/webservice/Manager?WSDL\",\n logger,\n log_level,\n {:convert_request_keys_to => :none, # or one of [:lower_camelcase, :upcase, :none]\n :ssl_verify_mode => :none})\n\n end",
"def hatt_add_service(name, url_or_svc_cfg_hash)\n svc_cfg = case url_or_svc_cfg_hash\n when String\n { 'url' => url_or_svc_cfg_hash }\n when Hash\n url_or_svc_cfg_hash\n else\n raise ArgumentError, \"'#{url_or_svc_cfg_hash}' is not a url string nor hash with url key\"\n end\n\n init_config\n services_config = hatt_configuration['hatt_services']\n services_config[name] = svc_cfg\n @hatt_configuration.tcfg_set 'hatt_services', services_config\n\n @hatt_http_clients ||= {}\n @hatt_http_clients[name] = Hatt::HTTP.new hatt_configuration['hatt_services'][name]\n define_singleton_method name.intern do\n @hatt_http_clients[name]\n end\n end",
"def setup(endpoint, format = \"json\")\n case endpoint\n when :path_info\n @service_path = \"/ping/?format=#{format}\"\n when :path_data\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\"\n when :ping\n @service_path = \"/ping/?format=#{format}\"\n when :whoami\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\" \n end\n end",
"def start_service\n create_certificate\n\n DRb.start_service 'drbssl://:0', nil, ssl_config\n end",
"def update_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.update_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.update_log_logshuttle\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#update_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.create_service ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"vcl\", \"wasm\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service'\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/x-www-form-urlencoded'])\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 form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.create_service\",\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: ServiceApi#create_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if(!@priority.blank?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end",
"def create\n req = VCAP::Services::Api::ServiceOfferingRequest.decode(request_body)\n logger.debug(\"Create service request: #{req.extract.inspect}\")\n\n # Should we worry about a race here?\n\n success = nil\n svc = Service.find_by_label(req.label)\n if svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n attrs = req.extract.dup\n attrs.delete(:label)\n # Keep DB in sync with configs if the token changes in the config\n attrs[:token] = @service_auth_token if svc.is_builtin?\n svc.update_attributes!(attrs)\n else\n # Service doesn't exist yet. This can only happen for builtin services since service providers must\n # register with us to get a token.\n svc = Service.new(req.extract)\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.is_builtin? && svc.verify_auth_token(@service_auth_token)\n svc.token = @service_auth_token\n svc.save!\n end\n\n render :json => {}\n end",
"def initialize(api, endpoint, namespace, version)\n if self.class() == AdsCommon::SavonService\n raise NoMethodError, 'Tried to instantiate an abstract class'\n end\n @api, @version, @namespace = api, version, namespace\n @headerhandler = []\n @client = create_savon_client(endpoint, namespace)\n end",
"def create_logging_client\n require \"google/cloud/logging\"\n\n Google::Cloud::Logging.new\nend",
"def create_sslcert\n converge_by(\"Create Cert #{new_resource}\") do\n Chef::Log.info \"Create #{new_resource}\"\n\n update_sslcert\n\n new_resource.updated_by_last_action(true)\n end\n end",
"def create\n\t\t#sanity checks\n\t\tif params[:'licserver-tags'].empty? || params[:'licserver-location'].empty? then\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\n\t\tmatch_data = /(?<port_id>\\d*)@(?<server_id>[\\w.-]+)/.match( params[:'licserver-location'])\n\n\t\t#start creating\n\t\tlicserver = Licserver.new( :port => match_data[:port_id], :server => match_data[:server_id])\n\n\t\tif licserver.save! then\n\t\t\t#update licserver features\n\t\t\tlicserver.update_features\n\n\t\t\t#add the proper tags\n\t\t\tparams[:'licserver-tags'].split.each{ |x| Tag.new(:title => x.downcase, :licserver_id => licserver.id ).save! }\n\t\t\trender :nothing => true, :status => :ok\n\t\t\treturn\n\t\telse\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\tend",
"def initialize\n @logger = Logger.new('cf_flattener.log')\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_version=(service_version)\n self.resource = OpenTelemetry::SDK::Resources::Resource.create(\n OpenTelemetry::SemanticConventions::Resource::SERVICE_VERSION => service_version\n )\n end",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def create_logfile\n LibLog.create_logfile(ClientConfig::LOGGING,\n ClientConfig::LOG_LOCATION,\n ClientConfig::LOG_FILENAME)\n end",
"def get_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.get_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.get_log_scalyr\",\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: LoggingScalyrApi#get_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def create_log_heroku_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHerokuApi.create_log_heroku ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHerokuApi.create_log_heroku\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHerokuApi.create_log_heroku\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/heroku'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHerokuResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHerokuApi.create_log_heroku\",\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: LoggingHerokuApi#create_log_heroku\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end",
"def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end",
"def create\n super(@@service)\n end",
"def initialize\n @app_id = \"05a059c9-c309-46af-9b86-b06d42510550\"\n @cert_file = File.join(File.dirname(__FILE__),\"certs/helloWorld.pem\")\n @cert_pass = \"\"\n @shell_url = \"https://account.healthvault-ppe.com\"\n @hv_url = \"https://platform.healthvault-ppe.com/platform/wildcat.ashx\"\n @logger = Logger.new(\"hv.log\")\n end",
"def new\n @service = Service.new\n end",
"def endpoint(environment, version, service)\n environment = environment.upcase.to_sym\n version = version.to_sym\n service = service.to_sym\n base = get_wsdl_base(environment, version)\n if !subdir_config().nil?\n base = base.to_s + subdir_config()[[version, service]].to_s\n end\n return base.to_s + version.to_s + '/'\n end",
"def service_log status: :processed, message:\n colors_list = { failure: :red, success: :green, info: :cyan, warning: :yellow }\n\n log_header = ActiveSupport::LogSubscriber.new.send(:color, \"[SERVICE #{status.to_s.upcase}]\", colors_list[status])\n service_logger.warn \"#{log_header} #{message}\"\n end",
"def call_create_lbvserver(ipaddress=\"0.0.0.0\", args = {})\n print \"adding lb vserver...\"\n @lbvserver_name = \"vs-#{@servicename}-usa-qa-wh\"\n # hard coded for testing\n ipaddress = \"10.126.255.53\"\n # hard coded for testing\n port = \"80\"\n # hard coded for testing\n http_or_ssl = \"HTTP\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n @request.body = { :lbvserver => { :name => \"#{@lbvserver_name}\", :servicetype => \"#{http_or_ssl}\", :ipv46 => \"#{ipaddress}\", :port => \"#{port}\", :persistencetype => \"COOKIEINSERT\", :timeout => \"15\", :lbmethod => \"LRTM\", :cltTimeout => \"1800\", :appflowlog => \"DISABLED\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n @status_hash[:lbvserver] = \"@lbvserver_name\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n end",
"def create_url_template(rest_method)\n ServiceCatalographer::Util.generate_rest_endpoint_url_template(rest_method)\n end",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end",
"def add\n $stderr.puts \" ! `turbot ssl:add` has been deprecated. Please use the SSL Endpoint add-on and the `turbot certs` commands instead.\"\n $stderr.puts \" ! SSL Endpoint documentation is available at: https://devcenter.turbot.com/articles/ssl-endpoint\"\n end",
"def create_handler(curve_name, io)\n CurveHandler::AttachService.new(\n config_for(curve_name),\n io,\n scenario,\n metadata_parameters\n )\n end",
"def create\n @web_service_log = WebServiceLog.new(params[:web_service_log])\n\n respond_to do |format|\n if @web_service_log.save\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully created.' }\n format.json { render json: @web_service_log, status: :created, location: @web_service_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def log(service, level, summary, details: nil, host: nil, payload: {}, valid_for_secs: nil)\n service ||= @service\n if not service\n raise 'log: service must be passed, or set previously with set_service'\n end\n host ||= get_hostname\n post_body = {\n 'service' => service,\n 'datetime' => get_datetime(),\n 'host' => host,\n 'level' => level,\n 'summary' => summary,\n 'details' => details,\n 'payload' => payload,\n 'valid_for_secs' => valid_for_secs\n }\n \n url = \"https://#{@server_hostname}/api/log\"\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n vlog(0, \"url is #{url} host #{uri.host} port #{uri.port}\")\n http.use_ssl = true\n http.read_timeout = 20\n\n request = Net::HTTP::Post.new(url)\n request.content_type = \"application/json\" \n request.body = post_body.to_json\n\n vlog(0, \"request.body #{request.body}\")\n\n begin\n response = http.request(request)\n\n if response.code != '200'\n $stderr.puts \"POST to #{url} failed with status code #{response.code} and response #{response.body}\"\n return\n end\n rescue StandardError => error\n $stderr.puts \"POST to #{url} failed: #{error}\"\n end\n end",
"def initialize (service_name, application_context)\n super\n end",
"def initialize(endpoint, logger = Logger.new(STDOUT))\n @endpoint = endpoint\n @logger = logger\n logger.debug(\"init with endpoint: #{endpoint}\")\n end",
"def create\n @service_version = ServiceVersion.new(params[:service_version])\n\n respond_to do |format|\n if @service_version.save\n flash[:notice] = 'Service version was successfully created.'\n format.html { redirect_to(@service_version) }\n format.xml { render :xml => @service_version, :status => :created, :location => @service_version }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_log_kafka_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingKafkaApi.create_log_kafka ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingKafkaApi.create_log_kafka\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingKafkaApi.create_log_kafka\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"gzip\", \"snappy\", \"lz4\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 0, -1]\n if @api_client.config.client_side_validation && opts[:'required_acks'] && !allowable_values.include?(opts[:'required_acks'])\n fail ArgumentError, \"invalid value for \\\"required_acks\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"plain\", \"scram-sha-256\", \"scram-sha-512\"]\n if @api_client.config.client_side_validation && opts[:'auth_method'] && !allowable_values.include?(opts[:'auth_method'])\n fail ArgumentError, \"invalid value for \\\"auth_method\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/kafka'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['topic'] = opts[:'topic'] if !opts[:'topic'].nil?\n form_params['brokers'] = opts[:'brokers'] if !opts[:'brokers'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['required_acks'] = opts[:'required_acks'] if !opts[:'required_acks'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['parse_log_keyvals'] = opts[:'parse_log_keyvals'] if !opts[:'parse_log_keyvals'].nil?\n form_params['auth_method'] = opts[:'auth_method'] if !opts[:'auth_method'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['password'] = opts[:'password'] if !opts[:'password'].nil?\n form_params['use_tls'] = opts[:'use_tls'] if !opts[:'use_tls'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingKafkaResponsePost'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingKafkaApi.create_log_kafka\",\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: LoggingKafkaApi#create_log_kafka\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def newMicroServiceType(name,abbr,style,opmode,min=1,max=1)\n\nend",
"def call\n # Update service and update context\n self.service = Entities::Service.find_by_system_name(remote: threescale_client,\n system_name: service_system_name)\n if service.nil?\n # Create service and update context\n self.service = Entities::Service.create(remote: threescale_client,\n service_params: service_settings)\n logger.info \"Created service id: #{service.id}, name: #{service_name}\"\n else\n service.update(service_settings)\n logger.info \"Updated service id: #{service.id}, name: #{service_name}\"\n end\n\n report['id'] = service.id\n report['system_name'] = service.system_name\n report['name'] = service.name\n report['backend_version'] = api_spec.service_backend_version\n end",
"def create_log_ftp_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingFtpApi.create_log_ftp ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingFtpApi.create_log_ftp\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingFtpApi.create_log_ftp\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"classic\", \"loggly\", \"logplex\", \"blank\"]\n if @api_client.config.client_side_validation && opts[:'message_type'] && !allowable_values.include?(opts[:'message_type'])\n fail ArgumentError, \"invalid value for \\\"message_type\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"zstd\", \"snappy\", \"gzip\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/ftp'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['timestamp_format'] = opts[:'timestamp_format'] if !opts[:'timestamp_format'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['period'] = opts[:'period'] if !opts[:'period'].nil?\n form_params['gzip_level'] = opts[:'gzip_level'] if !opts[:'gzip_level'].nil?\n form_params['address'] = opts[:'address'] if !opts[:'address'].nil?\n form_params['hostname'] = opts[:'hostname'] if !opts[:'hostname'].nil?\n form_params['ipv4'] = opts[:'ipv4'] if !opts[:'ipv4'].nil?\n form_params['password'] = opts[:'password'] if !opts[:'password'].nil?\n form_params['path'] = opts[:'path'] if !opts[:'path'].nil?\n form_params['public_key'] = opts[:'public_key'] if !opts[:'public_key'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['port'] = opts[:'port'] if !opts[:'port'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingFtpResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingFtpApi.create_log_ftp\",\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: LoggingFtpApi#create_log_ftp\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_version\n Milkrun.say \"Creating new version of app in HockeyApp\"\n\n body = {}.tap do |json|\n json[:bundle_version] = version_code\n json[:bundle_short_version] = version_name\n json[:status] = 1\n end\n\n headers = {}.tap do |h|\n h[\"X-HockeyAppToken\"] = token\n h[\"Accept\"] = \"application/json\"\n h[\"Content-Type\"] = \"application/json\"\n end\n\n url = \"#{base_url}/#{app_id}/app_versions/new\"\n response = Excon.post(url, body: body.to_json, connect_timeout: 10, headers: headers)\n if response.status != 201\n Milkrun.error response.data.to_s\n raise \"Failed to post new version to HockeyApp!\"\n end\n\n Milkrun.say \"New version created in HockeyApp\"\n end",
"def create\n @lsrs_framework = LsrsFramework.new(params[:lsrs_framework])\n\n respond_to do |format|\n if @lsrs_framework.save\n flash[:notice] = 'LsrsFramework was successfully created.'\n format.html { redirect_to(@lsrs_framework) }\n format.xml { render :xml => @lsrs_framework, :status => :created, :location => @lsrs_framework }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lsrs_framework.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_tls_sub_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TlsSubscriptionsApi.create_tls_sub ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/tls/subscriptions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].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/vnd.api+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/vnd.api+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(opts[:'tls_subscription'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'TlsSubscriptionResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"TlsSubscriptionsApi.create_tls_sub\",\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: TlsSubscriptionsApi#create_tls_sub\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def logger log_name, resource, labels = {}\n Logger.new self, log_name, resource, labels\n end",
"def create\n @webhook_endpoint = WebhookEndpoint.new(webhook_endpoint_params)\n\n respond_to do |format|\n if @webhook_endpoint.save\n format.html { redirect_to @webhook_endpoint, notice: 'Webhook endpoint was successfully created.' }\n format.json { render :show, status: :created, location: @webhook_endpoint }\n else\n format.html { render :new }\n format.json { render json: @webhook_endpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(service_name = T.unsafe(nil), environment = T.unsafe(nil), options = T.unsafe(nil)); end",
"def log_create(p_args)\n Logging::create_log(p_args)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/logging/v2/logging_config_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @config_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Logging::V2::ConfigServiceV2::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def create_service_files(current_resource, new_resource)\n service_name = get_service_name(new_resource)\n\n template_variables = ({\n \"dashboard_name\" => get_dashboard_name(new_resource),\n \"dashboard_path\" => new_resource.path,\n \"dashboard_port\" => new_resource.port,\n \"service_name\" => service_name,\n \"ruby_version\" => node[\"dashing\"][\"ruby_version\"]\n })\n\n # If the resource's service_type is changing, then delete the old script.\n if get_service_script_name(current_resource) != nil\n file get_service_script_name(current_resource) do\n action :delete\n only_if {current_resource.service_type != new_resource.service_type}\n end\n end\n\n # Create the new startup script.\n case new_resource.service_type\n when \"upstart\"\n template \"/etc/init/#{service_name}.conf\" do\n cookbook \"dashing\"\n source \"upstart-dashboard.conf.erb\"\n mode 0644\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n when \"init.d\"\n template \"/etc/init.d/#{service_name}\" do\n cookbook \"dashing\"\n source node['dashing']['init_source']\n mode 0755\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n else\n raise \"dashing: Unknown service_type '#{rnew_resource.service_type}'\"\n end\nend",
"def add_certificate(http); end",
"def create!(params={})\n raise ArgumentError, \"Error: product, component, summary, version are required args\" unless check_params([:product, :component, :summary, :version], params)\n rpc_call :create, params\n end",
"def create_resource(description, opts, resource_uri = nil)\n warn \"Attempt to create sliver directly - #{description}\"\n raise OMF::SFA::AM::Rest::NotAuthorizedException.new(\"Slivers can only be created in the context of /slices/xxx/slivers\")\n end",
"def create_log_gcp_pubsub_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingPubsubApi.create_log_gcp_pubsub ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingPubsubApi.create_log_gcp_pubsub\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingPubsubApi.create_log_gcp_pubsub\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/pubsub'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['secret_key'] = opts[:'secret_key'] if !opts[:'secret_key'].nil?\n form_params['account_name'] = opts[:'account_name'] if !opts[:'account_name'].nil?\n form_params['topic'] = opts[:'topic'] if !opts[:'topic'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingGooglePubsubResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingPubsubApi.create_log_gcp_pubsub\",\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: LoggingPubsubApi#create_log_gcp_pubsub\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def subscription_service_create_with_http_info(space_id, create_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionService.subscription_service_create ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling SubscriptionService.subscription_service_create\" if space_id.nil?\n # verify the required parameter 'create_request' is set\n fail ArgumentError, \"Missing the required parameter 'create_request' when calling SubscriptionService.subscription_service_create\" if create_request.nil?\n # resource path\n local_var_path = \"/subscription/create\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(create_request)\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 => 'SubscriptionVersion')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionService#subscription_service_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create!\n document_roots = ServerTools::Configuration.get(\"apache\",\"documentroots\")\n logs = join_and_expand_path(document_roots, @name, \"logs\")\n available_site = join_and_expand_path(ServerTools::Configuration.get(\"apache\",\"available_sites\"), @name)\n\n put_option(:document_root, join_and_expand_path(document_roots, @name, \"htdocs\"))\n put_option(:error_log, join_and_expand_path(logs, \"error.log\"))\n put_option(:custom_log, \"#{join_and_expand_path(logs,\"access.log\")} combined\")\n \n ServerTools::Logger.message(\"Create VirtualHost \\\"#{@name}\\\"\")\n ServerTools::Logger.message(\"Document root: #{@options[:document_root]}\")\n ServerTools::Logger.message(\"Logs: #{logs}\")\n ServerTools::Logger.message(\"Configuration: #{available_site}\")\n \n if File.exists?(available_site)\n ServerTools::Logger.error(\"Configuration does already exist!\")\n exit\n end\n if Dir.exists?(@options[:document_root])\n ServerTools::Logger.error(\"Document root does already exist!\")\n exit\n end\n \n FileUtils.mkpath(@options[:document_root])\n FileUtils.mkpath(logs)\n \n File.open(available_site, \"w\") do |f|\n f.puts %Q{\\#\n\\# #{@name} (#{available_site})\n\\#\n<VirtualHost *>\n\\tServerName\\t#{@name}\n#{parse_options(@options)}\n#{htaccess_configuration(@options)}\n</VirtualHost>\n }\n end\n \n end",
"def create_trail(trail_name, bucket_name, add_bucket_policy = false)\r\n if add_bucket_policy\r\n account_id = @sts.get_caller_identity.account\r\n @s3.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: define_policy(bucket_name, account_id)\r\n )\r\n end\r\n \r\n @cloudtrail.create_trail(\r\n name: trail_name,\r\n s3_bucket_name: bucket_name\r\n )\r\n rescue StandardError => e\r\n puts \"Error in 'create_trail': #{e} (#{e.class})\"\r\n end",
"def test_service_creation\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_file_set(\n @payara_complete_domain_configs_yml,\n @config_cache_root,\n @payara_complete_domain_configs_props)\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_bindings(\n @app_services_config,\n @payara_complete_domain_configs_props)\n\n log('Done generating Domain Configuration Property file for WLST: '\\\n \"#{@payara_complete_domain_configs_props}\")\n log('--------------------------------------')\n end",
"def initialize(locale = 'US', secure = false)\n host = HOSTS.fetch(locale) { raise BadLocale }\n @aws_endpoint = \"#{secure ? 'https' : 'http' }://#{host}/onca/xml\"\n end",
"def app_services_create_log_service\n c = Capistrano::BaseHelper.get_capistrano_instance\n commands = []\n commands << \"#{c.sudo} mkdir -p #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} mkdir -p '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n commands << \"#{c.sudo} chown -R #{c.fetch(:runit_log_user)}:#{c.fetch(:runit_log_group)} '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n\n c.run(commands.join(\" && \"))\n Capistrano::BaseHelper.generate_and_upload_config( c.fetch(:runit_local_log_run), c.fetch(:runit_remote_log_run), true )\n commands = []\n commands << \"#{c.sudo} chmod u+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chmod g+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n c.run(commands.join(\" && \")) \n end",
"def service_name=(_arg0); end",
"def initialize(client, params = {}, api_ver = nil)\n super\n # Default values\n @data['type'] ||= 'SSLCertificateDTO'\n @data['uri'] ||= \"#{self.class::BASE_URI}/#{@data['aliasName']}\" if @data['aliasName']\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def initialize(service = :uic)\n raise 'bad argument' unless service.is_a? Symbol\n @service_path = SERVICES[service]\n @client = SOAP::NetHttpClient.new\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n # Make sure we have logratate daemon installed.\n p = package 'logrotate' do\n action :nothing\n end\n p.run_action(:install)\nend",
"def create\n Webhook.log(params)\n \n render text: \"\\nhello chargify\\n\\n\", layout: false, status: 200, :content_type => 'application/xml'\n\n # respond_to do |format|\n # if @webhook.save\n # format.html { redirect_to @webhook, notice: 'Webhook was successfully created.' }\n # format.json { render json: @webhook, status: :created, location: @webhook }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @webhook.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create_logger\n logger = Log4r::Logger.new(\"rrproxy\")\n log_format = Log4r::PatternFormatter.new(:pattern => \"[%d : %l] %m\")\n logger.add(Log4r::StdoutOutputter.new(\"console\", :formatter => log_format))\n logger.level = Log4r::INFO\n logger\nend",
"def create(name, level = ::Logger::INFO)\n dir = \"#{Bitcoin.base_dir}/log\"\n FileUtils.mkdir_p(dir)\n logger = ::Logger.new(dir + \"/#{name}.log\", 10)\n logger.level = level\n logger.formatter = proc do |severity, datetime, progname, msg|\n Format % [severity[0..0], format_datetime(datetime), $$,\n Thread.current.object_id, severity, progname, msg2str(msg)]\n end\n logger\n end",
"def initialize(source, options)\n @source = source\n @host = options[:host]\n @port = options[:port]\n @schema_registry_url = options[:schema_registry_url]\n @schemas_path = options[:schemas_path]\n @transport = (options[:transport] || 'http').downcase\n @logger = options[:logger] || ::Logger.new(STDOUT)\n @cloudevents_specversion = options[:cloudevents_specversion] || '0.4-wip'\n @tag_prefix = options[:name]\n\n fluentd_logger_options = {\n host: @host,\n port: @port,\n logger: @logger\n }\n\n @fluentd_logger = if @transport.eql?('http')\n FluentHttpLogger.new(@tag_prefix, fluentd_logger_options)\n else\n Fluent::Logger::FluentLogger.new(@tag_prefix, fluentd_logger_options)\n end\n\n @avro = AvroTurf::Messaging.new(registry_url: @schema_registry_url, schemas_path: @schemas_path)\n end",
"def initialize(username, password, https=true, log=false, requestlog=true)\n\n\t\t# need it for every request - will be merged in\n\t\tself.opts= { :param => { :login => username, :password => password}}\n\t\t\n\t\t# set savon logging and erros\n\t\tSavon.configure do |config|\n\t\t\tconfig.raise_errors = true # raise SOAP faults and HTTP errors\n\t\t\tconfig.log = log # enable/disable logging\n\t\t\tconfig.log_level = :debug # changing the log level\n\t\tend\n\t\t\n\t\tHTTPI.log=requestlog\n\t\t\n\t\t# build dynamically all methods - some magic :-)\n\t\tmake_methods\n\t\t\n\t\t# creates client with memotoo settings \n\t\tclient(https)\n\tend",
"def delete_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.delete_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.delete_log_scalyr\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#delete_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end",
"def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def create(doc, server_dir, driver_dir, available_jars)\n @logger.debug('sso - in create adding features and openidclient')\n Utils.add_features(doc, @features)\n add_oidc(doc)\n add_custom_ssl(doc)\n add_key_store(doc)\n add_web_app_security(doc)\n end",
"def short\n\n pattern = []\n pattern << \"[AWS\"\n pattern << \":service\"\n pattern << \":http_response_status\"\n pattern << \":duration]\"\n pattern << \":operation\"\n pattern << \":error_class\"\n\n LogFormatter.new(pattern.join(' ') + \"\\n\")\n\n 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 initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7','0.8']\n @url = url\n @salt = salt\n @debug = debug\n\n if version.nil?\n @version = get_api_version\n else\n @version = version\n end\n unless @supported_versions.include?(@version)\n raise BigBlueButtonException.new(\"BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}\")\n end\n\n puts \"BigBlueButtonAPI: Using version #{@version}\" if @debug\n end"
] | [
"0.6308854",
"0.6211946",
"0.55152166",
"0.5481653",
"0.54738533",
"0.5452649",
"0.5396171",
"0.5358046",
"0.5355882",
"0.5352761",
"0.5263379",
"0.5165697",
"0.5145589",
"0.5077512",
"0.5063551",
"0.50387037",
"0.50321275",
"0.5025808",
"0.49512652",
"0.49510434",
"0.4946709",
"0.49454397",
"0.4935045",
"0.49091837",
"0.49024966",
"0.48895165",
"0.48714077",
"0.48654106",
"0.48648134",
"0.48582664",
"0.48575115",
"0.48194867",
"0.48026916",
"0.47924408",
"0.47886494",
"0.4780176",
"0.47584018",
"0.47520587",
"0.4751085",
"0.47296363",
"0.47296363",
"0.4725386",
"0.4725362",
"0.4718709",
"0.4712744",
"0.46994138",
"0.46949995",
"0.46947876",
"0.46863726",
"0.46842587",
"0.4681494",
"0.46806976",
"0.46713653",
"0.46693525",
"0.4667266",
"0.4654367",
"0.46496132",
"0.46473393",
"0.46469507",
"0.46371195",
"0.46275222",
"0.46221673",
"0.46180183",
"0.46171364",
"0.46166742",
"0.46127093",
"0.46050653",
"0.45846042",
"0.4580822",
"0.45760667",
"0.4575739",
"0.45597267",
"0.4545666",
"0.453304",
"0.45280266",
"0.45227885",
"0.45210966",
"0.4512218",
"0.4508863",
"0.44983912",
"0.4491477",
"0.44866493",
"0.44860357",
"0.44799733",
"0.44720763",
"0.446852",
"0.44679415",
"0.44648737",
"0.44595745",
"0.4456291",
"0.44534183",
"0.44499615",
"0.4449803",
"0.44491136",
"0.44490334",
"0.4444686",
"0.4441905",
"0.4437157",
"0.44332373",
"0.4433221"
] | 0.5009591 | 18 |
Create a Scalyr log endpoint Create a Scalyr for a particular service and version. | def create_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
# verify the required parameter 'service_id' is set
if @api_client.config.client_side_validation && service_id.nil?
fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.create_log_scalyr"
end
# verify the required parameter 'version_id' is set
if @api_client.config.client_side_validation && version_id.nil?
fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr"
end
allowable_values = ["none", "waf_debug", "null"]
if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])
fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}"
end
allowable_values = [1, 2]
if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])
fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}"
end
allowable_values = ["US", "EU"]
if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])
fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?
form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?
form_params['format'] = opts[:'format'] if !opts[:'format'].nil?
form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?
form_params['region'] = opts[:'region'] if !opts[:'region'].nil?
form_params['token'] = opts[:'token'] if !opts[:'token'].nil?
form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'
# auth_names
auth_names = opts[:debug_auth_names] || ['token']
new_options = opts.merge(
:operation => :"LoggingScalyrApi.create_log_scalyr",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: LoggingScalyrApi#create_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.create_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.create_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.create_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.create_log_loggly\",\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: LoggingLogglyApi#create_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.create_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogshuttleApi.create_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.create_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.create_log_logshuttle\",\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: LoggingLogshuttleApi#create_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end",
"def create_log_https(opts = {})\n data, _status_code, _headers = create_log_https_with_http_info(opts)\n data\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n scheme = config[:use_ssl] ? \"https\" : \"http\"\n @service_url = \"#{scheme}://#{SERVICE_HOST}#{SERVICE_PATH}\"\n end",
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.update_log_scalyr\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#update_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n host = SERVICE_HOSTS[config[:region]] || SERVICE_HOSTS[:uk]\n @service_url = \"http://#{host}:#{SERVICE_PORT}#{SERVICE_PATH}\"\n end",
"def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def create_log(param); end",
"def initialize(config, register, rpc_service)\n @register = register\n @rpc_service = rpc_service\n @config = config\n\n @server_address = \"0.0.0.0:#{config.data.dig('languageService','port')}\"\n @rpc_service.add_http2_port(@server_address, :this_port_is_insecure)\n @rpc_service.handle(self)\n @logger = Logger.new(config.data.dig('languageService','logger', 'file'))\n @logger.level = Logger::Severity.const_get(config.data.dig('languageService','logger', 'level'))\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def vertx_start\n @consul_client.request(:PUT, \"/v1/agent/service/register\") { |response|\n if response.status_code() == 200\n puts \"Registered foo service with Consul\"\n else \n puts \"Failed to register foo service with Consul\"\n end\n }.end({\n \"ID\" => \"foo_service\",\n \"Name\" => \"foo\",\n \"Tags\" => [\n \"service\"\n ],\n \"Port\" => SERVICE_PORT\n }.to_json)\nend",
"def create_log_scalyr(opts = {})\n data, _status_code, _headers = create_log_scalyr_with_http_info(opts)\n data\n end",
"def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end",
"def generate_service_name\n service_module = ret_service_module\n assembly_name = request_params(:assembly_name)\n\n if version = request_params(:version)\n version = nil if BASE_VERSION_STRING.include?(version)\n else\n version = compute_latest_version(service_module)\n end\n\n assembly_template = service_module.assembly_template(assembly_name: assembly_name, version: version)\n rest_ok_response generate_new_service_name(assembly_template, service_module)\n end",
"def format_service\n\n end",
"def initialize(hostname, port=4119, logger, log_level)\n @hostname = hostname\n @port = port\n super(\"https://#{hostname}:#{port}/webservice/Manager?WSDL\",\n logger,\n log_level,\n {:convert_request_keys_to => :none, # or one of [:lower_camelcase, :upcase, :none]\n :ssl_verify_mode => :none})\n\n end",
"def hatt_add_service(name, url_or_svc_cfg_hash)\n svc_cfg = case url_or_svc_cfg_hash\n when String\n { 'url' => url_or_svc_cfg_hash }\n when Hash\n url_or_svc_cfg_hash\n else\n raise ArgumentError, \"'#{url_or_svc_cfg_hash}' is not a url string nor hash with url key\"\n end\n\n init_config\n services_config = hatt_configuration['hatt_services']\n services_config[name] = svc_cfg\n @hatt_configuration.tcfg_set 'hatt_services', services_config\n\n @hatt_http_clients ||= {}\n @hatt_http_clients[name] = Hatt::HTTP.new hatt_configuration['hatt_services'][name]\n define_singleton_method name.intern do\n @hatt_http_clients[name]\n end\n end",
"def setup(endpoint, format = \"json\")\n case endpoint\n when :path_info\n @service_path = \"/ping/?format=#{format}\"\n when :path_data\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\"\n when :ping\n @service_path = \"/ping/?format=#{format}\"\n when :whoami\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\" \n end\n end",
"def start_service\n create_certificate\n\n DRb.start_service 'drbssl://:0', nil, ssl_config\n end",
"def update_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.update_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.update_log_logshuttle\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#update_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.create_service ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"vcl\", \"wasm\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service'\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/x-www-form-urlencoded'])\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 form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.create_service\",\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: ServiceApi#create_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if(!@priority.blank?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end",
"def create\n req = VCAP::Services::Api::ServiceOfferingRequest.decode(request_body)\n logger.debug(\"Create service request: #{req.extract.inspect}\")\n\n # Should we worry about a race here?\n\n success = nil\n svc = Service.find_by_label(req.label)\n if svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n attrs = req.extract.dup\n attrs.delete(:label)\n # Keep DB in sync with configs if the token changes in the config\n attrs[:token] = @service_auth_token if svc.is_builtin?\n svc.update_attributes!(attrs)\n else\n # Service doesn't exist yet. This can only happen for builtin services since service providers must\n # register with us to get a token.\n svc = Service.new(req.extract)\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.is_builtin? && svc.verify_auth_token(@service_auth_token)\n svc.token = @service_auth_token\n svc.save!\n end\n\n render :json => {}\n end",
"def create_logging_client\n require \"google/cloud/logging\"\n\n Google::Cloud::Logging.new\nend",
"def initialize(api, endpoint, namespace, version)\n if self.class() == AdsCommon::SavonService\n raise NoMethodError, 'Tried to instantiate an abstract class'\n end\n @api, @version, @namespace = api, version, namespace\n @headerhandler = []\n @client = create_savon_client(endpoint, namespace)\n end",
"def create_sslcert\n converge_by(\"Create Cert #{new_resource}\") do\n Chef::Log.info \"Create #{new_resource}\"\n\n update_sslcert\n\n new_resource.updated_by_last_action(true)\n end\n end",
"def create\n\t\t#sanity checks\n\t\tif params[:'licserver-tags'].empty? || params[:'licserver-location'].empty? then\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\n\t\tmatch_data = /(?<port_id>\\d*)@(?<server_id>[\\w.-]+)/.match( params[:'licserver-location'])\n\n\t\t#start creating\n\t\tlicserver = Licserver.new( :port => match_data[:port_id], :server => match_data[:server_id])\n\n\t\tif licserver.save! then\n\t\t\t#update licserver features\n\t\t\tlicserver.update_features\n\n\t\t\t#add the proper tags\n\t\t\tparams[:'licserver-tags'].split.each{ |x| Tag.new(:title => x.downcase, :licserver_id => licserver.id ).save! }\n\t\t\trender :nothing => true, :status => :ok\n\t\t\treturn\n\t\telse\n\t\t\trender :nothing => true, :status => :bad_request\n\t\t\treturn\n\t\tend\n\tend",
"def initialize\n @logger = Logger.new('cf_flattener.log')\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_version=(service_version)\n self.resource = OpenTelemetry::SDK::Resources::Resource.create(\n OpenTelemetry::SemanticConventions::Resource::SERVICE_VERSION => service_version\n )\n end",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def create_logfile\n LibLog.create_logfile(ClientConfig::LOGGING,\n ClientConfig::LOG_LOCATION,\n ClientConfig::LOG_FILENAME)\n end",
"def get_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.get_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.get_log_scalyr\",\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: LoggingScalyrApi#get_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end",
"def create_log_heroku_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHerokuApi.create_log_heroku ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHerokuApi.create_log_heroku\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHerokuApi.create_log_heroku\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/heroku'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHerokuResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHerokuApi.create_log_heroku\",\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: LoggingHerokuApi#create_log_heroku\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end",
"def create\n super(@@service)\n end",
"def initialize\n @app_id = \"05a059c9-c309-46af-9b86-b06d42510550\"\n @cert_file = File.join(File.dirname(__FILE__),\"certs/helloWorld.pem\")\n @cert_pass = \"\"\n @shell_url = \"https://account.healthvault-ppe.com\"\n @hv_url = \"https://platform.healthvault-ppe.com/platform/wildcat.ashx\"\n @logger = Logger.new(\"hv.log\")\n end",
"def new\n @service = Service.new\n end",
"def endpoint(environment, version, service)\n environment = environment.upcase.to_sym\n version = version.to_sym\n service = service.to_sym\n base = get_wsdl_base(environment, version)\n if !subdir_config().nil?\n base = base.to_s + subdir_config()[[version, service]].to_s\n end\n return base.to_s + version.to_s + '/'\n end",
"def service_log status: :processed, message:\n colors_list = { failure: :red, success: :green, info: :cyan, warning: :yellow }\n\n log_header = ActiveSupport::LogSubscriber.new.send(:color, \"[SERVICE #{status.to_s.upcase}]\", colors_list[status])\n service_logger.warn \"#{log_header} #{message}\"\n end",
"def call_create_lbvserver(ipaddress=\"0.0.0.0\", args = {})\n print \"adding lb vserver...\"\n @lbvserver_name = \"vs-#{@servicename}-usa-qa-wh\"\n # hard coded for testing\n ipaddress = \"10.126.255.53\"\n # hard coded for testing\n port = \"80\"\n # hard coded for testing\n http_or_ssl = \"HTTP\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n @request.body = { :lbvserver => { :name => \"#{@lbvserver_name}\", :servicetype => \"#{http_or_ssl}\", :ipv46 => \"#{ipaddress}\", :port => \"#{port}\", :persistencetype => \"COOKIEINSERT\", :timeout => \"15\", :lbmethod => \"LRTM\", :cltTimeout => \"1800\", :appflowlog => \"DISABLED\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n @status_hash[:lbvserver] = \"@lbvserver_name\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n end",
"def create_url_template(rest_method)\n ServiceCatalographer::Util.generate_rest_endpoint_url_template(rest_method)\n end",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end",
"def create\n @web_service_log = WebServiceLog.new(params[:web_service_log])\n\n respond_to do |format|\n if @web_service_log.save\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully created.' }\n format.json { render json: @web_service_log, status: :created, location: @web_service_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\n $stderr.puts \" ! `turbot ssl:add` has been deprecated. Please use the SSL Endpoint add-on and the `turbot certs` commands instead.\"\n $stderr.puts \" ! SSL Endpoint documentation is available at: https://devcenter.turbot.com/articles/ssl-endpoint\"\n end",
"def create_handler(curve_name, io)\n CurveHandler::AttachService.new(\n config_for(curve_name),\n io,\n scenario,\n metadata_parameters\n )\n end",
"def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def log(service, level, summary, details: nil, host: nil, payload: {}, valid_for_secs: nil)\n service ||= @service\n if not service\n raise 'log: service must be passed, or set previously with set_service'\n end\n host ||= get_hostname\n post_body = {\n 'service' => service,\n 'datetime' => get_datetime(),\n 'host' => host,\n 'level' => level,\n 'summary' => summary,\n 'details' => details,\n 'payload' => payload,\n 'valid_for_secs' => valid_for_secs\n }\n \n url = \"https://#{@server_hostname}/api/log\"\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n vlog(0, \"url is #{url} host #{uri.host} port #{uri.port}\")\n http.use_ssl = true\n http.read_timeout = 20\n\n request = Net::HTTP::Post.new(url)\n request.content_type = \"application/json\" \n request.body = post_body.to_json\n\n vlog(0, \"request.body #{request.body}\")\n\n begin\n response = http.request(request)\n\n if response.code != '200'\n $stderr.puts \"POST to #{url} failed with status code #{response.code} and response #{response.body}\"\n return\n end\n rescue StandardError => error\n $stderr.puts \"POST to #{url} failed: #{error}\"\n end\n end",
"def initialize (service_name, application_context)\n super\n end",
"def initialize(endpoint, logger = Logger.new(STDOUT))\n @endpoint = endpoint\n @logger = logger\n logger.debug(\"init with endpoint: #{endpoint}\")\n end",
"def create\n @service_version = ServiceVersion.new(params[:service_version])\n\n respond_to do |format|\n if @service_version.save\n flash[:notice] = 'Service version was successfully created.'\n format.html { redirect_to(@service_version) }\n format.xml { render :xml => @service_version, :status => :created, :location => @service_version }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_log_kafka_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingKafkaApi.create_log_kafka ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingKafkaApi.create_log_kafka\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingKafkaApi.create_log_kafka\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"gzip\", \"snappy\", \"lz4\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 0, -1]\n if @api_client.config.client_side_validation && opts[:'required_acks'] && !allowable_values.include?(opts[:'required_acks'])\n fail ArgumentError, \"invalid value for \\\"required_acks\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"plain\", \"scram-sha-256\", \"scram-sha-512\"]\n if @api_client.config.client_side_validation && opts[:'auth_method'] && !allowable_values.include?(opts[:'auth_method'])\n fail ArgumentError, \"invalid value for \\\"auth_method\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/kafka'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['topic'] = opts[:'topic'] if !opts[:'topic'].nil?\n form_params['brokers'] = opts[:'brokers'] if !opts[:'brokers'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['required_acks'] = opts[:'required_acks'] if !opts[:'required_acks'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['parse_log_keyvals'] = opts[:'parse_log_keyvals'] if !opts[:'parse_log_keyvals'].nil?\n form_params['auth_method'] = opts[:'auth_method'] if !opts[:'auth_method'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['password'] = opts[:'password'] if !opts[:'password'].nil?\n form_params['use_tls'] = opts[:'use_tls'] if !opts[:'use_tls'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingKafkaResponsePost'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingKafkaApi.create_log_kafka\",\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: LoggingKafkaApi#create_log_kafka\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def newMicroServiceType(name,abbr,style,opmode,min=1,max=1)\n\nend",
"def create_log_ftp_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingFtpApi.create_log_ftp ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingFtpApi.create_log_ftp\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingFtpApi.create_log_ftp\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"classic\", \"loggly\", \"logplex\", \"blank\"]\n if @api_client.config.client_side_validation && opts[:'message_type'] && !allowable_values.include?(opts[:'message_type'])\n fail ArgumentError, \"invalid value for \\\"message_type\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"zstd\", \"snappy\", \"gzip\"]\n if @api_client.config.client_side_validation && opts[:'compression_codec'] && !allowable_values.include?(opts[:'compression_codec'])\n fail ArgumentError, \"invalid value for \\\"compression_codec\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/ftp'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['timestamp_format'] = opts[:'timestamp_format'] if !opts[:'timestamp_format'].nil?\n form_params['compression_codec'] = opts[:'compression_codec'] if !opts[:'compression_codec'].nil?\n form_params['period'] = opts[:'period'] if !opts[:'period'].nil?\n form_params['gzip_level'] = opts[:'gzip_level'] if !opts[:'gzip_level'].nil?\n form_params['address'] = opts[:'address'] if !opts[:'address'].nil?\n form_params['hostname'] = opts[:'hostname'] if !opts[:'hostname'].nil?\n form_params['ipv4'] = opts[:'ipv4'] if !opts[:'ipv4'].nil?\n form_params['password'] = opts[:'password'] if !opts[:'password'].nil?\n form_params['path'] = opts[:'path'] if !opts[:'path'].nil?\n form_params['public_key'] = opts[:'public_key'] if !opts[:'public_key'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['port'] = opts[:'port'] if !opts[:'port'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingFtpResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingFtpApi.create_log_ftp\",\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: LoggingFtpApi#create_log_ftp\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def call\n # Update service and update context\n self.service = Entities::Service.find_by_system_name(remote: threescale_client,\n system_name: service_system_name)\n if service.nil?\n # Create service and update context\n self.service = Entities::Service.create(remote: threescale_client,\n service_params: service_settings)\n logger.info \"Created service id: #{service.id}, name: #{service_name}\"\n else\n service.update(service_settings)\n logger.info \"Updated service id: #{service.id}, name: #{service_name}\"\n end\n\n report['id'] = service.id\n report['system_name'] = service.system_name\n report['name'] = service.name\n report['backend_version'] = api_spec.service_backend_version\n end",
"def create_version\n Milkrun.say \"Creating new version of app in HockeyApp\"\n\n body = {}.tap do |json|\n json[:bundle_version] = version_code\n json[:bundle_short_version] = version_name\n json[:status] = 1\n end\n\n headers = {}.tap do |h|\n h[\"X-HockeyAppToken\"] = token\n h[\"Accept\"] = \"application/json\"\n h[\"Content-Type\"] = \"application/json\"\n end\n\n url = \"#{base_url}/#{app_id}/app_versions/new\"\n response = Excon.post(url, body: body.to_json, connect_timeout: 10, headers: headers)\n if response.status != 201\n Milkrun.error response.data.to_s\n raise \"Failed to post new version to HockeyApp!\"\n end\n\n Milkrun.say \"New version created in HockeyApp\"\n end",
"def create\n @lsrs_framework = LsrsFramework.new(params[:lsrs_framework])\n\n respond_to do |format|\n if @lsrs_framework.save\n flash[:notice] = 'LsrsFramework was successfully created.'\n format.html { redirect_to(@lsrs_framework) }\n format.xml { render :xml => @lsrs_framework, :status => :created, :location => @lsrs_framework }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lsrs_framework.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_tls_sub_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TlsSubscriptionsApi.create_tls_sub ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/tls/subscriptions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].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/vnd.api+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/vnd.api+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(opts[:'tls_subscription'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'TlsSubscriptionResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"TlsSubscriptionsApi.create_tls_sub\",\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: TlsSubscriptionsApi#create_tls_sub\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def logger log_name, resource, labels = {}\n Logger.new self, log_name, resource, labels\n end",
"def create\n @webhook_endpoint = WebhookEndpoint.new(webhook_endpoint_params)\n\n respond_to do |format|\n if @webhook_endpoint.save\n format.html { redirect_to @webhook_endpoint, notice: 'Webhook endpoint was successfully created.' }\n format.json { render :show, status: :created, location: @webhook_endpoint }\n else\n format.html { render :new }\n format.json { render json: @webhook_endpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def log_create(p_args)\n Logging::create_log(p_args)\n end",
"def initialize(service_name = T.unsafe(nil), environment = T.unsafe(nil), options = T.unsafe(nil)); end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/logging/v2/logging_config_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @config_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Logging::V2::ConfigServiceV2::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def create_service_files(current_resource, new_resource)\n service_name = get_service_name(new_resource)\n\n template_variables = ({\n \"dashboard_name\" => get_dashboard_name(new_resource),\n \"dashboard_path\" => new_resource.path,\n \"dashboard_port\" => new_resource.port,\n \"service_name\" => service_name,\n \"ruby_version\" => node[\"dashing\"][\"ruby_version\"]\n })\n\n # If the resource's service_type is changing, then delete the old script.\n if get_service_script_name(current_resource) != nil\n file get_service_script_name(current_resource) do\n action :delete\n only_if {current_resource.service_type != new_resource.service_type}\n end\n end\n\n # Create the new startup script.\n case new_resource.service_type\n when \"upstart\"\n template \"/etc/init/#{service_name}.conf\" do\n cookbook \"dashing\"\n source \"upstart-dashboard.conf.erb\"\n mode 0644\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n when \"init.d\"\n template \"/etc/init.d/#{service_name}\" do\n cookbook \"dashing\"\n source node['dashing']['init_source']\n mode 0755\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n else\n raise \"dashing: Unknown service_type '#{rnew_resource.service_type}'\"\n end\nend",
"def add_certificate(http); end",
"def create!(params={})\n raise ArgumentError, \"Error: product, component, summary, version are required args\" unless check_params([:product, :component, :summary, :version], params)\n rpc_call :create, params\n end",
"def create_resource(description, opts, resource_uri = nil)\n warn \"Attempt to create sliver directly - #{description}\"\n raise OMF::SFA::AM::Rest::NotAuthorizedException.new(\"Slivers can only be created in the context of /slices/xxx/slivers\")\n end",
"def create_log_gcp_pubsub_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingPubsubApi.create_log_gcp_pubsub ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingPubsubApi.create_log_gcp_pubsub\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingPubsubApi.create_log_gcp_pubsub\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/pubsub'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['user'] = opts[:'user'] if !opts[:'user'].nil?\n form_params['secret_key'] = opts[:'secret_key'] if !opts[:'secret_key'].nil?\n form_params['account_name'] = opts[:'account_name'] if !opts[:'account_name'].nil?\n form_params['topic'] = opts[:'topic'] if !opts[:'topic'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingGooglePubsubResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingPubsubApi.create_log_gcp_pubsub\",\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: LoggingPubsubApi#create_log_gcp_pubsub\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def subscription_service_create_with_http_info(space_id, create_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionService.subscription_service_create ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling SubscriptionService.subscription_service_create\" if space_id.nil?\n # verify the required parameter 'create_request' is set\n fail ArgumentError, \"Missing the required parameter 'create_request' when calling SubscriptionService.subscription_service_create\" if create_request.nil?\n # resource path\n local_var_path = \"/subscription/create\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(create_request)\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 => 'SubscriptionVersion')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionService#subscription_service_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create!\n document_roots = ServerTools::Configuration.get(\"apache\",\"documentroots\")\n logs = join_and_expand_path(document_roots, @name, \"logs\")\n available_site = join_and_expand_path(ServerTools::Configuration.get(\"apache\",\"available_sites\"), @name)\n\n put_option(:document_root, join_and_expand_path(document_roots, @name, \"htdocs\"))\n put_option(:error_log, join_and_expand_path(logs, \"error.log\"))\n put_option(:custom_log, \"#{join_and_expand_path(logs,\"access.log\")} combined\")\n \n ServerTools::Logger.message(\"Create VirtualHost \\\"#{@name}\\\"\")\n ServerTools::Logger.message(\"Document root: #{@options[:document_root]}\")\n ServerTools::Logger.message(\"Logs: #{logs}\")\n ServerTools::Logger.message(\"Configuration: #{available_site}\")\n \n if File.exists?(available_site)\n ServerTools::Logger.error(\"Configuration does already exist!\")\n exit\n end\n if Dir.exists?(@options[:document_root])\n ServerTools::Logger.error(\"Document root does already exist!\")\n exit\n end\n \n FileUtils.mkpath(@options[:document_root])\n FileUtils.mkpath(logs)\n \n File.open(available_site, \"w\") do |f|\n f.puts %Q{\\#\n\\# #{@name} (#{available_site})\n\\#\n<VirtualHost *>\n\\tServerName\\t#{@name}\n#{parse_options(@options)}\n#{htaccess_configuration(@options)}\n</VirtualHost>\n }\n end\n \n end",
"def create_trail(trail_name, bucket_name, add_bucket_policy = false)\r\n if add_bucket_policy\r\n account_id = @sts.get_caller_identity.account\r\n @s3.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: define_policy(bucket_name, account_id)\r\n )\r\n end\r\n \r\n @cloudtrail.create_trail(\r\n name: trail_name,\r\n s3_bucket_name: bucket_name\r\n )\r\n rescue StandardError => e\r\n puts \"Error in 'create_trail': #{e} (#{e.class})\"\r\n end",
"def test_service_creation\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_file_set(\n @payara_complete_domain_configs_yml,\n @config_cache_root,\n @payara_complete_domain_configs_props)\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_bindings(\n @app_services_config,\n @payara_complete_domain_configs_props)\n\n log('Done generating Domain Configuration Property file for WLST: '\\\n \"#{@payara_complete_domain_configs_props}\")\n log('--------------------------------------')\n end",
"def app_services_create_log_service\n c = Capistrano::BaseHelper.get_capistrano_instance\n commands = []\n commands << \"#{c.sudo} mkdir -p #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root #{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\")}\"\n commands << \"#{c.sudo} mkdir -p '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n commands << \"#{c.sudo} chown -R #{c.fetch(:runit_log_user)}:#{c.fetch(:runit_log_group)} '#{File.join(\"/var\", \"log\", \"service\", Capistrano::BaseHelper.user_app_env_path, \"runit\")}'\"\n\n c.run(commands.join(\" && \"))\n Capistrano::BaseHelper.generate_and_upload_config( c.fetch(:runit_local_log_run), c.fetch(:runit_remote_log_run), true )\n commands = []\n commands << \"#{c.sudo} chmod u+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chmod g+x '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n commands << \"#{c.sudo} chown #{c.fetch(:user)}:root '#{File.join(\"/etc\", \"sv\", Capistrano::BaseHelper.user_app_env_path, \"log\", \"run\")}'\"\n c.run(commands.join(\" && \")) \n end",
"def initialize(locale = 'US', secure = false)\n host = HOSTS.fetch(locale) { raise BadLocale }\n @aws_endpoint = \"#{secure ? 'https' : 'http' }://#{host}/onca/xml\"\n end",
"def service_name=(_arg0); end",
"def initialize(client, params = {}, api_ver = nil)\n super\n # Default values\n @data['type'] ||= 'SSLCertificateDTO'\n @data['uri'] ||= \"#{self.class::BASE_URI}/#{@data['aliasName']}\" if @data['aliasName']\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def initialize(service = :uic)\n raise 'bad argument' unless service.is_a? Symbol\n @service_path = SERVICES[service]\n @client = SOAP::NetHttpClient.new\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n # Make sure we have logratate daemon installed.\n p = package 'logrotate' do\n action :nothing\n end\n p.run_action(:install)\nend",
"def create\n Webhook.log(params)\n \n render text: \"\\nhello chargify\\n\\n\", layout: false, status: 200, :content_type => 'application/xml'\n\n # respond_to do |format|\n # if @webhook.save\n # format.html { redirect_to @webhook, notice: 'Webhook was successfully created.' }\n # format.json { render json: @webhook, status: :created, location: @webhook }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @webhook.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create(name, level = ::Logger::INFO)\n dir = \"#{Bitcoin.base_dir}/log\"\n FileUtils.mkdir_p(dir)\n logger = ::Logger.new(dir + \"/#{name}.log\", 10)\n logger.level = level\n logger.formatter = proc do |severity, datetime, progname, msg|\n Format % [severity[0..0], format_datetime(datetime), $$,\n Thread.current.object_id, severity, progname, msg2str(msg)]\n end\n logger\n end",
"def create_logger\n logger = Log4r::Logger.new(\"rrproxy\")\n log_format = Log4r::PatternFormatter.new(:pattern => \"[%d : %l] %m\")\n logger.add(Log4r::StdoutOutputter.new(\"console\", :formatter => log_format))\n logger.level = Log4r::INFO\n logger\nend",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end",
"def initialize(username, password, https=true, log=false, requestlog=true)\n\n\t\t# need it for every request - will be merged in\n\t\tself.opts= { :param => { :login => username, :password => password}}\n\t\t\n\t\t# set savon logging and erros\n\t\tSavon.configure do |config|\n\t\t\tconfig.raise_errors = true # raise SOAP faults and HTTP errors\n\t\t\tconfig.log = log # enable/disable logging\n\t\t\tconfig.log_level = :debug # changing the log level\n\t\tend\n\t\t\n\t\tHTTPI.log=requestlog\n\t\t\n\t\t# build dynamically all methods - some magic :-)\n\t\tmake_methods\n\t\t\n\t\t# creates client with memotoo settings \n\t\tclient(https)\n\tend",
"def initialize(source, options)\n @source = source\n @host = options[:host]\n @port = options[:port]\n @schema_registry_url = options[:schema_registry_url]\n @schemas_path = options[:schemas_path]\n @transport = (options[:transport] || 'http').downcase\n @logger = options[:logger] || ::Logger.new(STDOUT)\n @cloudevents_specversion = options[:cloudevents_specversion] || '0.4-wip'\n @tag_prefix = options[:name]\n\n fluentd_logger_options = {\n host: @host,\n port: @port,\n logger: @logger\n }\n\n @fluentd_logger = if @transport.eql?('http')\n FluentHttpLogger.new(@tag_prefix, fluentd_logger_options)\n else\n Fluent::Logger::FluentLogger.new(@tag_prefix, fluentd_logger_options)\n end\n\n @avro = AvroTurf::Messaging.new(registry_url: @schema_registry_url, schemas_path: @schemas_path)\n end",
"def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def delete_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.delete_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.delete_log_scalyr\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#delete_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create(doc, server_dir, driver_dir, available_jars)\n @logger.debug('sso - in create adding features and openidclient')\n Utils.add_features(doc, @features)\n add_oidc(doc)\n add_custom_ssl(doc)\n add_key_store(doc)\n add_web_app_security(doc)\n end",
"def short\n\n pattern = []\n pattern << \"[AWS\"\n pattern << \":service\"\n pattern << \":http_response_status\"\n pattern << \":duration]\"\n pattern << \":operation\"\n pattern << \":error_class\"\n\n LogFormatter.new(pattern.join(' ') + \"\\n\")\n\n 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 create\n @vinyl = Vinyl.new(vinyl_params)\n\n respond_to do |format|\n if @vinyl.save\n format.html { redirect_to @vinyl, notice: 'Vinyl was successfully created.' }\n format.json { render :show, status: :created, location: @vinyl }\n else\n format.html { render :new }\n format.json { render json: @vinyl.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.63094306",
"0.55148655",
"0.54828",
"0.5475669",
"0.5457197",
"0.539816",
"0.5357744",
"0.53551394",
"0.5352624",
"0.5262666",
"0.51651096",
"0.5146249",
"0.5081378",
"0.506789",
"0.5038942",
"0.5032302",
"0.5024885",
"0.5010969",
"0.4952143",
"0.49512643",
"0.49470007",
"0.49459678",
"0.4934715",
"0.4909645",
"0.49026558",
"0.48903733",
"0.4873344",
"0.48675334",
"0.48662412",
"0.486053",
"0.485763",
"0.48207524",
"0.48040608",
"0.47951406",
"0.47875074",
"0.47797602",
"0.47608432",
"0.47566864",
"0.47503102",
"0.47289917",
"0.47289917",
"0.4728209",
"0.47266886",
"0.47206298",
"0.47156423",
"0.470045",
"0.46975443",
"0.46927452",
"0.46888432",
"0.46861643",
"0.46815547",
"0.4680559",
"0.46708253",
"0.46706286",
"0.46690682",
"0.46564263",
"0.46515274",
"0.46487427",
"0.46474448",
"0.4639499",
"0.4630181",
"0.46235642",
"0.46205163",
"0.46188536",
"0.46185273",
"0.46141887",
"0.46056005",
"0.458841",
"0.4582291",
"0.45822674",
"0.45778498",
"0.45610508",
"0.4547796",
"0.4531342",
"0.45304057",
"0.45247763",
"0.45224348",
"0.45134386",
"0.45114404",
"0.4499982",
"0.44932932",
"0.4490122",
"0.4487067",
"0.4481218",
"0.44717816",
"0.44687647",
"0.44682434",
"0.44674486",
"0.44609493",
"0.4458588",
"0.44583496",
"0.44514522",
"0.44512442",
"0.44504523",
"0.44481188",
"0.44479525",
"0.44434497",
"0.4439198",
"0.4434874",
"0.4433739"
] | 0.62122124 | 1 |
Delete the Scalyr log endpoint Delete the Scalyr for a particular service and version. | def delete_log_scalyr(opts = {})
data, _status_code, _headers = delete_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_log_https(opts = {})\n data, _status_code, _headers = delete_log_https_with_http_info(opts)\n data\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end",
"def destroy\n @vip_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_services_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip service: #{@vip_service.name}\")\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def delete_version( doc_id:, version: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, \"#{url_for_base doc_id}/#{version}\", params, :json\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.delete_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.delete_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.delete_log_scalyr\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#delete_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @web_service_log = WebServiceLog.find(params[:id])\n @web_service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to web_service_logs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy_service\n # Disable automatically destroys the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n action :delete\n recursive true\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @service_log = ServiceLog.find(params[:id])\n @service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(truck_service_logs_path(params[:truck_id])) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end",
"def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend",
"def destroy\n @log.destroy\n\n head :no_content\n end",
"def destroy\n authorize! :destroy, @db_repl_freq\n @db_repl_freq.destroy\n respond_to do |format|\n format.html { redirect_to db_repl_freqs_url, notice: 'Database replication frequency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ncr_api_log.destroy\n respond_to do |format|\n format.html { redirect_to ncr_api_logs_url, notice: 'Ncr api log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wr_log = WrLog.find(params[:id])\n @wr_log.destroy\n\n respond_to do |format|\n format.html { redirect_to wr_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @exchange_product_price_log.destroy\n respond_to do |format|\n format.html { redirect_to exchange_product_price_logs_url, notice: 'Exchange product price log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @end_service.destroy\n head :no_content\n end",
"def delete\n execute_prlctl('delete', @uuid)\n end",
"def destroy\n @subscription_fu_log = SubscriptionFuLog.find(params[:id])\n @subscription_fu_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_fu_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @d_logger = DLogger.find(params[:id])\n @d_logger.destroy\n\n respond_to do |format|\n format.html { redirect_to d_loggers_url }\n format.json { head :no_content }\n end\n end",
"def action_delete\n if current_resource.exists?\n converge_by(\"remove lag #{current_resource.name}\") do\n execute 'netdev lag delete' do\n command \"netdev lag delete #{new_resource.lag_name}\"\n execute_command(command)\n end\n end\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @search_service_log.destroy\n respond_to do |format|\n format.html { redirect_to admin_search_service_logs_url, notice: 'SearchServiceLogs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(instance) # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + instance\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"def destroy\n redirect_to acm300_logs_path\n \n # @acm_logs300_log.destroy\n # respond_to do |format|\n # format.html { redirect_to acm300_logs_url, notice: 'Acm300 log was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete\n ensure_service!\n service.delete_metric name\n true\n end",
"def destroy\n @admin_pricing_fabric.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_fabrics_path, notice: mk_notice(@admin_pricing_fabric, @admin_pricing_fabric.brand.name, 'قیمت برای برند پارچه', :destroy) }\n format.json { head :no_content }\n end\n end",
"def delete_kubernetes_version(moid, opts = {})\n delete_kubernetes_version_with_http_info(moid, opts)\n nil\n end",
"def destroy\n @called_from = params[:called_from] || \"vip_programmer\"\n @vip_programmer_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_programmer_services_url) }\n format.xml { head :ok }\n format.js \n end\n website.add_log(user: current_user, action: \"Removed a service from #{@vip_programmer_service.programmer.name}\")\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def remove_service\n service = Service.find(params[:service_id])\n version = Version.find(params[:version_id])\n @deployment.versions.delete(version)\n render :edit\n end",
"def delete_by_org_key_and_service_key_and_version(org_key, service_key, version)\n HttpClient::Preconditions.assert_class('org_key', org_key, String)\n HttpClient::Preconditions.assert_class('service_key', service_key, String)\n HttpClient::Preconditions.assert_class('version', version, String)\n @client.request(\"/#{CGI.escape(org_key)}/#{CGI.escape(service_key)}/#{CGI.escape(version)}\").delete\n nil\n end",
"def destroy\n @counter_service.destroy\n respond_to do |format|\n format.html { redirect_to counter_services_url, notice: 'Counter service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tourist_site_app_service.destroy\n respond_to do |format|\n format.html { redirect_to tourist_site_app_services_url, notice: 'Tourist site app service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end",
"def destroy #:nodoc:\n\t\tRequest.find(params[:id]).destroy\n\t\tflash[:notice] = \"La solicitud de servicio se ha eliminado\"\n\t\tredirect_to :action => 'index'\n\tend",
"def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_history.destroy\n\n head :no_content\n end",
"def destroy\n @service_length = ServiceLength.find(params[:id])\n @service_length.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lengths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_pricing_paint_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_paint_colors_path, notice: mk_notice(@admin_pricing_paint_color, @admin_pricing_paint_color.brand.name, 'قیمت برای برند رنگ', :destroy) }\n format.json { head :no_content }\n end\n end",
"def delete_space_webapi(slug, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{slug}\\\" Web API on the Space.\")\n delete(\"#{@api_url}/webApis/#{slug}\", headers)\n end",
"def service_delete(name)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_delete(name)\n\t\telse\n\t\t\tshell_service_delete(name)\n\t\tend\n\tend",
"def destroy\n @service_version = ServiceVersion.find(params[:id])\n @service_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_versions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @driver_log.destroy\n respond_to do |format|\n format.html { redirect_to driver_logs_url, notice: 'Driver log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n if Course.delete(params[:id])\n str_desc=\"Se elimino la curso \"+Course.find(params[:id]).name+\" con id = \"+params[:id].to_s\n @log=Log.create!({:description=>str_desc, :user_id=>current_user.id})\n flash[:notice] = t('messages.successfully_deleted')\n else\n flash[:alert] = t('messages.error_ocurred')\n end\n rescue ActiveRecord::StatementInvalid => error\n flash[:alert] = t('messages.error_ocurred')\n end\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def destroy\n @vlog.destroy\n respond_to do |format|\n format.html { redirect_to vlogs_url, notice: 'Vlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n fail('Destroying fip pool is not supported using contrail api')\n end",
"def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n @service.delete(self)\n end",
"def delete(pattern, &hndlr)\n @j_del.delete(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end",
"def destroy\n @tech_serv.destroy\n respond_to do |format|\n format.html { redirect_to admin_tech_servs_url, notice: '技术服务删除成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curriculum.destroy\n respond_to do |format|\n format.html { redirect_to curriculums_url, notice: 'El curriculum se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterio_evalucion_servicio.destroy\n respond_to do |format|\n format.html { redirect_to criterio_evalucion_servicios_url, notice: 'Criterio evalucion servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @toolkit_resource.destroy\n respond_to do |format|\n format.html { redirect_to(admin_toolkit_resources_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted toolkit resource: #{@toolkit_resource.name}\")\n end",
"def destroy\n authorize! :destroy, @service_level\n @service_level.destroy\n respond_to do |format|\n format.html { redirect_to service_levels_url, notice: 'Service level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcadmin_login_log.destroy\n respond_to do |format|\n format.html { redirect_to rcadmin_login_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate_service.destroy\n respond_to do |format|\n format.html { redirect_to rate_services_url, notice: 'Rate service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @curriculum = Curriculum.find(params[:id])\n @curriculum.destroy\n \n respond_with @curriculum, :location => admin_course_curriculums_url(@course)\n end",
"def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url, notice: 'Shift was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluacion_servicio.destroy\n respond_to do |format|\n format.html { redirect_to evaluacion_servicios_url, notice: 'Evaluacion servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @service.delete(self)\n end",
"def del_service(wspace, address, proto, port, comm='')\n\n\t\thost = get_host(:workspace => wspace, :address => address)\n\t\treturn unless host\n\n\t\thost.services.all(:conditions => {:proto => proto, :port => port}).each { |s| s.destroy }\n\tend",
"def delete_webhook(target_url)\n Uploadcare::Webhook.delete(target_url)\n end",
"def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @called_from = params[:called_from] || \"vip_programmer\"\n @vip_programmer_certification.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_programmer_certifications_url) }\n format.xml { head :ok }\n format.js \n end\n website.add_log(user: current_user, action: \"Removed a certification from #{@vip_programmer_certification.programmer.name}\")\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end",
"def destroy\n @vip_global_region.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_global_regions_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted an amx vip global region: #{@vip_global_region.name}\")\n end",
"def destroy\n @weight_log = WeightLog.find(params[:id])\n @weight_log.destroy\n\n respond_to do |format|\n format.html { redirect_to weight_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def destroy\n @counter_service_type.destroy\n respond_to do |format|\n format.html { redirect_to counter_service_types_url, notice: 'Counter service type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Service.find(params[:id]).destroy\n flash[:success] = \"A record add been successfully deleted\"\n redirect_to services_path\n end",
"def delete\n api(\"Delete\")\n end",
"def solr_delete(solr_id)\n Solarize::Post.execute(Solr::Request::Delete.new(:id => solr_id))\n end",
"def delete_version(key, version_id)\n raise MedusaStorage::Error::UnsupportedOperation\n end",
"def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.delete_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.delete_log_logshuttle\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#delete_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end",
"def destroy\n @measurement_log = current_account.measurement_logs.find(params[:id])\n @measurement_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurement_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end",
"def destroy\n @centricsteel = Centricsteel.find(params[:id])\n @centricsteel.destroy\n\n respond_to do |format|\n format.html { redirect_to(centricsteels_url) }\n format.xml { head :ok }\n end\n end",
"def icl_delete( args )\n prop = args.split(',')\n name = prop[0]\n date = prop[1]\n puts name + \" \" + date\n @log.delete( name, date )\n end",
"def destroy\n @service.destroy\n end",
"def destroy\n @service.destroy\n end"
] | [
"0.5703527",
"0.5683674",
"0.5658819",
"0.55562216",
"0.5527568",
"0.5518708",
"0.5513792",
"0.5488694",
"0.5468409",
"0.54336226",
"0.54132575",
"0.5393415",
"0.5388185",
"0.53835225",
"0.5351621",
"0.53490615",
"0.5311904",
"0.5309752",
"0.53036875",
"0.52970815",
"0.5288738",
"0.52885914",
"0.5287133",
"0.5275109",
"0.52740294",
"0.52609545",
"0.5245721",
"0.5243765",
"0.5243765",
"0.5243765",
"0.5243765",
"0.52425903",
"0.5235908",
"0.5212381",
"0.5211571",
"0.5201111",
"0.51902467",
"0.51873136",
"0.51872826",
"0.5179136",
"0.5177268",
"0.5161582",
"0.5158178",
"0.51554334",
"0.51516324",
"0.5150887",
"0.5144177",
"0.5126047",
"0.5124265",
"0.51189923",
"0.51062435",
"0.5102509",
"0.5102195",
"0.51016986",
"0.51005816",
"0.5096623",
"0.509282",
"0.50888693",
"0.5084825",
"0.5080233",
"0.5080233",
"0.50798315",
"0.50740707",
"0.5072009",
"0.5068807",
"0.50658745",
"0.5065129",
"0.50643665",
"0.50642335",
"0.50642",
"0.50588125",
"0.50559723",
"0.50539666",
"0.50532",
"0.5051853",
"0.5047565",
"0.50472456",
"0.5046626",
"0.50429255",
"0.5034909",
"0.50314987",
"0.5031218",
"0.50281507",
"0.5022426",
"0.50188637",
"0.50173324",
"0.5017024",
"0.50127995",
"0.5012376",
"0.50089794",
"0.5005542",
"0.50048846",
"0.50047106",
"0.50019103",
"0.5000375",
"0.4999589",
"0.4999146",
"0.49971148",
"0.49970466",
"0.49970466"
] | 0.5467106 | 9 |
Delete the Scalyr log endpoint Delete the Scalyr for a particular service and version. | def delete_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.delete_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
logging_scalyr_name = opts[:'logging_scalyr_name']
# verify the required parameter 'service_id' is set
if @api_client.config.client_side_validation && service_id.nil?
fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.delete_log_scalyr"
end
# verify the required parameter 'version_id' is set
if @api_client.config.client_side_validation && version_id.nil?
fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.delete_log_scalyr"
end
# verify the required parameter 'logging_scalyr_name' is set
if @api_client.config.client_side_validation && logging_scalyr_name.nil?
fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.delete_log_scalyr"
end
# resource path
local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'InlineResponse200'
# auth_names
auth_names = opts[:debug_auth_names] || ['token']
new_options = opts.merge(
:operation => :"LoggingScalyrApi.delete_log_scalyr",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: LoggingScalyrApi#delete_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_log_https(opts = {})\n data, _status_code, _headers = delete_log_https_with_http_info(opts)\n data\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end",
"def destroy\n @vip_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_services_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip service: #{@vip_service.name}\")\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def delete_version( doc_id:, version: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, \"#{url_for_base doc_id}/#{version}\", params, :json\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @web_service_log = WebServiceLog.find(params[:id])\n @web_service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to web_service_logs_url }\n format.json { head :ok }\n end\n end",
"def delete_log_scalyr(opts = {})\n data, _status_code, _headers = delete_log_scalyr_with_http_info(opts)\n data\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy_service\n # Disable automatically destroys the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n action :delete\n recursive true\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @service_log = ServiceLog.find(params[:id])\n @service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(truck_service_logs_path(params[:truck_id])) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end",
"def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend",
"def destroy\n @log.destroy\n\n head :no_content\n end",
"def destroy\n authorize! :destroy, @db_repl_freq\n @db_repl_freq.destroy\n respond_to do |format|\n format.html { redirect_to db_repl_freqs_url, notice: 'Database replication frequency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ncr_api_log.destroy\n respond_to do |format|\n format.html { redirect_to ncr_api_logs_url, notice: 'Ncr api log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wr_log = WrLog.find(params[:id])\n @wr_log.destroy\n\n respond_to do |format|\n format.html { redirect_to wr_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @exchange_product_price_log.destroy\n respond_to do |format|\n format.html { redirect_to exchange_product_price_logs_url, notice: 'Exchange product price log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @end_service.destroy\n head :no_content\n end",
"def delete\n execute_prlctl('delete', @uuid)\n end",
"def destroy\n @subscription_fu_log = SubscriptionFuLog.find(params[:id])\n @subscription_fu_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_fu_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @d_logger = DLogger.find(params[:id])\n @d_logger.destroy\n\n respond_to do |format|\n format.html { redirect_to d_loggers_url }\n format.json { head :no_content }\n end\n end",
"def action_delete\n if current_resource.exists?\n converge_by(\"remove lag #{current_resource.name}\") do\n execute 'netdev lag delete' do\n command \"netdev lag delete #{new_resource.lag_name}\"\n execute_command(command)\n end\n end\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @search_service_log.destroy\n respond_to do |format|\n format.html { redirect_to admin_search_service_logs_url, notice: 'SearchServiceLogs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(instance) # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + instance\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"def destroy\n redirect_to acm300_logs_path\n \n # @acm_logs300_log.destroy\n # respond_to do |format|\n # format.html { redirect_to acm300_logs_url, notice: 'Acm300 log was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete\n ensure_service!\n service.delete_metric name\n true\n end",
"def destroy\n @admin_pricing_fabric.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_fabrics_path, notice: mk_notice(@admin_pricing_fabric, @admin_pricing_fabric.brand.name, 'قیمت برای برند پارچه', :destroy) }\n format.json { head :no_content }\n end\n end",
"def delete_kubernetes_version(moid, opts = {})\n delete_kubernetes_version_with_http_info(moid, opts)\n nil\n end",
"def destroy\n @called_from = params[:called_from] || \"vip_programmer\"\n @vip_programmer_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_programmer_services_url) }\n format.xml { head :ok }\n format.js \n end\n website.add_log(user: current_user, action: \"Removed a service from #{@vip_programmer_service.programmer.name}\")\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def remove_service\n service = Service.find(params[:service_id])\n version = Version.find(params[:version_id])\n @deployment.versions.delete(version)\n render :edit\n end",
"def delete_by_org_key_and_service_key_and_version(org_key, service_key, version)\n HttpClient::Preconditions.assert_class('org_key', org_key, String)\n HttpClient::Preconditions.assert_class('service_key', service_key, String)\n HttpClient::Preconditions.assert_class('version', version, String)\n @client.request(\"/#{CGI.escape(org_key)}/#{CGI.escape(service_key)}/#{CGI.escape(version)}\").delete\n nil\n end",
"def destroy\n @counter_service.destroy\n respond_to do |format|\n format.html { redirect_to counter_services_url, notice: 'Counter service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tourist_site_app_service.destroy\n respond_to do |format|\n format.html { redirect_to tourist_site_app_services_url, notice: 'Tourist site app service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end",
"def destroy #:nodoc:\n\t\tRequest.find(params[:id]).destroy\n\t\tflash[:notice] = \"La solicitud de servicio se ha eliminado\"\n\t\tredirect_to :action => 'index'\n\tend",
"def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_history.destroy\n\n head :no_content\n end",
"def destroy\n @service_length = ServiceLength.find(params[:id])\n @service_length.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lengths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_pricing_paint_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_paint_colors_path, notice: mk_notice(@admin_pricing_paint_color, @admin_pricing_paint_color.brand.name, 'قیمت برای برند رنگ', :destroy) }\n format.json { head :no_content }\n end\n end",
"def delete_space_webapi(slug, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{slug}\\\" Web API on the Space.\")\n delete(\"#{@api_url}/webApis/#{slug}\", headers)\n end",
"def service_delete(name)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_delete(name)\n\t\telse\n\t\t\tshell_service_delete(name)\n\t\tend\n\tend",
"def destroy\n @service_version = ServiceVersion.find(params[:id])\n @service_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_versions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @driver_log.destroy\n respond_to do |format|\n format.html { redirect_to driver_logs_url, notice: 'Driver log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n if Course.delete(params[:id])\n str_desc=\"Se elimino la curso \"+Course.find(params[:id]).name+\" con id = \"+params[:id].to_s\n @log=Log.create!({:description=>str_desc, :user_id=>current_user.id})\n flash[:notice] = t('messages.successfully_deleted')\n else\n flash[:alert] = t('messages.error_ocurred')\n end\n rescue ActiveRecord::StatementInvalid => error\n flash[:alert] = t('messages.error_ocurred')\n end\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def destroy\n @vlog.destroy\n respond_to do |format|\n format.html { redirect_to vlogs_url, notice: 'Vlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n fail('Destroying fip pool is not supported using contrail api')\n end",
"def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n @service.delete(self)\n end",
"def delete(pattern, &hndlr)\n @j_del.delete(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end",
"def destroy\n @tech_serv.destroy\n respond_to do |format|\n format.html { redirect_to admin_tech_servs_url, notice: '技术服务删除成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curriculum.destroy\n respond_to do |format|\n format.html { redirect_to curriculums_url, notice: 'El curriculum se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterio_evalucion_servicio.destroy\n respond_to do |format|\n format.html { redirect_to criterio_evalucion_servicios_url, notice: 'Criterio evalucion servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @toolkit_resource.destroy\n respond_to do |format|\n format.html { redirect_to(admin_toolkit_resources_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted toolkit resource: #{@toolkit_resource.name}\")\n end",
"def destroy\n authorize! :destroy, @service_level\n @service_level.destroy\n respond_to do |format|\n format.html { redirect_to service_levels_url, notice: 'Service level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcadmin_login_log.destroy\n respond_to do |format|\n format.html { redirect_to rcadmin_login_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate_service.destroy\n respond_to do |format|\n format.html { redirect_to rate_services_url, notice: 'Rate service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @curriculum = Curriculum.find(params[:id])\n @curriculum.destroy\n \n respond_with @curriculum, :location => admin_course_curriculums_url(@course)\n end",
"def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url, notice: 'Shift was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluacion_servicio.destroy\n respond_to do |format|\n format.html { redirect_to evaluacion_servicios_url, notice: 'Evaluacion servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @service.delete(self)\n end",
"def del_service(wspace, address, proto, port, comm='')\n\n\t\thost = get_host(:workspace => wspace, :address => address)\n\t\treturn unless host\n\n\t\thost.services.all(:conditions => {:proto => proto, :port => port}).each { |s| s.destroy }\n\tend",
"def delete_webhook(target_url)\n Uploadcare::Webhook.delete(target_url)\n end",
"def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @called_from = params[:called_from] || \"vip_programmer\"\n @vip_programmer_certification.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_programmer_certifications_url) }\n format.xml { head :ok }\n format.js \n end\n website.add_log(user: current_user, action: \"Removed a certification from #{@vip_programmer_certification.programmer.name}\")\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end",
"def destroy\n @vip_global_region.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_global_regions_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted an amx vip global region: #{@vip_global_region.name}\")\n end",
"def destroy\n @weight_log = WeightLog.find(params[:id])\n @weight_log.destroy\n\n respond_to do |format|\n format.html { redirect_to weight_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def destroy\n @counter_service_type.destroy\n respond_to do |format|\n format.html { redirect_to counter_service_types_url, notice: 'Counter service type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Service.find(params[:id]).destroy\n flash[:success] = \"A record add been successfully deleted\"\n redirect_to services_path\n end",
"def delete\n api(\"Delete\")\n end",
"def solr_delete(solr_id)\n Solarize::Post.execute(Solr::Request::Delete.new(:id => solr_id))\n end",
"def delete_version(key, version_id)\n raise MedusaStorage::Error::UnsupportedOperation\n end",
"def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.delete_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.delete_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.delete_log_logshuttle\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#delete_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end",
"def destroy\n @measurement_log = current_account.measurement_logs.find(params[:id])\n @measurement_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurement_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end",
"def destroy\n @centricsteel = Centricsteel.find(params[:id])\n @centricsteel.destroy\n\n respond_to do |format|\n format.html { redirect_to(centricsteels_url) }\n format.xml { head :ok }\n end\n end",
"def icl_delete( args )\n prop = args.split(',')\n name = prop[0]\n date = prop[1]\n puts name + \" \" + date\n @log.delete( name, date )\n end",
"def destroy\n @service.destroy\n end",
"def destroy\n @service.destroy\n end"
] | [
"0.5703527",
"0.5683674",
"0.5658819",
"0.55562216",
"0.5527568",
"0.5518708",
"0.5513792",
"0.5468409",
"0.5467106",
"0.54336226",
"0.54132575",
"0.5393415",
"0.5388185",
"0.53835225",
"0.5351621",
"0.53490615",
"0.5311904",
"0.5309752",
"0.53036875",
"0.52970815",
"0.5288738",
"0.52885914",
"0.5287133",
"0.5275109",
"0.52740294",
"0.52609545",
"0.5245721",
"0.5243765",
"0.5243765",
"0.5243765",
"0.5243765",
"0.52425903",
"0.5235908",
"0.5212381",
"0.5211571",
"0.5201111",
"0.51902467",
"0.51873136",
"0.51872826",
"0.5179136",
"0.5177268",
"0.5161582",
"0.5158178",
"0.51554334",
"0.51516324",
"0.5150887",
"0.5144177",
"0.5126047",
"0.5124265",
"0.51189923",
"0.51062435",
"0.5102509",
"0.5102195",
"0.51016986",
"0.51005816",
"0.5096623",
"0.509282",
"0.50888693",
"0.5084825",
"0.5080233",
"0.5080233",
"0.50798315",
"0.50740707",
"0.5072009",
"0.5068807",
"0.50658745",
"0.5065129",
"0.50643665",
"0.50642335",
"0.50642",
"0.50588125",
"0.50559723",
"0.50539666",
"0.50532",
"0.5051853",
"0.5047565",
"0.50472456",
"0.5046626",
"0.50429255",
"0.5034909",
"0.50314987",
"0.5031218",
"0.50281507",
"0.5022426",
"0.50188637",
"0.50173324",
"0.5017024",
"0.50127995",
"0.5012376",
"0.50089794",
"0.5005542",
"0.50048846",
"0.50047106",
"0.50019103",
"0.5000375",
"0.4999589",
"0.4999146",
"0.49971148",
"0.49970466",
"0.49970466"
] | 0.5488694 | 7 |
Get a Scalyr log endpoint Get the Scalyr for a particular service and version. | def get_log_scalyr(opts = {})
data, _status_code, _headers = get_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_version\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}\", {\n headers: {\"Fastly-Key\" => $key}\n })\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_version(service_url)\n $tracer.trace(\"GameStopGlobalServiceFunctionsDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n return (service_url.split(\"/\")[-2].eql? \"v1\") ? nil : \"_#{service_url.split(\"/\")[-2].upcase}\"\n end",
"def get_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.get_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.get_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.get_log_scalyr\",\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: LoggingScalyrApi#get_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_log_https(opts = {})\n data, _status_code, _headers = get_log_https_with_http_info(opts)\n data\n end",
"def endpoint(environment, version, service)\n environment = environment.upcase.to_sym\n version = version.to_sym\n service = service.to_sym\n base = get_wsdl_base(environment, version)\n if !subdir_config().nil?\n base = base.to_s + subdir_config()[[version, service]].to_s\n end\n return base.to_s + version.to_s + '/'\n end",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def endpoint\n options.values_at(:endpoint, :version).join('/')\n end",
"def dcl_version(version)\n return '' if version == 'ga'\n return '/beta' if version == 'beta'\n return '/alpha' if version == 'private'\n end",
"def endpoint\n @endpoint ||= 'https://rest.avalara.net'\n end",
"def endpoint\n @endpoint ||= subclass(:Endpoint).new @locale\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_url endpoint\n url = @url\n if !url.end_with? \"/\"\n url = \"#{url}/\"\n end\n\n \"#{url}wc-api/#{@version}/#{endpoint}\"\n end",
"def service_url(svc)\n \"#{@host}#{SERVICES[svc]}\"\n end",
"def endpoint\n \"https://#{region.sub(/-\\d$/, '')}.power-iaas.cloud.ibm.com/pcloud/v1\"\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.create_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.create_log_scalyr\",\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: LoggingScalyrApi#create_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_endpoint()\n end",
"def get_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.get_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.get_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.get_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.get_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.get_log_loggly\",\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: LoggingLogglyApi#get_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def version\n endpoint.config.version\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def lws_api_get(path)\n options = {headers: solr_headers}\n response = HTTParty.get(\"#{FlareConfig.lws_api_url}#{path}\", options)\n Rails.logger.info(\"RESPONSE CODE: #{response.code}\")\n if response.code == 200\n result = JSON.parse(response.body)\n else\n nil\n end\n end",
"def endpoint\n ENDPOINT[server]\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def url\n @url || File.join(host, \"v1\")\n end",
"def get_wsdl_base(environment, version)\n wsdl_base = ENV['ADSAPI_BASE_URL']\n if wsdl_base.nil?\n wsdl_base = environment_config[environment][version]\n end\n return wsdl_base\n end",
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.update_log_scalyr\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#update_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def version\n self.class.get(\"/get/version\")\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n scheme = config[:use_ssl] ? \"https\" : \"http\"\n @service_url = \"#{scheme}://#{SERVICE_HOST}#{SERVICE_PATH}\"\n end",
"def url\n resource.url + '/services'\n end",
"def get_ws(path, &block)\n route 'GET', path, &block\n end",
"def wsdl\n log \"Retrieving WSDL from: #{@endpoint}\"\n http.endpoint @endpoint.host, @endpoint.port\n http.use_ssl = @endpoint.ssl?\n http.start { |h| h.request request(:wsdl) }\n end",
"def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def url_2_port (url)\n\t\tputs \"Retrieve service port on URL: #{url}\" if @verbose\n\t\tbegin\n\t\t\tssl = (url =~ /https/i)\n\t\t\turl = url.downcase.gsub(/(http:\\/\\/|https:\\/\\/)/, \"\")\n\t\t\trecord1 = url.split('/')\n\t\t\trecord2 = record1[0].split(':')\t\n\t\t\tif (record2.length == 2) \n\t\t\t\tputs \"The service port: #{record2[1]}\" if @verbose\n\t\t\t\treturn record2[1].to_i\n\t\t\telsif ssl\n\t\t\t\tputs \"The service port: 443\" if @verbose\n\t\t\t\treturn 443\n\t\t\telse\n\t\t\t\tputs \"The service port: 80\" if @verbose\n\t\t\t\treturn 80\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def as_collector_uri(endpoint, protocol, port, method)\n port_string = port == nil ? '' : \":#{port.to_s}\"\n path = method == 'get' ? '/i' : '/com.snowplowanalytics.snowplow/tp2'\n\n \"#{protocol}://#{endpoint}#{port_string}#{path}\"\n end",
"def service_uri\n \"#{host}#{service_path}\"\n end",
"def info id\n get(\"ssl/v1/#{id}\")\n end",
"def url\n File.join(\"https://#{service}.#{region}.amazonaws.com\", path)\n end",
"def get(url, version: nil, locale: nil)\n @client.get(url, headers: headers(version: version, locale: locale))\n end",
"def service_layer\n @sl ||= ServiceLayer.new\n end",
"def endpoint\n @endpoint||= \"#{@scheme}://#{@host}#{@path}\"\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def api_path(path)\n \"/services/data/v#{@options[:api_version]}/#{path}\"\n end",
"def endpoint\n \"https://#{@host}:#{@port}/wsman\"\n end",
"def get_api endpoint\n\turi = URI.parse(\"http://#{@HOST}:#{@HTTP}#{endpoint}\")\n\trequest = Net::HTTP::Get.new(uri)\n\trequest[\"Accept\"] = \"application/json\"\n\toptions = { use_ssl: uri.scheme == \"https\" }\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, options) do |http|\n\t\thttp.request(request)\n\tend\nend",
"def endpoint\n @endpoint ||= \"https://#{@subdomain}.desk.com\"\n end",
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end",
"def get(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :GET)\n end",
"def list_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.list_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.list_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.list_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogglyResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.list_log_loggly\",\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: LoggingLogglyApi#list_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def slf4j\n unavailability_error = Internal::Logging::Slf4jLogging.check_availability\n\n raise unavailability_error unless unavailability_error.nil?\n\n Slf4jLogging.new\n end",
"def path(version)\n path_lookup_util(version)\n end",
"def path(version)\n path_lookup_util(version)\n end",
"def service\n URI.parse(@config.split('<')[0].split('->')[1])\n end",
"def service\n Googlecal::Base.service\n end",
"def get_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.get_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.get_log_logshuttle\",\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: LoggingLogshuttleApi#get_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def get_name\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", {\n headers: {\"Fastly-Key\" => $key} \n })\n end",
"def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end",
"def get_wsdl_file_name(version_name, service)\n File.join(WSDLDIR, version_name, service) + '.wsdl'\nend",
"def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end",
"def url\n 'https://' + request.host\n end",
"def logger\n Simp::Cli::Logging.logger\n end",
"def service_name; end",
"def lic_path\n @lic_path ||= Pathname.new(configured_lic_path.path).expand_path(root)\n end",
"def api_endpoint\n Solusvm.api_endpoint.dup\n end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def ssl_version; end",
"def ssl_version; end",
"def service\n if origin_url =~ /github/i\n 'github'\n elsif origin_url =~ /bitbucket/i\n 'bitbucket'\n elsif origin_url =~ /stash/i\n 'stash'\n else\n ''\n end\n end",
"def get_service_name\n\t\t\t\traise \"Should return the a service name from config.wsdl keys\"\n\t\t\tend",
"def service_require\n ruby_file_path @api, service_name_full\n end",
"def create_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.create_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.create_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.create_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.create_log_loggly\",\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: LoggingLogglyApi#create_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def url\n if @service_url.nil?\n @service_url = @protocol + '://' + @host + '/' +\n (@path_prefix.empty? ? '' : (@path_prefix + '/')) + @key + '/'\n end\n @service_url\n end",
"def vsVersion service\r\n slnFile = Util.getSln(service)\r\n while line = slnFile.readline\r\n return line[/Visual Studio \\d{4}/] if line =~ /Visual Studio \\d{4}/\r\n end\r\n #version = slnFile.readline.chomp\r\n #return version[2..-1]\r\nend",
"def version\n @version ||= @doc.at('/document/@SSLyzeVersion').value.split(' ',2).last\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def load_log(log_id)\n service.get log_path(log_id)\n end",
"def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end",
"def get url, options={}\n options.merge!({:v => Time.now.strftime(\"%Y%m%d\")}) unless options[:v]\n response = self.class.get(url, {:query => options}).parsed_response\n if response[\"meta\"][\"code\"] == 200\n return response\n else\n raise Foursquared::Error.new(response[\"meta\"])\n end\n end",
"def log\n @client.get(\"#{path}/log\")\n end",
"def statsd_base_path\n \"rpc-client.#{service}.#{method_name}\".gsub('::', '.').downcase\n end",
"def getApiEndpoint(endpoint)\n \n apiRegion = $drugbank_region\n\n if $drugbank_region != \"\"\n apiRegion = apiRegion + \"/\"\n end\n\n return apiRegion + endpoint\n\nend",
"def celluloid_logger_class\n if version_less_than_seventeen?\n Celluloid::Logger\n else\n Celluloid::Internals::Logger\n end\n end",
"def api_base_path\n \"/lol/platform/#{api_version}\"\n end",
"def solve_wsdl_url\n\t\t\t\tconfig = BingAdsApi::Config.instance\n\t\t\t\treturn config.service_wsdl(environment, get_service_name)\n\t\t\tend",
"def client\n @client ||= Librato::Metrics.client\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n host = SERVICE_HOSTS[config[:region]] || SERVICE_HOSTS[:uk]\n @service_url = \"http://#{host}:#{SERVICE_PORT}#{SERVICE_PATH}\"\n end",
"def get(endpoint)\n client.get(endpoint)\n end",
"def get(endpoint)\n client.get(endpoint)\n end",
"def get(endpoint)\n client.get(endpoint)\n end"
] | [
"0.55771446",
"0.5432487",
"0.53849286",
"0.5372218",
"0.5253202",
"0.5244251",
"0.5240086",
"0.50535065",
"0.5050574",
"0.50390047",
"0.5026841",
"0.5006919",
"0.49907407",
"0.49870592",
"0.49691752",
"0.49521002",
"0.49236965",
"0.49083978",
"0.49076948",
"0.4865271",
"0.484496",
"0.4837121",
"0.48338863",
"0.48338863",
"0.4803588",
"0.47274545",
"0.47000974",
"0.46978176",
"0.46864638",
"0.46801513",
"0.46784943",
"0.4675048",
"0.4670617",
"0.46446133",
"0.46417105",
"0.46397805",
"0.4637825",
"0.4627903",
"0.46132013",
"0.46127018",
"0.46112636",
"0.4593528",
"0.45912954",
"0.45820192",
"0.45787868",
"0.45698726",
"0.4567283",
"0.4567283",
"0.4553051",
"0.4550025",
"0.454931",
"0.45393938",
"0.453296",
"0.45305425",
"0.4527963",
"0.45082617",
"0.4501182",
"0.45010835",
"0.45010835",
"0.44953236",
"0.44869843",
"0.44835743",
"0.44717896",
"0.44717896",
"0.44717896",
"0.44717667",
"0.44682556",
"0.4462475",
"0.44590718",
"0.44583142",
"0.44501358",
"0.44421306",
"0.4426554",
"0.44251978",
"0.4423648",
"0.44231147",
"0.44231147",
"0.44142237",
"0.44131696",
"0.44119412",
"0.44053477",
"0.43998307",
"0.43990284",
"0.4393307",
"0.4392252",
"0.43880525",
"0.43854392",
"0.4382712",
"0.43809584",
"0.4378593",
"0.4377254",
"0.43755928",
"0.4374641",
"0.4370166",
"0.43655157",
"0.43550324",
"0.43538994",
"0.4351162",
"0.4351162",
"0.4351162"
] | 0.4873481 | 19 |
Get a Scalyr log endpoint Get the Scalyr for a particular service and version. | def get_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.get_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
logging_scalyr_name = opts[:'logging_scalyr_name']
# verify the required parameter 'service_id' is set
if @api_client.config.client_side_validation && service_id.nil?
fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.get_log_scalyr"
end
# verify the required parameter 'version_id' is set
if @api_client.config.client_side_validation && version_id.nil?
fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.get_log_scalyr"
end
# verify the required parameter 'logging_scalyr_name' is set
if @api_client.config.client_side_validation && logging_scalyr_name.nil?
fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.get_log_scalyr"
end
# resource path
local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'
# auth_names
auth_names = opts[:debug_auth_names] || ['token']
new_options = opts.merge(
:operation => :"LoggingScalyrApi.get_log_scalyr",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: LoggingScalyrApi#get_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_version\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}\", {\n headers: {\"Fastly-Key\" => $key}\n })\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_version(service_url)\n $tracer.trace(\"GameStopGlobalServiceFunctionsDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n return (service_url.split(\"/\")[-2].eql? \"v1\") ? nil : \"_#{service_url.split(\"/\")[-2].upcase}\"\n end",
"def endpoint(environment, version, service)\n environment = environment.upcase.to_sym\n version = version.to_sym\n service = service.to_sym\n base = get_wsdl_base(environment, version)\n if !subdir_config().nil?\n base = base.to_s + subdir_config()[[version, service]].to_s\n end\n return base.to_s + version.to_s + '/'\n end",
"def get_log_https(opts = {})\n data, _status_code, _headers = get_log_https_with_http_info(opts)\n data\n end",
"def endpoint\n options.values_at(:endpoint, :version).join('/')\n end",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def dcl_version(version)\n return '' if version == 'ga'\n return '/beta' if version == 'beta'\n return '/alpha' if version == 'private'\n end",
"def endpoint\n @endpoint ||= 'https://rest.avalara.net'\n end",
"def endpoint\n @endpoint ||= subclass(:Endpoint).new @locale\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_url endpoint\n url = @url\n if !url.end_with? \"/\"\n url = \"#{url}/\"\n end\n\n \"#{url}wc-api/#{@version}/#{endpoint}\"\n end",
"def service_url(svc)\n \"#{@host}#{SERVICES[svc]}\"\n end",
"def endpoint\n \"https://#{region.sub(/-\\d$/, '')}.power-iaas.cloud.ibm.com/pcloud/v1\"\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.create_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.create_log_scalyr\",\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: LoggingScalyrApi#create_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_log_scalyr(opts = {})\n data, _status_code, _headers = get_log_scalyr_with_http_info(opts)\n data\n end",
"def get_endpoint()\n end",
"def get_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.get_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.get_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.get_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.get_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.get_log_loggly\",\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: LoggingLogglyApi#get_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def version\n endpoint.config.version\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def lws_api_get(path)\n options = {headers: solr_headers}\n response = HTTParty.get(\"#{FlareConfig.lws_api_url}#{path}\", options)\n Rails.logger.info(\"RESPONSE CODE: #{response.code}\")\n if response.code == 200\n result = JSON.parse(response.body)\n else\n nil\n end\n end",
"def endpoint\n ENDPOINT[server]\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def url\n @url || File.join(host, \"v1\")\n end",
"def get_wsdl_base(environment, version)\n wsdl_base = ENV['ADSAPI_BASE_URL']\n if wsdl_base.nil?\n wsdl_base = environment_config[environment][version]\n end\n return wsdl_base\n end",
"def version\n self.class.get(\"/get/version\")\n end",
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.update_log_scalyr\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#update_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(logger = nil, config = {})\n super(logger)\n @config = config.dup\n \n scheme = config[:use_ssl] ? \"https\" : \"http\"\n @service_url = \"#{scheme}://#{SERVICE_HOST}#{SERVICE_PATH}\"\n end",
"def url\n resource.url + '/services'\n end",
"def get_ws(path, &block)\n route 'GET', path, &block\n end",
"def wsdl\n log \"Retrieving WSDL from: #{@endpoint}\"\n http.endpoint @endpoint.host, @endpoint.port\n http.use_ssl = @endpoint.ssl?\n http.start { |h| h.request request(:wsdl) }\n end",
"def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def url_2_port (url)\n\t\tputs \"Retrieve service port on URL: #{url}\" if @verbose\n\t\tbegin\n\t\t\tssl = (url =~ /https/i)\n\t\t\turl = url.downcase.gsub(/(http:\\/\\/|https:\\/\\/)/, \"\")\n\t\t\trecord1 = url.split('/')\n\t\t\trecord2 = record1[0].split(':')\t\n\t\t\tif (record2.length == 2) \n\t\t\t\tputs \"The service port: #{record2[1]}\" if @verbose\n\t\t\t\treturn record2[1].to_i\n\t\t\telsif ssl\n\t\t\t\tputs \"The service port: 443\" if @verbose\n\t\t\t\treturn 443\n\t\t\telse\n\t\t\t\tputs \"The service port: 80\" if @verbose\n\t\t\t\treturn 80\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def as_collector_uri(endpoint, protocol, port, method)\n port_string = port == nil ? '' : \":#{port.to_s}\"\n path = method == 'get' ? '/i' : '/com.snowplowanalytics.snowplow/tp2'\n\n \"#{protocol}://#{endpoint}#{port_string}#{path}\"\n end",
"def service_uri\n \"#{host}#{service_path}\"\n end",
"def info id\n get(\"ssl/v1/#{id}\")\n end",
"def url\n File.join(\"https://#{service}.#{region}.amazonaws.com\", path)\n end",
"def get(url, version: nil, locale: nil)\n @client.get(url, headers: headers(version: version, locale: locale))\n end",
"def endpoint\n @endpoint||= \"#{@scheme}://#{@host}#{@path}\"\n end",
"def service_layer\n @sl ||= ServiceLayer.new\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def api_path(path)\n \"/services/data/v#{@options[:api_version]}/#{path}\"\n end",
"def get_api endpoint\n\turi = URI.parse(\"http://#{@HOST}:#{@HTTP}#{endpoint}\")\n\trequest = Net::HTTP::Get.new(uri)\n\trequest[\"Accept\"] = \"application/json\"\n\toptions = { use_ssl: uri.scheme == \"https\" }\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, options) do |http|\n\t\thttp.request(request)\n\tend\nend",
"def endpoint\n \"https://#{@host}:#{@port}/wsman\"\n end",
"def endpoint\n @endpoint ||= \"https://#{@subdomain}.desk.com\"\n end",
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def get(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :GET)\n end",
"def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end",
"def list_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.list_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.list_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.list_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogglyResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.list_log_loggly\",\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: LoggingLogglyApi#list_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def path(version)\n path_lookup_util(version)\n end",
"def path(version)\n path_lookup_util(version)\n end",
"def slf4j\n unavailability_error = Internal::Logging::Slf4jLogging.check_availability\n\n raise unavailability_error unless unavailability_error.nil?\n\n Slf4jLogging.new\n end",
"def service\n URI.parse(@config.split('<')[0].split('->')[1])\n end",
"def service\n Googlecal::Base.service\n end",
"def get_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.get_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.get_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.get_log_logshuttle\",\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: LoggingLogshuttleApi#get_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def get_name\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", {\n headers: {\"Fastly-Key\" => $key} \n })\n end",
"def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end",
"def get_wsdl_file_name(version_name, service)\n File.join(WSDLDIR, version_name, service) + '.wsdl'\nend",
"def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end",
"def url\n 'https://' + request.host\n end",
"def logger\n Simp::Cli::Logging.logger\n end",
"def service_name; end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def api_endpoint\n Solusvm.api_endpoint.dup\n end",
"def lic_path\n @lic_path ||= Pathname.new(configured_lic_path.path).expand_path(root)\n end",
"def ssl_version; end",
"def ssl_version; end",
"def service\n if origin_url =~ /github/i\n 'github'\n elsif origin_url =~ /bitbucket/i\n 'bitbucket'\n elsif origin_url =~ /stash/i\n 'stash'\n else\n ''\n end\n end",
"def get_service_name\n\t\t\t\traise \"Should return the a service name from config.wsdl keys\"\n\t\t\tend",
"def service_require\n ruby_file_path @api, service_name_full\n end",
"def create_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.create_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.create_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.create_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.create_log_loggly\",\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: LoggingLogglyApi#create_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def url\n if @service_url.nil?\n @service_url = @protocol + '://' + @host + '/' +\n (@path_prefix.empty? ? '' : (@path_prefix + '/')) + @key + '/'\n end\n @service_url\n end",
"def vsVersion service\r\n slnFile = Util.getSln(service)\r\n while line = slnFile.readline\r\n return line[/Visual Studio \\d{4}/] if line =~ /Visual Studio \\d{4}/\r\n end\r\n #version = slnFile.readline.chomp\r\n #return version[2..-1]\r\nend",
"def version\n @version ||= @doc.at('/document/@SSLyzeVersion').value.split(' ',2).last\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def load_log(log_id)\n service.get log_path(log_id)\n end",
"def get url, options={}\n options.merge!({:v => Time.now.strftime(\"%Y%m%d\")}) unless options[:v]\n response = self.class.get(url, {:query => options}).parsed_response\n if response[\"meta\"][\"code\"] == 200\n return response\n else\n raise Foursquared::Error.new(response[\"meta\"])\n end\n end",
"def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end",
"def statsd_base_path\n \"rpc-client.#{service}.#{method_name}\".gsub('::', '.').downcase\n end",
"def getApiEndpoint(endpoint)\n \n apiRegion = $drugbank_region\n\n if $drugbank_region != \"\"\n apiRegion = apiRegion + \"/\"\n end\n\n return apiRegion + endpoint\n\nend",
"def log\n @client.get(\"#{path}/log\")\n end",
"def celluloid_logger_class\n if version_less_than_seventeen?\n Celluloid::Logger\n else\n Celluloid::Internals::Logger\n end\n end",
"def api_base_path\n \"/lol/platform/#{api_version}\"\n end",
"def solve_wsdl_url\n\t\t\t\tconfig = BingAdsApi::Config.instance\n\t\t\t\treturn config.service_wsdl(environment, get_service_name)\n\t\t\tend",
"def client\n @client ||= Librato::Metrics.client\n end",
"def get(endpoint)\n client.get(endpoint)\n end",
"def get(endpoint)\n client.get(endpoint)\n end",
"def get(endpoint)\n client.get(endpoint)\n end",
"def get_version\n request('getVersion')\n end"
] | [
"0.5576281",
"0.5435715",
"0.5384254",
"0.53750974",
"0.52446705",
"0.52416587",
"0.50547034",
"0.5053162",
"0.50430775",
"0.502756",
"0.5007228",
"0.4989312",
"0.49864239",
"0.49718893",
"0.49535483",
"0.49224108",
"0.49073228",
"0.4905907",
"0.48698628",
"0.48670986",
"0.4844335",
"0.48417854",
"0.4834651",
"0.4834651",
"0.4802337",
"0.47290114",
"0.4701271",
"0.46998",
"0.46902105",
"0.46811816",
"0.46783563",
"0.46732754",
"0.46714967",
"0.46450198",
"0.46427074",
"0.46414295",
"0.46377322",
"0.4627575",
"0.46142438",
"0.4613787",
"0.46105954",
"0.4593188",
"0.4592612",
"0.45803484",
"0.4580275",
"0.45689052",
"0.4568602",
"0.4568602",
"0.45540392",
"0.4550629",
"0.45492354",
"0.4540036",
"0.45327666",
"0.4531326",
"0.45306525",
"0.4507961",
"0.4504384",
"0.4504384",
"0.4500871",
"0.44979453",
"0.44862282",
"0.4483522",
"0.44733074",
"0.44733074",
"0.44733074",
"0.44722077",
"0.44708523",
"0.44651365",
"0.44583115",
"0.4457165",
"0.44476718",
"0.44420516",
"0.4426114",
"0.44256485",
"0.44254592",
"0.4423748",
"0.4423748",
"0.44154215",
"0.44139904",
"0.44124484",
"0.4404755",
"0.4401092",
"0.44009593",
"0.43961492",
"0.43921039",
"0.4388761",
"0.4384188",
"0.43811253",
"0.4379976",
"0.43776175",
"0.43770802",
"0.4376863",
"0.43723878",
"0.43707755",
"0.43662727",
"0.43547875",
"0.43531415",
"0.43531415",
"0.43531415",
"0.43528005"
] | 0.5251684 | 4 |
List Scalyr log endpoints List all of the Scalyrs for a particular service and version. | def list_log_scalyr(opts = {})
data, _status_code, _headers = list_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints_list\n get \"endpoints\"\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"def list(options={})\n Mailgun.submit(:get, log_url, options)\n end",
"def endpoints\n @endpoints ||= []\n end",
"def endpoints; end",
"def endpoints\n unless @endpoints_collected\n @endpoints += get_missing(\"endpoints\")\n @endpoints_collected = true\n end\n\n @endpoints\n end",
"def list\n Requests::ListAppLocations.new.\n send_to_api(:get, endpoint_path(:v14))\n end",
"def endpoints\n EndpointRegistry[id]\n end",
"def index\n @endpoints = @project.endpoints.all\n end",
"def endpoints\n @endpoints ||= init_endpoints\n end",
"def list\n websites = @logs.records\n @view.show(websites)\n end",
"def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_list\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end",
"def index\n @webhook_endpoints = WebhookEndpoint.all\n end",
"def list_aws_logs_services_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsIntegrationAPI.list_aws_logs_services ...'\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/logs/services'\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] || 'Array<AWSLogsListServicesResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_aws_logs_services,\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: AWSLogsIntegrationAPI#list_aws_logs_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end",
"def list_endpoints 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_endpoints_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::ServiceDirectory::V1beta1::ListEndpointsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def services(version)\n service_config[version]\n end",
"def index\n @listens = Listen.all\n end",
"def get_endpoints\n response = @client.rest_get(@data['uri'] + '/endpoints')\n @client.response_handler(response)['members']\n end",
"def index\n @ncr_api_logs = NcrApiLog.all\n end",
"def list_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.list_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.list_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.list_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogglyResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.list_log_loggly\",\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: LoggingLogglyApi#list_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list\n get('/')\n end",
"def index\n @serves = Serve.all\n end",
"def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend",
"def stops\n get '/gtfs/stops'\n end",
"def get_endpoints\n endpoints = call(CMD_GET_ENDPOINTS)[:endpoints]\n endpoints.map {|endpoint| Endpoint.new(endpoint) }\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end",
"def list(service_sid: :unset, before_start_time: :unset, after_start_time: :unset, before_date_created: :unset, after_date_created: :unset, status: :unset, language_code: :unset, source_sid: :unset, limit: nil, page_size: nil)\n self.stream(\n service_sid: service_sid,\n before_start_time: before_start_time,\n after_start_time: after_start_time,\n before_date_created: before_date_created,\n after_date_created: after_date_created,\n status: status,\n language_code: language_code,\n source_sid: source_sid,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def versions\n service_config.keys\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"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 endpoints=(value)\n generate_endpoint_methods(value)\n @endpoints = value\n end",
"def init_endpoints\n endpoints = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_vpc_endpoints({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n endpoints << response.vpc_endpoints\n end\n\n endpoints.flatten\n end",
"def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end",
"def endpoints\n object.endpoints.map { |e| e.id }\n end",
"def get_endpoints(token = nil)\n if token.nil?\n return get_request(address(\"/endpoints\"), token())\n else\n return get_request(address(\"/tokens/#{token}/endpoints\"), token())\n end\n end",
"def all\n api_get(path)\n end",
"def incrementally_list_servers(offset=nil, limit=nil, opts={}, &block)\n incrementally_list_resources(:get, detailed_path(\"/servers\", opts), offset, limit, opts, &block)\n end",
"def list\n call(:get, path)\n end",
"def list_liveservers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.to_a\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n @exchange_product_price_logs = ExchangeProductPriceLog.all\n end",
"def versions(resource_uri, format = \"text/turtle\")\n log \"versions for #{resource_uri}\"\n get \"#{resource_uri}/fcr:versions\", format\n end",
"def set_endpoints\n @endpoints = Endpoint.where('client_tag like ?', \"%#{params[:client_tag]}%\")\n .where('name like ?', \"%#{params[:request_name]}%\")\n end",
"def list_aws_logs_integrations_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsIntegrationAPI.list_aws_logs_integrations ...'\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/logs'\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] || 'Array<AWSLogsListResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_aws_logs_integrations,\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: AWSLogsIntegrationAPI#list_aws_logs_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_endpoints\n endpoints = @cache.endpoints || []\n endpoints.empty? ? @fallbacks : endpoints\n end",
"def list_all_webhook_subscription_for_tool_proxy(opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end",
"def list_services\n @services\n end",
"def endpoint\n options.values_at(:endpoint, :version).join('/')\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def list_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.list_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogshuttleApi.list_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.list_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogshuttleResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.list_log_logshuttle\",\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: LoggingLogshuttleApi#list_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def slapd_listen_urls\n urls = []\n\n (use_ldap, use_ldaps) = use_ldap_or_ldaps?(node['ca_openldap']['tls']['enable'].to_sym)\n ldap_port = node['ca_openldap']['default_ports']['ldap']\n ldaps_port = node['ca_openldap']['default_ports']['ldaps']\n\n urls << \"ldapi:///\" if node['ca_openldap']['enable_ldapi']\n\n if use_ldap == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldap://#{ listen_adress }:#{ ldap_port }\"\n end\n end\n\n if use_ldaps == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldaps://#{ listen_adress }:#{ ldaps_port }\"\n end\n end\n\n urls.join \" \"\n end",
"def index\n @el_sockets = ElSocket.all\n end",
"def index\n @el_sockets = ElSocket.all\n end",
"def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend",
"def index\n @service_lists = ServiceList.all\n end",
"def index\n @counter_services = CounterService.all\n end",
"def index\n @vlogs = Vlog.all\n end",
"def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"def list\n Puppet::SSL::Certificate.search(\"*\").collect { |c| c.name }\n end",
"def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\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(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all(filters = {})\n data = service.list_servers.body['data']\n load(data)\n end",
"def list_methods\n API_METHODS.values.flatten\n end",
"def public_endpoints\n\t\t\t@endpoints.select {|e| e.public_port_name != nil}\n\t\tend",
"def sorted_endpoints\n endpoints = self.class.endpoints.values.flatten\n\n endpoints.sort do |x,y|\n \"#{x.path} #{x.http_method}\" <=> \"#{y.path} #{y.http_method}\"\n end\n end",
"def list_aws_logs_services(opts = {})\n data, _status_code, _headers = list_aws_logs_services_with_http_info(opts)\n data\n end",
"def list\n cert_list(certstore_handler)\n end",
"def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def listserv\n listservs.first\n end",
"def gather_endpoints_to_check\n Rails.application.routes.routes.map do |route|\n verb = route.verb.downcase.to_sym\n example_path = route.path.spec\n .to_s.gsub('(.:format)', '')\n .gsub(/:([^\\/]+)/,'SOME_PLACEHOLDER_PARAM')\n .gsub('*path', 'SOME_PLACEHOLDER_PATH')\n .gsub('*filename','SOME_PLACEHOLDER_FILENAME')\n next unless verb.present?\n [verb, example_path]\n end.compact\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def resource_sapi_list\n if new_resource.php_sapi.include?('ALL') then sapi_list\n elsif supports_php5query? then new_resource.php_sapi\n else Array.new\n end\n end",
"def index\n @port_services = PortService.all\n end",
"def services\n output = riak_admin 'services'\n if $?.success?\n output.strip.match(/^\\[(.*)\\]$/)[1].split(/,/)\n else\n []\n end\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def dcerpc_endpoint_list\n\t\tres = []\n\n\t\tprint_status(\"Connecting to the endpoint mapper service...\")\n\t\tbegin\n\t\t\teps = nil\n\t\t\tdport = nil\n\n\t\t\t[135, 593].each do |i|\n\t\t\t\tdport = i\n\t\t\t\tbegin\n\t\t\t\t\teps = Rex::Socket::Tcp.create(\n\t\t\t\t\t'PeerHost' => rhost,\n\t\t\t\t\t'PeerPort' => dport,\n\t\t\t\t\t'Proxies' => proxies,\n\t\t\t\t\t'Context' =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Msf' => framework,\n\t\t\t\t\t\t\t'MsfExploit' => self,\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\n\t\t\t\t\tbreak\n\n\t\t\t\trescue ::Exception\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif (not eps)\n\t\t\t\tprint_status(\"Could not connect to the endpoint mapper service\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\teph = dcerpc_handle('e1af8308-5d1f-11c9-91a4-08002b14a0fa', '3.0', 'ncacn_ip_tcp', [dport])\n\t\t\topt = { 'Msf' => framework, 'MsfExploit' => self }\n\t\t\tdce = Rex::Proto::DCERPC::Client.new(eph, eps, opt)\n\n\t\t\thnd = nil\n\n\t\t\twhile(true)\n\n\t\t\t\t# Placeholders\n\t\t\t\tinfo =\n\t\t\t\t{\n\t\t\t\t\t:type => nil,\n\t\t\t\t\t:port => nil,\n\t\t\t\t\t:host => nil,\n\t\t\t\t\t:pipe => nil,\n\t\t\t\t\t:prot => nil,\n\t\t\t\t\t:uuid => nil,\n\t\t\t\t\t:vers => nil,\n\t\t\t\t\t:note => nil\n\t\t\t\t}\n\n\t\t\t\tdata = nil\n\n\t\t\t\tif(not hnd)\n\t\t\t\t\t# NULL handle to start with\n\t\t\t\t\tdata = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1].pack(\"V*\")\n\t\t\t\telse\n\t\t\t\t\t# Use the existing handle\n\t\t\t\t\tdata = [0, 0, 0, 0, 0].pack(\"V*\") + hnd\n\t\t\t\tend\n\n\t\t\t\tret = dce.call(2, data)\n\n\t\t\t\tif (\n\t\t\t\t\tdce.last_response == nil or\n\t\t\t\t\tdce.last_response.stub_data == nil or\n\t\t\t\t\tdce.last_response.stub_data.length < 40 or\n\t\t\t\t\tdce.last_response.stub_data[36,4] == \"\\xd6\\xa0\\xc9\\x16\"\n\t\t\t\t)\n\t\t\t\t\t# break from the parsing loop\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\t# Record the response data\n\t\t\t\tbuf = dce.last_response.stub_data\n\n\t\t\t\t# Record the handle if needed\n\t\t\t\thnd = buf[4, 20] if not hnd\n\n\t\t\t\t# Parse the response data\n\t\t\t\tnlen = buf[60, 4].unpack('V')[0]\n\t\t\t\tif (nlen > 1)\n\t\t\t\t\tinfo[:note] = buf[64, nlen - 1]\n\t\t\t\tend\n\n\t\t\t\t# Align the stub offset\n\t\t\t\tsoff = nlen + 72\n\t\t\t\twhile (soff % 4 != 0)\n\t\t\t\t\tsoff += 1\n\t\t\t\tend\n\n\t\t\t\t# Determine number of records\n\t\t\t\trcnt = buf[soff, 2].unpack('v')[0]\n\t\t\t\tsoff += 2\n\n\t\t\t\t# Parse the data from the stack\n\t\t\t\t1.upto(rcnt) do |i|\n\t\t\t\t\trlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tif (i == 1)\n\t\t\t\t\t\tinfo[:uuid] = Rex::Proto::DCERPC::UUID.uuid_unpack(buf[soff+1, 16])\n\t\t\t\t\t\tinfo[:vers] = buf[soff+17,2].unpack('CC').map{|s| s.to_s}.join(\".\")\n\t\t\t\t\tend\n\n\t\t\t\t\tif (i > 3)\n\t\t\t\t\t\tinfo[:type] = buf[soff, 1].unpack(\"C*\")[0]\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += rlen\n\n\t\t\t\t\txlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tcase info[:type]\n\t\t\t\t\twhen nil\n\n\t\t\t\t\t# TCP\n\t\t\t\t\twhen 7\n\t\t\t\t\t\tinfo[:prot] = 'tcp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# UDP\n\t\t\t\t\twhen 8\n\t\t\t\t\t\tinfo[:prot] = 'udp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# ADDR\n\t\t\t\t\twhen 9\n\t\t\t\t\t\tinfo[:host] = buf[soff, 4].unpack('C4').join('.')\n\n\t\t\t\t\t# PIPE\n\t\t\t\t\twhen 15\n\t\t\t\t\t\tinfo[:prot] = 'pipe'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# LRPC\n\t\t\t\t\twhen 16\n\t\t\t\t\t\tinfo[:prot] = 'lrpc'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# NETBIOS\n\t\t\t\t\twhen 17,24\n\t\t\t\t\t\tinfo[:host] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# HTTP\n\t\t\t\t\twhen 31\n\t\t\t\t\t\tinfo[:prot] = 'http'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# DYNAMIC?\n\t\t\t\t\twhen 22\n\t\t\t\t\t\t# not parsed\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_status(\"EPM unknown type: #{info[:type]} #{buf[soff, xlen].unpack(\"H*\")[0]}\")\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += xlen\n\t\t\t\tend\n\n\t\t\t\tinfo[:pipe].gsub!(\"\\x00\", '') if info[:pipe]\n\t\t\t\tinfo[:host].gsub!(\"\\x00\", '') if info[:host]\n\n\t\t\t\tres << info\n\t\t\tend\n\n\t\trescue ::Interrupt\n\t\t\traise $!\n\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Could not obtain the endpoint list: #{e}\")\n\t\t\tres = nil\n\t\tend\n\n\t\tres\n\tend",
"def index\n @rate_services = RateService.all\n end",
"def index\n @request_services = RequestService.all\n end",
"def index\n @log_load_times = LogLoadTime.all\n end",
"def index\n @config_logs = ConfigLog.all\n end",
"def index\n @vices = Vice.all\n end",
"def supported_services_table\n\n line = \"| %-35s | %-25s | %-30s |\\n\"\n\n lines = []\n Aws::SERVICE_MODULE_NAMES.each do |svc_name|\n client_class = Aws.const_get(svc_name).const_get(:Client)\n full_name = client_class.api.metadata('serviceFullName')\n version = client_class.api.version\n lines << line % [full_name, svc_name, version]\n end\n\n [\n \"\\n\",\n line % ['Service Name', 'Service Class', 'API Versions'],\n line % ['-' * 35, '-' * 25, '-' * 30],\n lines.sort_by(&:downcase),\n \"\\n\",\n ]\nend",
"def index\n @logs = Log.all\n end",
"def index\n @servers = @site.servers\n end",
"def list\n get(uri: '/webhooks/')\n end",
"def list_log_loggly(opts = {})\n data, _status_code, _headers = list_log_loggly_with_http_info(opts)\n data\n end",
"def index\n @servings = Serving.all\n end",
"def parse_endpoints(config)\n endpoints = get_key(config,'endpoints').map do |endpoint|\n parse_endpoint(endpoint)\n end\n return endpoints\n end",
"def list(conference_sid: :unset, friendly_name: :unset, status: :unset, created_after: :unset, created_before: :unset, mixer_region: :unset, tags: :unset, subaccount: :unset, detected_issues: :unset, end_reason: :unset, limit: nil, page_size: nil)\n self.stream(\n conference_sid: conference_sid,\n friendly_name: friendly_name,\n status: status,\n created_after: created_after,\n created_before: created_before,\n mixer_region: mixer_region,\n tags: tags,\n subaccount: subaccount,\n detected_issues: detected_issues,\n end_reason: end_reason,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def list_http_proxy_paths\n $logger.info(\"Checking routes for gear #{@uuid} of application #{@app.name}\")\n frontend = OpenShift::Runtime::FrontendHttpServer.new(OpenShift::Runtime::ApplicationContainer.from_uuid(@uuid))\n Hash[*frontend.connections.map { |path, uri, opts| [path, [uri, opts ] ] }.flatten(1)]\n end",
"def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages/{id}/status',\n 'method' => 'PUT',\n 'purpose' => 'Updates the status of a Package {\"status\": \"active\" / \"inactive\"} as valid json payloads'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end"
] | [
"0.65161127",
"0.59915936",
"0.5950381",
"0.58432287",
"0.5680225",
"0.5652868",
"0.5615075",
"0.5574693",
"0.54408336",
"0.54379296",
"0.54240924",
"0.54033995",
"0.5344667",
"0.53297365",
"0.53180766",
"0.5310362",
"0.5276899",
"0.5261508",
"0.52352315",
"0.5195188",
"0.5186559",
"0.51732355",
"0.5147543",
"0.51028466",
"0.5074248",
"0.5039468",
"0.50377107",
"0.5033341",
"0.4998402",
"0.49802536",
"0.49672228",
"0.49637157",
"0.4961299",
"0.49598166",
"0.49549517",
"0.49349478",
"0.49296346",
"0.49145344",
"0.49091774",
"0.49014905",
"0.48931518",
"0.48867658",
"0.48696256",
"0.48595884",
"0.4845476",
"0.48393786",
"0.4835819",
"0.4830279",
"0.48276803",
"0.4827514",
"0.4821747",
"0.48168334",
"0.48106372",
"0.48092774",
"0.4807812",
"0.48030362",
"0.47990835",
"0.4797044",
"0.47925806",
"0.47925806",
"0.47903332",
"0.478971",
"0.47777912",
"0.477695",
"0.4772697",
"0.47725993",
"0.47654858",
"0.47631505",
"0.47604895",
"0.4759594",
"0.47569418",
"0.47563496",
"0.4750245",
"0.4749513",
"0.47366568",
"0.47268862",
"0.4724282",
"0.47219127",
"0.47219127",
"0.4711358",
"0.4704147",
"0.4679458",
"0.46748403",
"0.46739382",
"0.4673849",
"0.4670799",
"0.46658483",
"0.46655667",
"0.46650767",
"0.46614423",
"0.46609628",
"0.4653702",
"0.4652382",
"0.46478406",
"0.46475446",
"0.46469113",
"0.46421787",
"0.46374542",
"0.4637034",
"0.4636158"
] | 0.5057228 | 25 |
List Scalyr log endpoints List all of the Scalyrs for a particular service and version. | def list_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
# verify the required parameter 'service_id' is set
if @api_client.config.client_side_validation && service_id.nil?
fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.list_log_scalyr"
end
# verify the required parameter 'version_id' is set
if @api_client.config.client_side_validation && version_id.nil?
fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr"
end
# resource path
local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'
# auth_names
auth_names = opts[:debug_auth_names] || ['token']
new_options = opts.merge(
:operation => :"LoggingScalyrApi.list_log_scalyr",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: LoggingScalyrApi#list_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints_list\n get \"endpoints\"\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"def list(options={})\n Mailgun.submit(:get, log_url, options)\n end",
"def endpoints\n @endpoints ||= []\n end",
"def endpoints; end",
"def endpoints\n unless @endpoints_collected\n @endpoints += get_missing(\"endpoints\")\n @endpoints_collected = true\n end\n\n @endpoints\n end",
"def list\n Requests::ListAppLocations.new.\n send_to_api(:get, endpoint_path(:v14))\n end",
"def endpoints\n EndpointRegistry[id]\n end",
"def index\n @endpoints = @project.endpoints.all\n end",
"def endpoints\n @endpoints ||= init_endpoints\n end",
"def list\n websites = @logs.records\n @view.show(websites)\n end",
"def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def service_list\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end",
"def index\n @webhook_endpoints = WebhookEndpoint.all\n end",
"def list_aws_logs_services_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsIntegrationAPI.list_aws_logs_services ...'\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/logs/services'\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] || 'Array<AWSLogsListServicesResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_aws_logs_services,\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: AWSLogsIntegrationAPI#list_aws_logs_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end",
"def list_endpoints 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_endpoints_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::ServiceDirectory::V1beta1::ListEndpointsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def services(version)\n service_config[version]\n end",
"def index\n @listens = Listen.all\n end",
"def get_endpoints\n response = @client.rest_get(@data['uri'] + '/endpoints')\n @client.response_handler(response)['members']\n end",
"def list_log_scalyr(opts = {})\n data, _status_code, _headers = list_log_scalyr_with_http_info(opts)\n data\n end",
"def index\n @ncr_api_logs = NcrApiLog.all\n end",
"def list_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.list_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogglyApi.list_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.list_log_loggly\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogglyResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.list_log_loggly\",\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: LoggingLogglyApi#list_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list\n get('/')\n end",
"def index\n @serves = Serve.all\n end",
"def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend",
"def stops\n get '/gtfs/stops'\n end",
"def get_endpoints\n endpoints = call(CMD_GET_ENDPOINTS)[:endpoints]\n endpoints.map {|endpoint| Endpoint.new(endpoint) }\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end",
"def list(service_sid: :unset, before_start_time: :unset, after_start_time: :unset, before_date_created: :unset, after_date_created: :unset, status: :unset, language_code: :unset, source_sid: :unset, limit: nil, page_size: nil)\n self.stream(\n service_sid: service_sid,\n before_start_time: before_start_time,\n after_start_time: after_start_time,\n before_date_created: before_date_created,\n after_date_created: after_date_created,\n status: status,\n language_code: language_code,\n source_sid: source_sid,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def versions\n service_config.keys\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"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 endpoints=(value)\n generate_endpoint_methods(value)\n @endpoints = value\n end",
"def init_endpoints\n endpoints = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_vpc_endpoints({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n endpoints << response.vpc_endpoints\n end\n\n endpoints.flatten\n end",
"def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end",
"def endpoints\n object.endpoints.map { |e| e.id }\n end",
"def get_endpoints(token = nil)\n if token.nil?\n return get_request(address(\"/endpoints\"), token())\n else\n return get_request(address(\"/tokens/#{token}/endpoints\"), token())\n end\n end",
"def all\n api_get(path)\n end",
"def incrementally_list_servers(offset=nil, limit=nil, opts={}, &block)\n incrementally_list_resources(:get, detailed_path(\"/servers\", opts), offset, limit, opts, &block)\n end",
"def list\n call(:get, path)\n end",
"def list_liveservers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.to_a\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n @exchange_product_price_logs = ExchangeProductPriceLog.all\n end",
"def versions(resource_uri, format = \"text/turtle\")\n log \"versions for #{resource_uri}\"\n get \"#{resource_uri}/fcr:versions\", format\n end",
"def set_endpoints\n @endpoints = Endpoint.where('client_tag like ?', \"%#{params[:client_tag]}%\")\n .where('name like ?', \"%#{params[:request_name]}%\")\n end",
"def list_aws_logs_integrations_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsIntegrationAPI.list_aws_logs_integrations ...'\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/logs'\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] || 'Array<AWSLogsListResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_aws_logs_integrations,\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: AWSLogsIntegrationAPI#list_aws_logs_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_endpoints\n endpoints = @cache.endpoints || []\n endpoints.empty? ? @fallbacks : endpoints\n end",
"def list_all_webhook_subscription_for_tool_proxy(opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end",
"def list_services\n @services\n end",
"def endpoint\n options.values_at(:endpoint, :version).join('/')\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def list_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.list_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingLogshuttleApi.list_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.list_log_logshuttle\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingLogshuttleResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.list_log_logshuttle\",\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: LoggingLogshuttleApi#list_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def slapd_listen_urls\n urls = []\n\n (use_ldap, use_ldaps) = use_ldap_or_ldaps?(node['ca_openldap']['tls']['enable'].to_sym)\n ldap_port = node['ca_openldap']['default_ports']['ldap']\n ldaps_port = node['ca_openldap']['default_ports']['ldaps']\n\n urls << \"ldapi:///\" if node['ca_openldap']['enable_ldapi']\n\n if use_ldap == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldap://#{ listen_adress }:#{ ldap_port }\"\n end\n end\n\n if use_ldaps == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldaps://#{ listen_adress }:#{ ldaps_port }\"\n end\n end\n\n urls.join \" \"\n end",
"def index\n @el_sockets = ElSocket.all\n end",
"def index\n @el_sockets = ElSocket.all\n end",
"def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend",
"def index\n @service_lists = ServiceList.all\n end",
"def index\n @counter_services = CounterService.all\n end",
"def index\n @vlogs = Vlog.all\n end",
"def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"def list\n Puppet::SSL::Certificate.search(\"*\").collect { |c| c.name }\n end",
"def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\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(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all(filters = {})\n data = service.list_servers.body['data']\n load(data)\n end",
"def list_methods\n API_METHODS.values.flatten\n end",
"def public_endpoints\n\t\t\t@endpoints.select {|e| e.public_port_name != nil}\n\t\tend",
"def sorted_endpoints\n endpoints = self.class.endpoints.values.flatten\n\n endpoints.sort do |x,y|\n \"#{x.path} #{x.http_method}\" <=> \"#{y.path} #{y.http_method}\"\n end\n end",
"def list_aws_logs_services(opts = {})\n data, _status_code, _headers = list_aws_logs_services_with_http_info(opts)\n data\n end",
"def list\n cert_list(certstore_handler)\n end",
"def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def listserv\n listservs.first\n end",
"def gather_endpoints_to_check\n Rails.application.routes.routes.map do |route|\n verb = route.verb.downcase.to_sym\n example_path = route.path.spec\n .to_s.gsub('(.:format)', '')\n .gsub(/:([^\\/]+)/,'SOME_PLACEHOLDER_PARAM')\n .gsub('*path', 'SOME_PLACEHOLDER_PATH')\n .gsub('*filename','SOME_PLACEHOLDER_FILENAME')\n next unless verb.present?\n [verb, example_path]\n end.compact\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def resource_sapi_list\n if new_resource.php_sapi.include?('ALL') then sapi_list\n elsif supports_php5query? then new_resource.php_sapi\n else Array.new\n end\n end",
"def index\n @port_services = PortService.all\n end",
"def services\n output = riak_admin 'services'\n if $?.success?\n output.strip.match(/^\\[(.*)\\]$/)[1].split(/,/)\n else\n []\n end\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def dcerpc_endpoint_list\n\t\tres = []\n\n\t\tprint_status(\"Connecting to the endpoint mapper service...\")\n\t\tbegin\n\t\t\teps = nil\n\t\t\tdport = nil\n\n\t\t\t[135, 593].each do |i|\n\t\t\t\tdport = i\n\t\t\t\tbegin\n\t\t\t\t\teps = Rex::Socket::Tcp.create(\n\t\t\t\t\t'PeerHost' => rhost,\n\t\t\t\t\t'PeerPort' => dport,\n\t\t\t\t\t'Proxies' => proxies,\n\t\t\t\t\t'Context' =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Msf' => framework,\n\t\t\t\t\t\t\t'MsfExploit' => self,\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\n\t\t\t\t\tbreak\n\n\t\t\t\trescue ::Exception\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif (not eps)\n\t\t\t\tprint_status(\"Could not connect to the endpoint mapper service\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\teph = dcerpc_handle('e1af8308-5d1f-11c9-91a4-08002b14a0fa', '3.0', 'ncacn_ip_tcp', [dport])\n\t\t\topt = { 'Msf' => framework, 'MsfExploit' => self }\n\t\t\tdce = Rex::Proto::DCERPC::Client.new(eph, eps, opt)\n\n\t\t\thnd = nil\n\n\t\t\twhile(true)\n\n\t\t\t\t# Placeholders\n\t\t\t\tinfo =\n\t\t\t\t{\n\t\t\t\t\t:type => nil,\n\t\t\t\t\t:port => nil,\n\t\t\t\t\t:host => nil,\n\t\t\t\t\t:pipe => nil,\n\t\t\t\t\t:prot => nil,\n\t\t\t\t\t:uuid => nil,\n\t\t\t\t\t:vers => nil,\n\t\t\t\t\t:note => nil\n\t\t\t\t}\n\n\t\t\t\tdata = nil\n\n\t\t\t\tif(not hnd)\n\t\t\t\t\t# NULL handle to start with\n\t\t\t\t\tdata = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1].pack(\"V*\")\n\t\t\t\telse\n\t\t\t\t\t# Use the existing handle\n\t\t\t\t\tdata = [0, 0, 0, 0, 0].pack(\"V*\") + hnd\n\t\t\t\tend\n\n\t\t\t\tret = dce.call(2, data)\n\n\t\t\t\tif (\n\t\t\t\t\tdce.last_response == nil or\n\t\t\t\t\tdce.last_response.stub_data == nil or\n\t\t\t\t\tdce.last_response.stub_data.length < 40 or\n\t\t\t\t\tdce.last_response.stub_data[36,4] == \"\\xd6\\xa0\\xc9\\x16\"\n\t\t\t\t)\n\t\t\t\t\t# break from the parsing loop\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\t# Record the response data\n\t\t\t\tbuf = dce.last_response.stub_data\n\n\t\t\t\t# Record the handle if needed\n\t\t\t\thnd = buf[4, 20] if not hnd\n\n\t\t\t\t# Parse the response data\n\t\t\t\tnlen = buf[60, 4].unpack('V')[0]\n\t\t\t\tif (nlen > 1)\n\t\t\t\t\tinfo[:note] = buf[64, nlen - 1]\n\t\t\t\tend\n\n\t\t\t\t# Align the stub offset\n\t\t\t\tsoff = nlen + 72\n\t\t\t\twhile (soff % 4 != 0)\n\t\t\t\t\tsoff += 1\n\t\t\t\tend\n\n\t\t\t\t# Determine number of records\n\t\t\t\trcnt = buf[soff, 2].unpack('v')[0]\n\t\t\t\tsoff += 2\n\n\t\t\t\t# Parse the data from the stack\n\t\t\t\t1.upto(rcnt) do |i|\n\t\t\t\t\trlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tif (i == 1)\n\t\t\t\t\t\tinfo[:uuid] = Rex::Proto::DCERPC::UUID.uuid_unpack(buf[soff+1, 16])\n\t\t\t\t\t\tinfo[:vers] = buf[soff+17,2].unpack('CC').map{|s| s.to_s}.join(\".\")\n\t\t\t\t\tend\n\n\t\t\t\t\tif (i > 3)\n\t\t\t\t\t\tinfo[:type] = buf[soff, 1].unpack(\"C*\")[0]\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += rlen\n\n\t\t\t\t\txlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tcase info[:type]\n\t\t\t\t\twhen nil\n\n\t\t\t\t\t# TCP\n\t\t\t\t\twhen 7\n\t\t\t\t\t\tinfo[:prot] = 'tcp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# UDP\n\t\t\t\t\twhen 8\n\t\t\t\t\t\tinfo[:prot] = 'udp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# ADDR\n\t\t\t\t\twhen 9\n\t\t\t\t\t\tinfo[:host] = buf[soff, 4].unpack('C4').join('.')\n\n\t\t\t\t\t# PIPE\n\t\t\t\t\twhen 15\n\t\t\t\t\t\tinfo[:prot] = 'pipe'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# LRPC\n\t\t\t\t\twhen 16\n\t\t\t\t\t\tinfo[:prot] = 'lrpc'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# NETBIOS\n\t\t\t\t\twhen 17,24\n\t\t\t\t\t\tinfo[:host] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# HTTP\n\t\t\t\t\twhen 31\n\t\t\t\t\t\tinfo[:prot] = 'http'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# DYNAMIC?\n\t\t\t\t\twhen 22\n\t\t\t\t\t\t# not parsed\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_status(\"EPM unknown type: #{info[:type]} #{buf[soff, xlen].unpack(\"H*\")[0]}\")\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += xlen\n\t\t\t\tend\n\n\t\t\t\tinfo[:pipe].gsub!(\"\\x00\", '') if info[:pipe]\n\t\t\t\tinfo[:host].gsub!(\"\\x00\", '') if info[:host]\n\n\t\t\t\tres << info\n\t\t\tend\n\n\t\trescue ::Interrupt\n\t\t\traise $!\n\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Could not obtain the endpoint list: #{e}\")\n\t\t\tres = nil\n\t\tend\n\n\t\tres\n\tend",
"def index\n @rate_services = RateService.all\n end",
"def index\n @request_services = RequestService.all\n end",
"def index\n @log_load_times = LogLoadTime.all\n end",
"def index\n @config_logs = ConfigLog.all\n end",
"def index\n @vices = Vice.all\n end",
"def supported_services_table\n\n line = \"| %-35s | %-25s | %-30s |\\n\"\n\n lines = []\n Aws::SERVICE_MODULE_NAMES.each do |svc_name|\n client_class = Aws.const_get(svc_name).const_get(:Client)\n full_name = client_class.api.metadata('serviceFullName')\n version = client_class.api.version\n lines << line % [full_name, svc_name, version]\n end\n\n [\n \"\\n\",\n line % ['Service Name', 'Service Class', 'API Versions'],\n line % ['-' * 35, '-' * 25, '-' * 30],\n lines.sort_by(&:downcase),\n \"\\n\",\n ]\nend",
"def index\n @logs = Log.all\n end",
"def index\n @servers = @site.servers\n end",
"def list\n get(uri: '/webhooks/')\n end",
"def list_log_loggly(opts = {})\n data, _status_code, _headers = list_log_loggly_with_http_info(opts)\n data\n end",
"def index\n @servings = Serving.all\n end",
"def parse_endpoints(config)\n endpoints = get_key(config,'endpoints').map do |endpoint|\n parse_endpoint(endpoint)\n end\n return endpoints\n end",
"def list(conference_sid: :unset, friendly_name: :unset, status: :unset, created_after: :unset, created_before: :unset, mixer_region: :unset, tags: :unset, subaccount: :unset, detected_issues: :unset, end_reason: :unset, limit: nil, page_size: nil)\n self.stream(\n conference_sid: conference_sid,\n friendly_name: friendly_name,\n status: status,\n created_after: created_after,\n created_before: created_before,\n mixer_region: mixer_region,\n tags: tags,\n subaccount: subaccount,\n detected_issues: detected_issues,\n end_reason: end_reason,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def list_http_proxy_paths\n $logger.info(\"Checking routes for gear #{@uuid} of application #{@app.name}\")\n frontend = OpenShift::Runtime::FrontendHttpServer.new(OpenShift::Runtime::ApplicationContainer.from_uuid(@uuid))\n Hash[*frontend.connections.map { |path, uri, opts| [path, [uri, opts ] ] }.flatten(1)]\n end",
"def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages/{id}/status',\n 'method' => 'PUT',\n 'purpose' => 'Updates the status of a Package {\"status\": \"active\" / \"inactive\"} as valid json payloads'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end"
] | [
"0.65161127",
"0.59915936",
"0.5950381",
"0.58432287",
"0.5680225",
"0.5652868",
"0.5615075",
"0.5574693",
"0.54408336",
"0.54379296",
"0.54240924",
"0.54033995",
"0.5344667",
"0.53297365",
"0.53180766",
"0.5310362",
"0.5261508",
"0.52352315",
"0.5195188",
"0.5186559",
"0.51732355",
"0.5147543",
"0.51028466",
"0.5074248",
"0.5057228",
"0.5039468",
"0.50377107",
"0.5033341",
"0.4998402",
"0.49802536",
"0.49672228",
"0.49637157",
"0.4961299",
"0.49598166",
"0.49549517",
"0.49349478",
"0.49296346",
"0.49145344",
"0.49091774",
"0.49014905",
"0.48931518",
"0.48867658",
"0.48696256",
"0.48595884",
"0.4845476",
"0.48393786",
"0.4835819",
"0.4830279",
"0.48276803",
"0.4827514",
"0.4821747",
"0.48168334",
"0.48106372",
"0.48092774",
"0.4807812",
"0.48030362",
"0.47990835",
"0.4797044",
"0.47925806",
"0.47925806",
"0.47903332",
"0.478971",
"0.47777912",
"0.477695",
"0.4772697",
"0.47725993",
"0.47654858",
"0.47631505",
"0.47604895",
"0.4759594",
"0.47569418",
"0.47563496",
"0.4750245",
"0.4749513",
"0.47366568",
"0.47268862",
"0.4724282",
"0.47219127",
"0.47219127",
"0.4711358",
"0.4704147",
"0.4679458",
"0.46748403",
"0.46739382",
"0.4673849",
"0.4670799",
"0.46658483",
"0.46655667",
"0.46650767",
"0.46614423",
"0.46609628",
"0.4653702",
"0.4652382",
"0.46478406",
"0.46475446",
"0.46469113",
"0.46421787",
"0.46374542",
"0.4637034",
"0.4636158"
] | 0.5276899 | 16 |
Update the Scalyr log endpoint Update the Scalyr for a particular service and version. | def update_log_scalyr(opts = {})
data, _status_code, _headers = update_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_scalyr_name = opts[:'logging_scalyr_name']\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 LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n # verify the required parameter 'logging_scalyr_name' is set\n if @api_client.config.client_side_validation && logging_scalyr_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.update_log_scalyr\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingScalyrApi#update_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_https(opts = {})\n data, _status_code, _headers = update_log_https_with_http_info(opts)\n data\n end",
"def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @version = args[:version] if args.key?(:version)\n end",
"def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.update_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.update_log_logshuttle\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#update_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @log_services = args[:log_services] unless args[:log_services].nil?\n @next_page_token = args[:next_page_token] unless args[:next_page_token].nil?\n end",
"def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @timestamp = args[:timestamp] unless args[:timestamp].nil?\n @severity = args[:severity] unless args[:severity].nil?\n @project_id = args[:project_id] unless args[:project_id].nil?\n @service_name = args[:service_name] unless args[:service_name].nil?\n @region = args[:region] unless args[:region].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @user_id = args[:user_id] unless args[:user_id].nil?\n @labels = args[:labels] unless args[:labels].nil?\n end",
"def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end",
"def update!(**args)\n @app_version = args[:app_version] if args.key?(:app_version)\n @asset_logging_id = args[:asset_logging_id] if args.key?(:asset_logging_id)\n end",
"def update_logger_config(service_setup_data)\n driver = VaultDriver.from_secrets_file service_setup_data[:environment]\n service_name = service_setup_data['deployment']['service_name']\n logger = Syslogger.new(driver)\n if logger.check_record_exists(self)\n puts 'record already exists'\n return\n end\n result, error = logger.add_record_to_rsyslog(self)\n if result\n puts 'syslog updated!'\n else\n puts \"error #{error}\" unless error.nil?\n puts 'not updated'\n end\n end",
"def update!(**args)\n @bad_ssl_certificate = args[:bad_ssl_certificate] if args.key?(:bad_ssl_certificate)\n @client_service_info = args[:client_service_info] if args.key?(:client_service_info)\n @compressed_body = args[:compressed_body] if args.key?(:compressed_body)\n @crawl_times = args[:crawl_times] if args.key?(:crawl_times)\n @dns_host = args[:dns_host] if args.key?(:dns_host)\n @download_time = args[:download_time] if args.key?(:download_time)\n @egress_region = args[:egress_region] if args.key?(:egress_region)\n @eligible_geo_crawl_egress_region = args[:eligible_geo_crawl_egress_region] if args.key?(:eligible_geo_crawl_egress_region)\n @endpoints = args[:endpoints] if args.key?(:endpoints)\n @events = args[:events] if args.key?(:events)\n @fetch_pattern_fp = args[:fetch_pattern_fp] if args.key?(:fetch_pattern_fp)\n @floo_egress_region = args[:floo_egress_region] if args.key?(:floo_egress_region)\n @geo_crawl_egress_region = args[:geo_crawl_egress_region] if args.key?(:geo_crawl_egress_region)\n @geo_crawl_fallback = args[:geo_crawl_fallback] if args.key?(:geo_crawl_fallback)\n @geo_crawl_location_attempted = args[:geo_crawl_location_attempted] if args.key?(:geo_crawl_location_attempted)\n @hsts_info = args[:hsts_info] if args.key?(:hsts_info)\n @http_trailers = args[:http_trailers] if args.key?(:http_trailers)\n @hop_cache_key_for_lookup = args[:hop_cache_key_for_lookup] if args.key?(:hop_cache_key_for_lookup)\n @hop_cache_key_for_update = args[:hop_cache_key_for_update] if args.key?(:hop_cache_key_for_update)\n @hop_reuse_info = args[:hop_reuse_info] if args.key?(:hop_reuse_info)\n @hop_robots_info = args[:hop_robots_info] if args.key?(:hop_robots_info)\n @host_bucket_data = args[:host_bucket_data] if args.key?(:host_bucket_data)\n @host_id = args[:host_id] if args.key?(:host_id)\n @http_protocol = args[:http_protocol] if args.key?(:http_protocol)\n @http_request_headers = args[:http_request_headers] if args.key?(:http_request_headers)\n @http_response_headers = args[:http_response_headers] if args.key?(:http_response_headers)\n @http_version = args[:http_version] if args.key?(:http_version)\n @id = args[:id] if args.key?(:id)\n @last_url_status = args[:last_url_status] if args.key?(:last_url_status)\n @policy_data = args[:policy_data] if args.key?(:policy_data)\n @post_data = args[:post_data] if args.key?(:post_data)\n @predicted_download_time_ms = args[:predicted_download_time_ms] if args.key?(:predicted_download_time_ms)\n @protocol_version_fallback = args[:protocol_version_fallback] if args.key?(:protocol_version_fallback)\n @redirect_source_fetch_id = args[:redirect_source_fetch_id] if args.key?(:redirect_source_fetch_id)\n @requestor_id = args[:requestor_id] if args.key?(:requestor_id)\n @requestor_ip_address_packed = args[:requestor_ip_address_packed] if args.key?(:requestor_ip_address_packed)\n @reuse_info = args[:reuse_info] if args.key?(:reuse_info)\n @robots_info = args[:robots_info] if args.key?(:robots_info)\n @robots_status = args[:robots_status] if args.key?(:robots_status)\n @robots_txt = args[:robots_txt] if args.key?(:robots_txt)\n @status = args[:status] if args.key?(:status)\n @throttle_client = args[:throttle_client] if args.key?(:throttle_client)\n @thrown_away_bytes = args[:thrown_away_bytes] if args.key?(:thrown_away_bytes)\n @timestamp_in_ms = args[:timestamp_in_ms] if args.key?(:timestamp_in_ms)\n @total_fetched_size = args[:total_fetched_size] if args.key?(:total_fetched_size)\n @transparent_rewrites = args[:transparent_rewrites] if args.key?(:transparent_rewrites)\n @trawler_private = args[:trawler_private] if args.key?(:trawler_private)\n @url = args[:url] if args.key?(:url)\n @url_encoding = args[:url_encoding] if args.key?(:url_encoding)\n @use_html_compress_dictionary = args[:use_html_compress_dictionary] if args.key?(:use_html_compress_dictionary)\n @crawldates = args[:crawldates] if args.key?(:crawldates)\n @delivery_report = args[:delivery_report] if args.key?(:delivery_report)\n @fetchstats = args[:fetchstats] if args.key?(:fetchstats)\n @original_protocol_url = args[:original_protocol_url] if args.key?(:original_protocol_url)\n @partialresponse = args[:partialresponse] if args.key?(:partialresponse)\n @protocolresponse = args[:protocolresponse] if args.key?(:protocolresponse)\n @redirects = args[:redirects] if args.key?(:redirects)\n @traffic_type = args[:traffic_type] if args.key?(:traffic_type)\n end",
"def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update!(**args)\n @revision = args[:revision] if args.key?(:revision)\n @service = args[:service] if args.key?(:service)\n @service_urls = args[:service_urls] if args.key?(:service_urls)\n end",
"def update!(**args)\n @server_info = args[:server_info] if args.key?(:server_info)\n @server_trace_info = args[:server_trace_info] if args.key?(:server_trace_info)\n @service_url = args[:service_url] if args.key?(:service_url)\n end",
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @alpn_negotiated_protocol = args[:alpn_negotiated_protocol] if args.key?(:alpn_negotiated_protocol)\n @certificate_chain = args[:certificate_chain] if args.key?(:certificate_chain)\n @error_messages = args[:error_messages] if args.key?(:error_messages)\n @is_truncated = args[:is_truncated] if args.key?(:is_truncated)\n @ocsp_response = args[:ocsp_response] if args.key?(:ocsp_response)\n @sct_list = args[:sct_list] if args.key?(:sct_list)\n @ssl_cipher_suite = args[:ssl_cipher_suite] if args.key?(:ssl_cipher_suite)\n @ssl_cipher_suite_name = args[:ssl_cipher_suite_name] if args.key?(:ssl_cipher_suite_name)\n @ssl_protocol_version = args[:ssl_protocol_version] if args.key?(:ssl_protocol_version)\n @ssl_protocol_version_name = args[:ssl_protocol_version_name] if args.key?(:ssl_protocol_version_name)\n end",
"def create_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.create_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.create_log_scalyr\",\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: LoggingScalyrApi#create_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @operation = args[:operation] if args.key?(:operation)\n @protocol = args[:protocol] if args.key?(:protocol)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @logging = args[:logging] if args.key?(:logging)\n @serving = args[:serving] if args.key?(:serving)\n @storage = args[:storage] if args.key?(:storage)\n end",
"def update\n respond_to do |format|\n if @advertise.user == current_user\n\n if @advertise.update(advertise_params)\n Log.create(:logable => @advertise, :user => current_user,\n :msg => _(\"\\#%{id} advertise updated\") % {:id => @advertise.id})\n #:changes => @advertise.changes))\n\n format.html { redirect_to target_url || @advertise, notice: 'Advertise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n else\n return forbidden\n end\n end\n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n @logger.debug('sso - in update adding features')\n Utils.add_features(doc, @features)\n update_open_id_connect_client(doc)\n update_ssl_config(doc)\n update_keystore_config(doc)\n update_web_application_security(doc)\n end",
"def update\n @prod_cli = ProdCli.find(params[:id])\n respond_to do |format|\n if @prod_cli.update(prod_cli_params)\n #ATUALIZOU DADOS\n log = Loginfo.new(params[:loginfo])\n log.employee = current_user.name\n log.task = 'Atualizou os dados do produto no cliente: ' + @prod_cli.client.company.to_s\n log.save! \n \n format.html { redirect_to clients_path, notice: 'produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @prod_cli }\n else\n format.html { render :edit }\n format.json { render json: @prod_cli.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @json_payload = args[:json_payload] if args.key?(:json_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @severity = args[:severity] if args.key?(:severity)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @http_request = args[:http_request] if args.key?(:http_request)\n @labels = args[:labels] if args.key?(:labels)\n @operation = args[:operation] if args.key?(:operation)\n end",
"def update!(**args)\n @secret_version = args[:secret_version] if args.key?(:secret_version)\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @labels = args[:labels] if args.key?(:labels)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update_log_loggly(opts = {})\n data, _status_code, _headers = update_log_loggly_with_http_info(opts)\n data\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n \n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n # handle client driver jars\n @driver_dir = driver_dir\n @client_jars_string = ClientJarUtils.client_jars_string(ClientJarUtils.get_jar_names(available_jars, @reg_ex))\n @logger.debug(\"client jars string #{@client_jars_string}\")\n # Find the datasource config for this service instance.\n datasources = find_datasource(doc, number_instances)\n if datasources.empty?\n @logger.debug(\"datasource #{@datasource_id} not found, creating it\")\n create_datasource(doc, @driver_dir)\n else\n modify_datasource(datasources)\n # Find the jdbc driver. Use the jdbc driver to find the shared library.\n jdbc_driver = find_jdbc_driver(doc, datasources)\n modify_jdbc_driver(jdbc_driver)\n library = find_shared_library(doc, jdbc_driver)\n ClientJarUtils.update_library(doc, @service_name, library, @fileset_id, @driver_dir, @client_jars_string)\n\n # Do not update datasource attributes. Specifically, do not update the jndi name. We do need to update the properties attributes though.\n # find the instance that contains the properties. Liberty only allows one instance of properties.\n properties_element = find_datasource_properties(datasources)\n properties_element.add_attribute('databaseName', @db_name)\n properties_element.add_attribute('user', @user)\n properties_element.add_attribute('password', @password)\n properties_element.add_attribute('serverName', @host)\n properties_element.add_attribute('portNumber', @port)\n modify_properties(properties_element)\n Utils.add_features(doc, @features)\n end\n end",
"def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end",
"def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end",
"def update!(**args)\n @dense_vector = args[:dense_vector] if args.key?(:dense_vector)\n @sb_version = args[:sb_version] if args.key?(:sb_version)\n @timestamp_ms = args[:timestamp_ms] if args.key?(:timestamp_ms)\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @admin_service.update(admin_service_regex_params)\n format.html { redirect_to @admin_service, notice: 'Platform was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_service }\n else\n format.html { render :edit }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_version_method(version)\nend",
"def update!(**args)\n @services = args[:services] if args.key?(:services)\n end",
"def update\n @liquor_license = LiquorLicense.find(params[:id])\n\n respond_to do |format|\n if @liquor_license.update_attributes(params[:liquor_license])\n format.html { redirect_to(@liquor_license, :notice => 'Liquor license was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @liquor_license.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lsrs_framework = LsrsFramework.find(params[:id])\n\n respond_to do |format|\n if @lsrs_framework.update_attributes(params[:lsrs_framework])\n flash[:notice] = 'LsrsFramework was successfully updated.'\n format.html { redirect_to(@lsrs_framework) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lsrs_framework.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ssl_version=(ssl_version); end",
"def ssl_version=(ssl_version); end",
"def update\n load_service\n return if (@service.blank?)\n\n parameters = service_params\n parameters[:probe_config] = params[:probe_config] if (!params[:probe_config].blank?)\n\n respond_to do|format|\n format.html{\n # The service can be updated?\n if (@service.update_attributes(parameters))\n flash[:notice] = t(\"services.notice.updated\", :name => @service.name)\n redirect_to service_path(@service)\n else\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n end",
"def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @deployment_function = args[:deployment_function] if args.key?(:deployment_function)\n @error = args[:error] if args.key?(:error)\n end",
"def update\n respond_to do |format|\n @service.assign_attributes(service_params.merge({\n current_request: request\n }))\n\n if @service.authenticate and @service.save\n format.html { redirect_to @service, notice: get_update_message('updated') }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @debug_string = args[:debug_string] if args.key?(:debug_string)\n @error_code = args[:error_code] if args.key?(:error_code)\n @linked = args[:linked] if args.key?(:linked)\n @max_age = args[:max_age] if args.key?(:max_age)\n end",
"def update_data_version\n\t\t\t@data_version += 1\n\t\tend",
"def version_aware_update(resource, id, version_id, format = nil, options = {})\n base_update(resource, id, options, format, {if_match: \"W/#{version_id}\"})\n end",
"def update\n \n end",
"def update(...)\n end",
"def update\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n if @web_service_log.update_attributes(params[:web_service_log])\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params)\n self.class.new reinit_endpoint(params).do_put\n end",
"def update\n fail ESP::NotImplementedError\n end",
"def update!(**args)\n @time = args[:time] if args.key?(:time)\n @severity = args[:severity] if args.key?(:severity)\n @log_message = args[:log_message] if args.key?(:log_message)\n @source_location = args[:source_location] if args.key?(:source_location)\n end",
"def update_soaplab_server(url)\n soaplab = SoaplabServer.find_by_location(url)\n data = soaplab.services_factory().values.flatten\n wsdls_from_server = data.collect{ |item| item[\"location\"]}\n registered_soaps = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n registered_wsdls = registered_soaps.collect{|s| s.wsdl_location}\n wsdls_from_relationships = soaplab.services.collect{|service| service.latest_version.service_versionified.wsdl_location}\n wsdls_to_add = registered_wsdls - wsdls_from_relationships \n submitter = nil\n unless soaplab.services.empty?\n submitter = User.find(soaplab.services.first.submitter_id)\n end\n \n \n soaps_to_add = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n services_to_add = soaps_to_add.collect{|s| s.service}\n puts \"server : #{url}\"\n puts \"No of relationships to add #{wsdls_to_add.length}\"\n puts wsdls_to_add\n unless wsdls_to_add.empty?\n if submitter.nil?\n submitter = User.find(SoapService.find_by_wsdl_location(wsdls_to_add.first).service.submitter_id)\n end\n soaplab.create_relationships(wsdls_to_add)\n create_tags_if_not_exist(services_to_add, submitter)\n end\n if soaplab.endpoint.nil?\n proxy_info = get_endpoint_and_name(url)\n unless proxy_info.empty?\n soaplab.endpoint = proxy_info[0] \n soaplab.name = proxy_info[1]\n soaplab.save\n end\n end\n end",
"def update\n @subscription = Subscription.find(params[:id])\n set_current_system list_to_system(@subscription.list)\n get_list_and_segments\n params[:subscription][:segments] ||= []\n @subscription.write_attributes(params[:subscription])\n @lyris = Lyris.new :update_member_demographics, :simple_member_struct_in => {:email_address => @subscription.email, :list_name => @subscription.list}, :demographics_array => @segments.keys.map {|e| {:name => e, :value => @subscription.segments.include?(e.to_s) ? 1 : 0}} if @segments.present?\n @subscription.save\n flash[:notice] = \"Newsletter Subscription settings have been updated.\"\n redirect_to(admin_subscriptions_url)\n end",
"def update\n respond_to do |format|\n if @ncr_api_log.update(ncr_api_log_params)\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ncr_api_log }\n else\n format.html { render :edit }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @counter_service.update(counter_service_params)\n format.html { redirect_to @counter_service, notice: 'Counter service was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_service }\n else\n format.html { render :edit }\n format.json { render json: @counter_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update() end",
"def update!(**args)\n @version = args[:version] if args.key?(:version)\n @bindings = args[:bindings] if args.key?(:bindings)\n @rules = args[:rules] if args.key?(:rules)\n @etag = args[:etag] if args.key?(:etag)\n end",
"def update\n respond_to do |format|\n if @vinyl.update(vinyl_params)\n format.html { redirect_to @vinyl, notice: 'Vinyl was successfully updated.' }\n format.json { render :show, status: :ok, location: @vinyl }\n else\n format.html { render :edit }\n format.json { render json: @vinyl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @service_period = args[:service_period] if args.key?(:service_period)\n end",
"def update!(**args)\n @partial_vsi = args[:partial_vsi] if args.key?(:partial_vsi)\n @vsi_time = args[:vsi_time] if args.key?(:vsi_time)\n end",
"def update!(**args)\n @log_scaling = args[:log_scaling] if args.key?(:log_scaling)\n @type = args[:type] if args.key?(:type)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def update!(**args)\n @version = args[:version] if args.key?(:version)\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def updating( msg )\n @log.info \"updating #{msg}\"\n end",
"def update_handle(label_and_version, provider=DEFAULT_PROVIDER, id)\n (label, _) = label_and_version.split('-')\n\n validate_access(label, provider)\n set_v2_security_context\n\n req = VCAP::Services::Api::HandleUpdateRequest.decode(body)\n\n service = Service[label: label, provider: provider]\n raise ApiError.new_from_details('ServiceNotFound', \"label=#{label} provider=#{provider}\") unless service\n\n plans_ds = service.service_plans_dataset\n instances_ds = ManagedServiceInstance.filter(service_plan: plans_ds)\n bindings_ds = ServiceBinding.filter(service_instance: instances_ds)\n\n instance = instances_ds[gateway_name: id]\n binding = bindings_ds[gateway_name: id]\n\n if instance\n instance.set(\n gateway_data: req.configuration,\n credentials: req.credentials,\n )\n instance.save_changes\n elsif binding\n binding.set(\n configuration: req.configuration.to_s,\n credentials: req.credentials.to_s,\n )\n binding.save_changes\n else\n raise ApiError.new_from_details('ServiceInstanceNotFound', \"label=#{label} provider=#{provider} id=#{id}\")\n end\n end",
"def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end",
"def update!(**args)\n @assured_workloads_monitoring = args[:assured_workloads_monitoring] if args.key?(:assured_workloads_monitoring)\n @data_logs_viewer = args[:data_logs_viewer] if args.key?(:data_logs_viewer)\n @service_access_approver = args[:service_access_approver] if args.key?(:service_access_approver)\n end",
"def update\n respond_to do |format|\n if @exchange_product_price_log.update(exchange_product_price_log_params)\n format.html { redirect_to @exchange_product_price_log, notice: 'Exchange product price log was successfully updated.' }\n format.json { render :show, status: :ok, location: @exchange_product_price_log }\n else\n format.html { render :edit }\n format.json { render json: @exchange_product_price_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @counter = args[:counter] if args.key?(:counter)\n @data_access = args[:data_access] if args.key?(:data_access)\n @cloud_audit = args[:cloud_audit] if args.key?(:cloud_audit)\n end",
"def update\n @service = Service.find(params[:id])\n if @service.update_attributes(sp_company)\n flash[:success] = \"Services form updated\"\n redirect_to services_path\n else\n render'edit'\n end\n end",
"def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @message = args[:message] if args.key?(:message)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end"
] | [
"0.62463784",
"0.5989424",
"0.5796027",
"0.56155396",
"0.5508138",
"0.55066663",
"0.5350583",
"0.53137094",
"0.53058976",
"0.53037494",
"0.5298519",
"0.5298519",
"0.5298519",
"0.52912253",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.5262791",
"0.52598184",
"0.5216389",
"0.5215365",
"0.5165571",
"0.5149744",
"0.51439476",
"0.5139044",
"0.5126818",
"0.51031846",
"0.5098175",
"0.5069613",
"0.50643665",
"0.50629646",
"0.5053238",
"0.50290954",
"0.5010484",
"0.5000216",
"0.49880385",
"0.49681842",
"0.49643236",
"0.4958549",
"0.49532807",
"0.49416238",
"0.49393198",
"0.49393198",
"0.49269605",
"0.49260798",
"0.49235427",
"0.49234003",
"0.49123278",
"0.49065983",
"0.48893344",
"0.48867446",
"0.48867446",
"0.48815343",
"0.48762897",
"0.48735222",
"0.48613086",
"0.48605776",
"0.48593956",
"0.48563543",
"0.48503125",
"0.48463172",
"0.48442245",
"0.48431316",
"0.48430145",
"0.48405015",
"0.48370656",
"0.48303998",
"0.4828948",
"0.48281196",
"0.48231316",
"0.48221555",
"0.48200944",
"0.48176613",
"0.48175526",
"0.4815196",
"0.4814736",
"0.48119417",
"0.48090646",
"0.4806417",
"0.4805113",
"0.48022684",
"0.47985518",
"0.47957113",
"0.4794112",
"0.47918645"
] | 0.6037402 | 1 |
Update the Scalyr log endpoint Update the Scalyr for a particular service and version. | def update_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
logging_scalyr_name = opts[:'logging_scalyr_name']
# verify the required parameter 'service_id' is set
if @api_client.config.client_side_validation && service_id.nil?
fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.update_log_scalyr"
end
# verify the required parameter 'version_id' is set
if @api_client.config.client_side_validation && version_id.nil?
fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr"
end
# verify the required parameter 'logging_scalyr_name' is set
if @api_client.config.client_side_validation && logging_scalyr_name.nil?
fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr"
end
allowable_values = ["none", "waf_debug", "null"]
if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])
fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}"
end
allowable_values = [1, 2]
if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])
fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}"
end
allowable_values = ["US", "EU"]
if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])
fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?
form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?
form_params['format'] = opts[:'format'] if !opts[:'format'].nil?
form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?
form_params['region'] = opts[:'region'] if !opts[:'region'].nil?
form_params['token'] = opts[:'token'] if !opts[:'token'].nil?
form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'
# auth_names
auth_names = opts[:debug_auth_names] || ['token']
new_options = opts.merge(
:operation => :"LoggingScalyrApi.update_log_scalyr",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: LoggingScalyrApi#update_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_log_scalyr(opts = {})\n data, _status_code, _headers = update_log_scalyr_with_http_info(opts)\n data\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.update_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.update_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.update_log_https\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#update_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_https(opts = {})\n data, _status_code, _headers = update_log_https_with_http_info(opts)\n data\n end",
"def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @version = args[:version] if args.key?(:version)\n end",
"def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end",
"def update_log_loggly_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogglyApi.update_log_loggly ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_loggly_name = opts[:'logging_loggly_name']\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 LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogglyApi.update_log_loggly\"\n end\n # verify the required parameter 'logging_loggly_name' is set\n if @api_client.config.client_side_validation && logging_loggly_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_loggly_name' when calling LoggingLogglyApi.update_log_loggly\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/loggly/{logging_loggly_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_loggly_name' + '}', CGI.escape(logging_loggly_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogglyResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogglyApi.update_log_loggly\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogglyApi#update_log_loggly\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_log_logshuttle_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingLogshuttleApi.update_log_logshuttle ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_logshuttle_name = opts[:'logging_logshuttle_name']\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 LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n # verify the required parameter 'logging_logshuttle_name' is set\n if @api_client.config.client_side_validation && logging_logshuttle_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_logshuttle_name' when calling LoggingLogshuttleApi.update_log_logshuttle\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/logshuttle/{logging_logshuttle_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_logshuttle_name' + '}', CGI.escape(logging_logshuttle_name.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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingLogshuttleResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingLogshuttleApi.update_log_logshuttle\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingLogshuttleApi#update_log_logshuttle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @log_services = args[:log_services] unless args[:log_services].nil?\n @next_page_token = args[:next_page_token] unless args[:next_page_token].nil?\n end",
"def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end",
"def update!(**args)\n @timestamp = args[:timestamp] unless args[:timestamp].nil?\n @severity = args[:severity] unless args[:severity].nil?\n @project_id = args[:project_id] unless args[:project_id].nil?\n @service_name = args[:service_name] unless args[:service_name].nil?\n @region = args[:region] unless args[:region].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @user_id = args[:user_id] unless args[:user_id].nil?\n @labels = args[:labels] unless args[:labels].nil?\n end",
"def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end",
"def update!(**args)\n @app_version = args[:app_version] if args.key?(:app_version)\n @asset_logging_id = args[:asset_logging_id] if args.key?(:asset_logging_id)\n end",
"def update_logger_config(service_setup_data)\n driver = VaultDriver.from_secrets_file service_setup_data[:environment]\n service_name = service_setup_data['deployment']['service_name']\n logger = Syslogger.new(driver)\n if logger.check_record_exists(self)\n puts 'record already exists'\n return\n end\n result, error = logger.add_record_to_rsyslog(self)\n if result\n puts 'syslog updated!'\n else\n puts \"error #{error}\" unless error.nil?\n puts 'not updated'\n end\n end",
"def update!(**args)\n @bad_ssl_certificate = args[:bad_ssl_certificate] if args.key?(:bad_ssl_certificate)\n @client_service_info = args[:client_service_info] if args.key?(:client_service_info)\n @compressed_body = args[:compressed_body] if args.key?(:compressed_body)\n @crawl_times = args[:crawl_times] if args.key?(:crawl_times)\n @dns_host = args[:dns_host] if args.key?(:dns_host)\n @download_time = args[:download_time] if args.key?(:download_time)\n @egress_region = args[:egress_region] if args.key?(:egress_region)\n @eligible_geo_crawl_egress_region = args[:eligible_geo_crawl_egress_region] if args.key?(:eligible_geo_crawl_egress_region)\n @endpoints = args[:endpoints] if args.key?(:endpoints)\n @events = args[:events] if args.key?(:events)\n @fetch_pattern_fp = args[:fetch_pattern_fp] if args.key?(:fetch_pattern_fp)\n @floo_egress_region = args[:floo_egress_region] if args.key?(:floo_egress_region)\n @geo_crawl_egress_region = args[:geo_crawl_egress_region] if args.key?(:geo_crawl_egress_region)\n @geo_crawl_fallback = args[:geo_crawl_fallback] if args.key?(:geo_crawl_fallback)\n @geo_crawl_location_attempted = args[:geo_crawl_location_attempted] if args.key?(:geo_crawl_location_attempted)\n @hsts_info = args[:hsts_info] if args.key?(:hsts_info)\n @http_trailers = args[:http_trailers] if args.key?(:http_trailers)\n @hop_cache_key_for_lookup = args[:hop_cache_key_for_lookup] if args.key?(:hop_cache_key_for_lookup)\n @hop_cache_key_for_update = args[:hop_cache_key_for_update] if args.key?(:hop_cache_key_for_update)\n @hop_reuse_info = args[:hop_reuse_info] if args.key?(:hop_reuse_info)\n @hop_robots_info = args[:hop_robots_info] if args.key?(:hop_robots_info)\n @host_bucket_data = args[:host_bucket_data] if args.key?(:host_bucket_data)\n @host_id = args[:host_id] if args.key?(:host_id)\n @http_protocol = args[:http_protocol] if args.key?(:http_protocol)\n @http_request_headers = args[:http_request_headers] if args.key?(:http_request_headers)\n @http_response_headers = args[:http_response_headers] if args.key?(:http_response_headers)\n @http_version = args[:http_version] if args.key?(:http_version)\n @id = args[:id] if args.key?(:id)\n @last_url_status = args[:last_url_status] if args.key?(:last_url_status)\n @policy_data = args[:policy_data] if args.key?(:policy_data)\n @post_data = args[:post_data] if args.key?(:post_data)\n @predicted_download_time_ms = args[:predicted_download_time_ms] if args.key?(:predicted_download_time_ms)\n @protocol_version_fallback = args[:protocol_version_fallback] if args.key?(:protocol_version_fallback)\n @redirect_source_fetch_id = args[:redirect_source_fetch_id] if args.key?(:redirect_source_fetch_id)\n @requestor_id = args[:requestor_id] if args.key?(:requestor_id)\n @requestor_ip_address_packed = args[:requestor_ip_address_packed] if args.key?(:requestor_ip_address_packed)\n @reuse_info = args[:reuse_info] if args.key?(:reuse_info)\n @robots_info = args[:robots_info] if args.key?(:robots_info)\n @robots_status = args[:robots_status] if args.key?(:robots_status)\n @robots_txt = args[:robots_txt] if args.key?(:robots_txt)\n @status = args[:status] if args.key?(:status)\n @throttle_client = args[:throttle_client] if args.key?(:throttle_client)\n @thrown_away_bytes = args[:thrown_away_bytes] if args.key?(:thrown_away_bytes)\n @timestamp_in_ms = args[:timestamp_in_ms] if args.key?(:timestamp_in_ms)\n @total_fetched_size = args[:total_fetched_size] if args.key?(:total_fetched_size)\n @transparent_rewrites = args[:transparent_rewrites] if args.key?(:transparent_rewrites)\n @trawler_private = args[:trawler_private] if args.key?(:trawler_private)\n @url = args[:url] if args.key?(:url)\n @url_encoding = args[:url_encoding] if args.key?(:url_encoding)\n @use_html_compress_dictionary = args[:use_html_compress_dictionary] if args.key?(:use_html_compress_dictionary)\n @crawldates = args[:crawldates] if args.key?(:crawldates)\n @delivery_report = args[:delivery_report] if args.key?(:delivery_report)\n @fetchstats = args[:fetchstats] if args.key?(:fetchstats)\n @original_protocol_url = args[:original_protocol_url] if args.key?(:original_protocol_url)\n @partialresponse = args[:partialresponse] if args.key?(:partialresponse)\n @protocolresponse = args[:protocolresponse] if args.key?(:protocolresponse)\n @redirects = args[:redirects] if args.key?(:redirects)\n @traffic_type = args[:traffic_type] if args.key?(:traffic_type)\n end",
"def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update!(**args)\n @revision = args[:revision] if args.key?(:revision)\n @service = args[:service] if args.key?(:service)\n @service_urls = args[:service_urls] if args.key?(:service_urls)\n end",
"def update!(**args)\n @server_info = args[:server_info] if args.key?(:server_info)\n @server_trace_info = args[:server_trace_info] if args.key?(:server_trace_info)\n @service_url = args[:service_url] if args.key?(:service_url)\n end",
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.create_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.create_log_https\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"POST\", \"PUT\"]\n if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])\n fail ArgumentError, \"invalid value for \\\"method\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"0\", \"1\", \"2\"]\n if @api_client.config.client_side_validation && opts[:'json_format'] && !allowable_values.include?(opts[:'json_format'])\n fail ArgumentError, \"invalid value for \\\"json_format\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_hostname'] = opts[:'tls_hostname'] if !opts[:'tls_hostname'].nil?\n form_params['request_max_entries'] = opts[:'request_max_entries'] if !opts[:'request_max_entries'].nil?\n form_params['request_max_bytes'] = opts[:'request_max_bytes'] if !opts[:'request_max_bytes'].nil?\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n form_params['header_name'] = opts[:'header_name'] if !opts[:'header_name'].nil?\n form_params['message_type'] = opts[:'message_type'] if !opts[:'message_type'].nil?\n form_params['header_value'] = opts[:'header_value'] if !opts[:'header_value'].nil?\n form_params['method'] = opts[:'method'] if !opts[:'method'].nil?\n form_params['json_format'] = opts[:'json_format'] if !opts[:'json_format'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.create_log_https\",\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: LoggingHttpsApi#create_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @alpn_negotiated_protocol = args[:alpn_negotiated_protocol] if args.key?(:alpn_negotiated_protocol)\n @certificate_chain = args[:certificate_chain] if args.key?(:certificate_chain)\n @error_messages = args[:error_messages] if args.key?(:error_messages)\n @is_truncated = args[:is_truncated] if args.key?(:is_truncated)\n @ocsp_response = args[:ocsp_response] if args.key?(:ocsp_response)\n @sct_list = args[:sct_list] if args.key?(:sct_list)\n @ssl_cipher_suite = args[:ssl_cipher_suite] if args.key?(:ssl_cipher_suite)\n @ssl_cipher_suite_name = args[:ssl_cipher_suite_name] if args.key?(:ssl_cipher_suite_name)\n @ssl_protocol_version = args[:ssl_protocol_version] if args.key?(:ssl_protocol_version)\n @ssl_protocol_version_name = args[:ssl_protocol_version_name] if args.key?(:ssl_protocol_version_name)\n end",
"def create_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.create_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr\"\n end\n allowable_values = [\"none\", \"waf_debug\", \"null\"]\n if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])\n fail ArgumentError, \"invalid value for \\\"placement\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [1, 2]\n if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version'])\n fail ArgumentError, \"invalid value for \\\"format_version\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"US\", \"EU\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/x-www-form-urlencoded'])\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 form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil?\n form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil?\n form_params['format'] = opts[:'format'] if !opts[:'format'].nil?\n form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil?\n form_params['region'] = opts[:'region'] if !opts[:'region'].nil?\n form_params['token'] = opts[:'token'] if !opts[:'token'].nil?\n form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingScalyrResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.create_log_scalyr\",\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: LoggingScalyrApi#create_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingHttpsApi.list_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.list_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingHttpsResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.list_log_https\",\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: LoggingHttpsApi#list_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @operation = args[:operation] if args.key?(:operation)\n @protocol = args[:protocol] if args.key?(:protocol)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @logging = args[:logging] if args.key?(:logging)\n @serving = args[:serving] if args.key?(:serving)\n @storage = args[:storage] if args.key?(:storage)\n end",
"def update\n respond_to do |format|\n if @advertise.user == current_user\n\n if @advertise.update(advertise_params)\n Log.create(:logable => @advertise, :user => current_user,\n :msg => _(\"\\#%{id} advertise updated\") % {:id => @advertise.id})\n #:changes => @advertise.changes))\n\n format.html { redirect_to target_url || @advertise, notice: 'Advertise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advertise.errors, status: :unprocessable_entity }\n end\n else\n return forbidden\n end\n end\n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n @logger.debug('sso - in update adding features')\n Utils.add_features(doc, @features)\n update_open_id_connect_client(doc)\n update_ssl_config(doc)\n update_keystore_config(doc)\n update_web_application_security(doc)\n end",
"def update\n @prod_cli = ProdCli.find(params[:id])\n respond_to do |format|\n if @prod_cli.update(prod_cli_params)\n #ATUALIZOU DADOS\n log = Loginfo.new(params[:loginfo])\n log.employee = current_user.name\n log.task = 'Atualizou os dados do produto no cliente: ' + @prod_cli.client.company.to_s\n log.save! \n \n format.html { redirect_to clients_path, notice: 'produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @prod_cli }\n else\n format.html { render :edit }\n format.json { render json: @prod_cli.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @json_payload = args[:json_payload] if args.key?(:json_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @severity = args[:severity] if args.key?(:severity)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @http_request = args[:http_request] if args.key?(:http_request)\n @labels = args[:labels] if args.key?(:labels)\n @operation = args[:operation] if args.key?(:operation)\n end",
"def update!(**args)\n @secret_version = args[:secret_version] if args.key?(:secret_version)\n end",
"def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @labels = args[:labels] if args.key?(:labels)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update_log_loggly(opts = {})\n data, _status_code, _headers = update_log_loggly_with_http_info(opts)\n data\n end",
"def delete_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.delete_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.delete_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.delete_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.delete_log_https\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoggingHttpsApi#delete_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n \n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n # handle client driver jars\n @driver_dir = driver_dir\n @client_jars_string = ClientJarUtils.client_jars_string(ClientJarUtils.get_jar_names(available_jars, @reg_ex))\n @logger.debug(\"client jars string #{@client_jars_string}\")\n # Find the datasource config for this service instance.\n datasources = find_datasource(doc, number_instances)\n if datasources.empty?\n @logger.debug(\"datasource #{@datasource_id} not found, creating it\")\n create_datasource(doc, @driver_dir)\n else\n modify_datasource(datasources)\n # Find the jdbc driver. Use the jdbc driver to find the shared library.\n jdbc_driver = find_jdbc_driver(doc, datasources)\n modify_jdbc_driver(jdbc_driver)\n library = find_shared_library(doc, jdbc_driver)\n ClientJarUtils.update_library(doc, @service_name, library, @fileset_id, @driver_dir, @client_jars_string)\n\n # Do not update datasource attributes. Specifically, do not update the jndi name. We do need to update the properties attributes though.\n # find the instance that contains the properties. Liberty only allows one instance of properties.\n properties_element = find_datasource_properties(datasources)\n properties_element.add_attribute('databaseName', @db_name)\n properties_element.add_attribute('user', @user)\n properties_element.add_attribute('password', @password)\n properties_element.add_attribute('serverName', @host)\n properties_element.add_attribute('portNumber', @port)\n modify_properties(properties_element)\n Utils.add_features(doc, @features)\n end\n end",
"def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end",
"def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end",
"def update!(**args)\n @dense_vector = args[:dense_vector] if args.key?(:dense_vector)\n @sb_version = args[:sb_version] if args.key?(:sb_version)\n @timestamp_ms = args[:timestamp_ms] if args.key?(:timestamp_ms)\n end",
"def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n logging_https_name = opts[:'logging_https_name']\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 LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingHttpsApi.get_log_https\"\n end\n # verify the required parameter 'logging_https_name' is set\n if @api_client.config.client_side_validation && logging_https_name.nil?\n fail ArgumentError, \"Missing the required parameter 'logging_https_name' when calling LoggingHttpsApi.get_log_https\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/https/{logging_https_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_https_name' + '}', CGI.escape(logging_https_name.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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'LoggingHttpsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingHttpsApi.get_log_https\",\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: LoggingHttpsApi#get_log_https\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @admin_service.update(admin_service_regex_params)\n format.html { redirect_to @admin_service, notice: 'Platform was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_service }\n else\n format.html { render :edit }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_version_method(version)\nend",
"def update!(**args)\n @services = args[:services] if args.key?(:services)\n end",
"def update\n @liquor_license = LiquorLicense.find(params[:id])\n\n respond_to do |format|\n if @liquor_license.update_attributes(params[:liquor_license])\n format.html { redirect_to(@liquor_license, :notice => 'Liquor license was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @liquor_license.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lsrs_framework = LsrsFramework.find(params[:id])\n\n respond_to do |format|\n if @lsrs_framework.update_attributes(params[:lsrs_framework])\n flash[:notice] = 'LsrsFramework was successfully updated.'\n format.html { redirect_to(@lsrs_framework) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lsrs_framework.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ssl_version=(ssl_version); end",
"def ssl_version=(ssl_version); end",
"def update\n load_service\n return if (@service.blank?)\n\n parameters = service_params\n parameters[:probe_config] = params[:probe_config] if (!params[:probe_config].blank?)\n\n respond_to do|format|\n format.html{\n # The service can be updated?\n if (@service.update_attributes(parameters))\n flash[:notice] = t(\"services.notice.updated\", :name => @service.name)\n redirect_to service_path(@service)\n else\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n end",
"def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @deployment_function = args[:deployment_function] if args.key?(:deployment_function)\n @error = args[:error] if args.key?(:error)\n end",
"def update\n respond_to do |format|\n @service.assign_attributes(service_params.merge({\n current_request: request\n }))\n\n if @service.authenticate and @service.save\n format.html { redirect_to @service, notice: get_update_message('updated') }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @debug_string = args[:debug_string] if args.key?(:debug_string)\n @error_code = args[:error_code] if args.key?(:error_code)\n @linked = args[:linked] if args.key?(:linked)\n @max_age = args[:max_age] if args.key?(:max_age)\n end",
"def update_data_version\n\t\t\t@data_version += 1\n\t\tend",
"def version_aware_update(resource, id, version_id, format = nil, options = {})\n base_update(resource, id, options, format, {if_match: \"W/#{version_id}\"})\n end",
"def update\n \n end",
"def update(...)\n end",
"def update\n fail ESP::NotImplementedError\n end",
"def update\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n if @web_service_log.update_attributes(params[:web_service_log])\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params)\n self.class.new reinit_endpoint(params).do_put\n end",
"def update!(**args)\n @time = args[:time] if args.key?(:time)\n @severity = args[:severity] if args.key?(:severity)\n @log_message = args[:log_message] if args.key?(:log_message)\n @source_location = args[:source_location] if args.key?(:source_location)\n end",
"def update_soaplab_server(url)\n soaplab = SoaplabServer.find_by_location(url)\n data = soaplab.services_factory().values.flatten\n wsdls_from_server = data.collect{ |item| item[\"location\"]}\n registered_soaps = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n registered_wsdls = registered_soaps.collect{|s| s.wsdl_location}\n wsdls_from_relationships = soaplab.services.collect{|service| service.latest_version.service_versionified.wsdl_location}\n wsdls_to_add = registered_wsdls - wsdls_from_relationships \n submitter = nil\n unless soaplab.services.empty?\n submitter = User.find(soaplab.services.first.submitter_id)\n end\n \n \n soaps_to_add = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n services_to_add = soaps_to_add.collect{|s| s.service}\n puts \"server : #{url}\"\n puts \"No of relationships to add #{wsdls_to_add.length}\"\n puts wsdls_to_add\n unless wsdls_to_add.empty?\n if submitter.nil?\n submitter = User.find(SoapService.find_by_wsdl_location(wsdls_to_add.first).service.submitter_id)\n end\n soaplab.create_relationships(wsdls_to_add)\n create_tags_if_not_exist(services_to_add, submitter)\n end\n if soaplab.endpoint.nil?\n proxy_info = get_endpoint_and_name(url)\n unless proxy_info.empty?\n soaplab.endpoint = proxy_info[0] \n soaplab.name = proxy_info[1]\n soaplab.save\n end\n end\n end",
"def update\n @subscription = Subscription.find(params[:id])\n set_current_system list_to_system(@subscription.list)\n get_list_and_segments\n params[:subscription][:segments] ||= []\n @subscription.write_attributes(params[:subscription])\n @lyris = Lyris.new :update_member_demographics, :simple_member_struct_in => {:email_address => @subscription.email, :list_name => @subscription.list}, :demographics_array => @segments.keys.map {|e| {:name => e, :value => @subscription.segments.include?(e.to_s) ? 1 : 0}} if @segments.present?\n @subscription.save\n flash[:notice] = \"Newsletter Subscription settings have been updated.\"\n redirect_to(admin_subscriptions_url)\n end",
"def update\n respond_to do |format|\n if @counter_service.update(counter_service_params)\n format.html { redirect_to @counter_service, notice: 'Counter service was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_service }\n else\n format.html { render :edit }\n format.json { render json: @counter_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ncr_api_log.update(ncr_api_log_params)\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ncr_api_log }\n else\n format.html { render :edit }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update() end",
"def update!(**args)\n @version = args[:version] if args.key?(:version)\n @bindings = args[:bindings] if args.key?(:bindings)\n @rules = args[:rules] if args.key?(:rules)\n @etag = args[:etag] if args.key?(:etag)\n end",
"def update\n respond_to do |format|\n if @vinyl.update(vinyl_params)\n format.html { redirect_to @vinyl, notice: 'Vinyl was successfully updated.' }\n format.json { render :show, status: :ok, location: @vinyl }\n else\n format.html { render :edit }\n format.json { render json: @vinyl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @partial_vsi = args[:partial_vsi] if args.key?(:partial_vsi)\n @vsi_time = args[:vsi_time] if args.key?(:vsi_time)\n end",
"def update!(**args)\n @service_period = args[:service_period] if args.key?(:service_period)\n end",
"def update!(**args)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @log_scaling = args[:log_scaling] if args.key?(:log_scaling)\n @type = args[:type] if args.key?(:type)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def list_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\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 LoggingScalyrApi.list_log_scalyr\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"LoggingScalyrApi.list_log_scalyr\",\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: LoggingScalyrApi#list_log_scalyr\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def updating( msg )\n @log.info \"updating #{msg}\"\n end",
"def update_handle(label_and_version, provider=DEFAULT_PROVIDER, id)\n (label, _) = label_and_version.split('-')\n\n validate_access(label, provider)\n set_v2_security_context\n\n req = VCAP::Services::Api::HandleUpdateRequest.decode(body)\n\n service = Service[label: label, provider: provider]\n raise ApiError.new_from_details('ServiceNotFound', \"label=#{label} provider=#{provider}\") unless service\n\n plans_ds = service.service_plans_dataset\n instances_ds = ManagedServiceInstance.filter(service_plan: plans_ds)\n bindings_ds = ServiceBinding.filter(service_instance: instances_ds)\n\n instance = instances_ds[gateway_name: id]\n binding = bindings_ds[gateway_name: id]\n\n if instance\n instance.set(\n gateway_data: req.configuration,\n credentials: req.credentials,\n )\n instance.save_changes\n elsif binding\n binding.set(\n configuration: req.configuration.to_s,\n credentials: req.credentials.to_s,\n )\n binding.save_changes\n else\n raise ApiError.new_from_details('ServiceInstanceNotFound', \"label=#{label} provider=#{provider} id=#{id}\")\n end\n end",
"def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end",
"def update!(**args)\n @assured_workloads_monitoring = args[:assured_workloads_monitoring] if args.key?(:assured_workloads_monitoring)\n @data_logs_viewer = args[:data_logs_viewer] if args.key?(:data_logs_viewer)\n @service_access_approver = args[:service_access_approver] if args.key?(:service_access_approver)\n end",
"def update\n respond_to do |format|\n if @exchange_product_price_log.update(exchange_product_price_log_params)\n format.html { redirect_to @exchange_product_price_log, notice: 'Exchange product price log was successfully updated.' }\n format.json { render :show, status: :ok, location: @exchange_product_price_log }\n else\n format.html { render :edit }\n format.json { render json: @exchange_product_price_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @counter = args[:counter] if args.key?(:counter)\n @data_access = args[:data_access] if args.key?(:data_access)\n @cloud_audit = args[:cloud_audit] if args.key?(:cloud_audit)\n end",
"def update\n @service = Service.find(params[:id])\n if @service.update_attributes(sp_company)\n flash[:success] = \"Services form updated\"\n redirect_to services_path\n else\n render'edit'\n end\n end",
"def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @message = args[:message] if args.key?(:message)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end"
] | [
"0.60364985",
"0.5988784",
"0.57954115",
"0.56161684",
"0.550915",
"0.55066377",
"0.53505254",
"0.5313251",
"0.53059125",
"0.5304225",
"0.52992487",
"0.52992487",
"0.52992487",
"0.5291028",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5262566",
"0.5259317",
"0.5216979",
"0.52137756",
"0.5164508",
"0.5150618",
"0.5144337",
"0.5138518",
"0.51263213",
"0.5102849",
"0.5098126",
"0.50690997",
"0.50646555",
"0.506298",
"0.505331",
"0.50292313",
"0.50107247",
"0.49991846",
"0.49895233",
"0.4967178",
"0.49634373",
"0.49579766",
"0.49532333",
"0.49409628",
"0.493911",
"0.493911",
"0.49273446",
"0.4925346",
"0.4924411",
"0.4923443",
"0.49128175",
"0.49067277",
"0.4888934",
"0.48871857",
"0.48871857",
"0.48819938",
"0.48759624",
"0.4872833",
"0.48625645",
"0.48593643",
"0.48588598",
"0.48572055",
"0.48501736",
"0.4845864",
"0.48441324",
"0.48440105",
"0.48436463",
"0.48398975",
"0.48363748",
"0.4830105",
"0.48296478",
"0.48290977",
"0.4822939",
"0.48225397",
"0.4820428",
"0.48176715",
"0.48173723",
"0.48156303",
"0.48140284",
"0.48115793",
"0.4808327",
"0.4807113",
"0.48059875",
"0.48017842",
"0.47984314",
"0.47954375",
"0.47941136",
"0.47917888"
] | 0.6245973 | 0 |
virtual field item_name (setter method) | def item_name=(name)
self.item_id = Item.find_by(name: name).id if name.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end",
"def name\n \tself.item.name\n end",
"def change_item_name(new_name:, **)\n self.name = new_name # This will generate the event!\n end",
"def item_name\n return if self.item_id.nil?\n\n # TODO: Redundant now\n if self.item_id.present?\n self.item_id\n else\n self.item.name\n end\n end",
"def name\n Item.find(item_id).name\n end",
"def name\n Item.find(item_id).name\n end",
"def name_setter\n @name\n end",
"def item_name\n item.try(:name)\n end",
"def set_item_name(value, index = 0)\n value = GameData::Item[value].name if value.is_a?(Integer) || value.is_a?(Symbol)\n set_variable(ITEM2[index].to_s, value.to_s)\n end",
"def name=(str); dirty!; super; end",
"def item=(item)\n @item = item\n end",
"def set_magic_item_name\n @magic_item_name = MagicItemName.find(params[:id])\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def item_name\n return GameData::Item[item_db_symbol].name\n end",
"def item_name\n params['item_name']\n end",
"def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def name\n self.title\n end",
"def name\n self.title\n end",
"def name\n self.title\n end",
"def name; super; end",
"def name; super; end",
"def name(item)\n return $data_items[item.item_id].name if item.item?\n return $data_system.item_types[item.category_id] if item.category?\n end",
"def name\n self[:name]\n end",
"def name\n self[:name]\n end",
"def get_name\r\n self.name\r\n end",
"def item(name)\n __item(name)\n end",
"def item_title(item)\n item.title\n end",
"def name=(val)\n self['name'] = val\n end",
"def name\n metadata['itemName'] rescue nil\n end",
"def name ; self[:name].downcase end",
"def name_setter(new_name)\n @name = new_name\n end",
"def item=(new_item)\n @item = new_item\n self.item_id = @item.id\n self.item_type = new_item.class.name.classify\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def name=(value); end",
"def renamed(item, oldName, newName)\n end",
"def name\n @_name\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def set_item\n @item = @variant.item\n end",
"def iname=(val)\n attributes['name'] = val\n end",
"def iname=(val)\n attributes['name'] = val\n end",
"def iname=(val)\n attributes['name'] = val\n end",
"def setName=(name)\n @name = name\n end",
"def rename(id, name = \"\")\n item = Item.find(id)\n item.class == Item ? item.update(:name => name) : item\n end",
"def name\n @name || super\n end",
"def name\n\t\t@name\n\tend",
"def name\n\t\t@name\n\tend",
"def name\n\t\t@name\n\tend",
"def name\n\t\t@name\n\tend",
"def name\n\t\t@name\n\tend",
"def name\n\t\t@name\n\tend",
"def name\n\t\tself.title\n\tend",
"def name\n self['name']\n end",
"def name\n self[:name]\n end",
"def item_title item, title_attribute = nil\n if title_attribute\n item.send(title_attribute)\n else\n columns = item.class.column_names\n if columns.include?('name')\n item.send('name')\n elsif columns.include?('title')\n item.send('title')\n else\n \"Title not available\"\n end\n end\n end",
"def setNamedItem(item)\n node.setAttributeNode(item)\n end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(val)\n self[:name] = val\n end",
"def set_material_item_name\n @material_item_name = MaterialItemName.find(params[:id])\n end",
"def my_name()\n self.name\n end",
"def name=(name)\n\t@name = name\nend",
"def name\n super\n end",
"def name\n @name \n end",
"def name \r\n\t @name\r\n end",
"def item; @item; end",
"def item; @item; end",
"def name=(name)\n end",
"def data_import_item=(value)\n raise 'To be implemented in child classes'\n end",
"def getName; @name; end",
"def item=(i)\n\t\t@item = i\n\tend",
"def set_name\n @set.name\n end",
"def name\n @name\n end",
"def set_name=(name)\n @name=name\n end",
"def name\n super.to_s\n end",
"def name\n super.to_s\n end",
"def name\n unless recipe_item_id.blank?\n case recipe_item_type\n when \"Ingredient\"; recipe_item.name\n when \"Recipe\"; recipe_item.name\n end\n end\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end"
] | [
"0.780851",
"0.7795141",
"0.7459489",
"0.7081856",
"0.70643127",
"0.70643127",
"0.70234007",
"0.67129064",
"0.6704625",
"0.6614914",
"0.65696025",
"0.6476148",
"0.63948894",
"0.6305682",
"0.629535",
"0.6270202",
"0.62671095",
"0.6245056",
"0.6240958",
"0.6233211",
"0.6233211",
"0.6233211",
"0.62270075",
"0.62270075",
"0.62188494",
"0.6213334",
"0.6213334",
"0.62046313",
"0.62019134",
"0.6194319",
"0.6170395",
"0.616595",
"0.6158167",
"0.615496",
"0.6150474",
"0.61454725",
"0.6139112",
"0.6119995",
"0.61199033",
"0.6115062",
"0.611415",
"0.6102553",
"0.60903144",
"0.60903144",
"0.60903144",
"0.6088044",
"0.6086916",
"0.60802126",
"0.6076192",
"0.6076192",
"0.6076192",
"0.6076192",
"0.6076192",
"0.6076192",
"0.6070272",
"0.6067181",
"0.6066731",
"0.6062759",
"0.60604346",
"0.6050292",
"0.6050292",
"0.6050292",
"0.6050292",
"0.6050292",
"0.6050292",
"0.6050292",
"0.6050292",
"0.60485125",
"0.60406446",
"0.6038031",
"0.6031571",
"0.6022909",
"0.60210884",
"0.6016737",
"0.6013541",
"0.6013541",
"0.6012528",
"0.6011487",
"0.5994836",
"0.59879017",
"0.59850574",
"0.59834915",
"0.5980326",
"0.59801716",
"0.59801716",
"0.59784675",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496",
"0.5973496"
] | 0.74443793 | 3 |
Checks if the given key is a box (geofences) or not. A box is composed of four numbers (positive or negative, decimal or not) separed by commas. | def process(key, options = {})
before_all(key, options)
match?(key, /^(?:[+-]?\d{1,3}(?:\.\d{1,7})?,?){4}$/) ? store(key, nil, options) : raise_type_error(key, "Box")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_box?(box_key, num)\n @boxes[box_key].each {|square| return true if square.number == num}\n false\n\n end",
"def parse_box(key, box)\n if box.kind_of?(String)\n begin\n raw_box = box.split(\",\").map(&:to_f)\n box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_box[3]]]\n rescue\n raise_error(type: \"box.format\", key: \"key\", value: box)\n end\n end\n return box\n end",
"def is_box?(); @type == GRT_BOX; end",
"def is_boxtype?(); @type == GRT_BOXTYPE; end",
"def checkSpot(box)\n #validate if the cloud maxwidth isn't violated\n if @maxWidth > 0\n lx = [@ul.x, box.ul.x].min\n rx = [@lr.x, box.lr.x].max\n if((rx - lx) > @maxWidth)\n return false\n end\n end\n \n # validate if the box doesn't overlap other boxes\n ok = true\n for tb in @boxes\n if tb.inPosition && box.overlaps(tb)\n ok = false\n \n break\n end\n end\n return ok\n end",
"def box_contains?(key, container, contained)\n container = parse_box(key, container)\n contained = parse_box(key, contained)\n result = ((container[0][0] <= contained[0][0]) and (container[0][1] <= container[0][1]) and (container[1][0] >= container[1][0]) and (container[1][1] >= container[1][1]))\n raise_error(type: \"box.containment\", contained: contained, container: container, key: key) unless result\n end",
"def in_bounding_box?(point, box)\n if point.lon > box.west_lon and point.lon < box.east_lon and point.lat < box.north_lat and point.lat > box.south_lat\n return true\n else\n return false \n end\n end",
"def format_bbox(box)\n box.values.each_slice(2).to_a\n end",
"def bbox(key)\n position = pdf_field(key).getWidgets().get(0).getRectangle()\n bbox = BoundingBox.new(position.getAsNumber(0).getValue(),\n position.getAsNumber(1).getValue(),\n position.getAsNumber(2).getValue() - position.getAsNumber(0).getValue(),\n height = position.getAsNumber(3).getValue() - position.getAsNumber(1).getValue()\n )\n return bbox\n end",
"def boxes\n box_lines.map {|l| parse_line l.match(PARSE_BOX) }.to_set\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor!\n collision_left!\n collision_right!\n collision_ceiling!\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor\n collision_left\n collision_right\n collision_ceiling\n end",
"def is_box_full(column, line)\n if @array[column][line] != \" \"\n return true\n else\n return false\n end\n end",
"def box(body)\n formatted_box(body, :blue, \"ℹ\", \"\")\nend",
"def in_key_bounds?(key, x, y)\n bounds = @keys[key]\n x += @params[:xoffset]\n y += @params[:yoffset]\n x >= bounds[:left] - @params[:hmargin] / 2 &&\n x <= bounds[:right] + @params[:hmargin] / 2 &&\n y >= bounds[:top] - @params[:vmargin] / 2 &&\n y <= bounds[:bottom] + @params[:vmargin] / 2\n end",
"def inBox(box, point)\n # Make a box with the point and the SE corner of the box.\n # Make another box with the point and the NE Corner of the box.\n # Combine the new boxes.\n # The point is inside the given box, if the area of the combined boxes is\n # equal (or a little less than due to roundoff error) than the area of the given box.\n box1 = getBox(point,box[1])\n box2 = getBox(box[1],point)\n box3 = combineBoxes( box1, box2 )\n return area(box3) <= area(box)\n end",
"def boxing\n phone = { w: 5, l: 7.4, h: 4 }\n box = { w: 32, l: 43, h: 22.1 }\n amount = { w: 5, l: 7.4, h: 4 }\n\n wn = 0\n ln = 0\n hn = 0\n\n\n while amount[:w] <= box[:w]\n amount[:w] += phone[:w]\n wn += 1\n end\n while amount[:l] <= box[:h]\n amount[:l] += phone[:l]\n ln += 1\n end\n while amount[:h] <= box[:h]\n amount[:h] += phone[:h]\n hn += 1\n end\n\n # if phone[:l] <= box[:l]\n # ln += phone[:l]\n # end\n\n puts volume = wn * ln * hn\n\nend",
"def valid?\n values.size == Merit::POINTS &&\n surface > 1 / 3601.0 && surface < 1 / 3599.0\n end",
"def test_contains_point_false\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(15,15,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: greater' )\n\n point = Geom::Point3d.new(-10,-10,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: lessthan' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed1' )\n\n point = Geom::Point3d.new(5,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed3' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed3' )\n\n point = Geom::Point3d.new(-10,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed4' )\n\n point = Geom::Point3d.new(-10,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed5' )\n\n point = Geom::Point3d.new(-10,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed6' )\n\n\n point = Geom::Point3d.new(15,5,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed7' )\n\n point = Geom::Point3d.new(15,15,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed8' )\n\n point = Geom::Point3d.new(15,5,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed9' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed10' )\n\n point = Geom::Point3d.new(5,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed11' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed12' )\n end",
"def coordinates_inside_box?(x_idx, y_idx)\n (x_idx >= 0 && x_idx < width) && (y_idx >= 0 && y_idx < height)\n end",
"def test_contains_point_true\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(5,5,5)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: center' )\n\n point = Geom::Point3d.new(0,0,0)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: min' )\n\n point = Geom::Point3d.new(10,10,10)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: max' )\n end",
"def is_part_of_bill?(key)\n Invoice::BILL_ITEM_TYPES.include?(key)\n end",
"def box_imported?(box)\n run_cmd(\"vagrant box list\").include?(box)\n end",
"def store(key, process, options)\n if(options.has_key?(:at_least))\n box_contains?(key, validator.datas[key], options[:at_least])\n end\n if(options.has_key?(:at_most))\n box_contains?(key, options[:at_most], validator.datas[key])\n end\n super(key, ->(item){parse_box(key, validator.datas[key])}, options)\n end",
"def boxes\n @pz.group_by.each_with_index { |val, n| box_id(n) }\n end",
"def correct_data_format?(value)\n return false unless only_allowed_keys?(value)\n\n value.any? do |_key, val|\n val.present? && val.is_a?(Array) && val.all? { |el| el.is_a?(Numeric) }\n end\n end",
"def does_it_fit?(book, box)\n max_weight = 10\n book + box <= max_weight\n end",
"def get_boxes(features)\n result = {}\n result[:watson] = features.select { |f| f.strand == '+' }.collect { |e| e.to_box }\n result[:crick] = features.select { |f| f.strand == '-' }.collect { |e| e.to_box }\n return result\n end",
"def bounding_box\n unless @bbox\n p = @points[0]\n minX = p[0]\n maxX = p[0]\n minY = p[1]\n maxY = p[1]\n minZ = p[2]\n maxZ = p[2]\n @points.each{|p|\n minX = p[0] if p[0] < minX \n maxX = p[0] if p[0] > maxX \n minY = p[1] if p[1] < minY \n maxY = p[1] if p[1] > maxY \n minZ = p[2] if p[2] < minZ \n maxZ = p[2] if p[2] > maxZ \n }\n @max = Vector[maxX, maxY,maxZ]\n @min = Vector[minX, minY, minZ]\n @bbox = Volume.new([Plane.new(-1,0,0, minX, minY, minZ), \n Plane.new(0,-1,0, minX, minY, minZ),\n Plane.new(0,0,-1, minX, minY, minZ),\n Plane.new(1,0,0, maxX, maxY, maxZ),\n Plane.new(0,1,0, maxX, maxY, maxZ), \n Plane.new(0,0,1, maxX, maxY, maxZ)])\n end\n @bbox\n end",
"def taken?(box)\n box.mark != \" \" ? true : false\n end",
"def check_for_boxes\n @boxes = []\n box_parser_hook = 'rpick_box_parser_hook'\n\n box_parser = Proc.new do |server_string|\n if server_string =~ /\\d+ items displayed/\n DownstreamHook.remove(box_parser_hook)\n elsif server_string =~ Dictionary.box_finder_regex\n box_id = $1\n box_noun = $2\n box_name = $3\n @boxes << { id: box_id, noun: box_noun, name: box_name }\n nil\n else\n nil\n end\n end\n\n DownstreamHook.add(box_parser_hook, box_parser)\n fput \"inv full\"\n end",
"def inside?(key)\n @counter[key] > 0\n end",
"def detectCollision(x, y, width, height)\n @points.each_key { |pnt|\n\t\t\t# does the proposed box start in the middle of another box?\n if (@points[pnt]['y1'] == y) && (x < @points[pnt]['x2']) && (x >= @points[pnt]['x1'])\n return pnt\n end\n\t\t\t# does the proposed box end in the middle of another box?\n if (@points[pnt]['y1'] == y) && ((x+width) > @points[pnt]['x1']) && ((x+width) < @points[pnt]['x2'])\n return pnt\n end\n \n\t\t\t# does the proposed box end in the middle of a box? \n if (@points[pnt]['y1'] == y) && (x < @points[pnt]['x1']) && ((x+width) > @points[pnt]['x2'])\n return pnt\n end\n }\n return nil\n end",
"def check_box(row, col)\n @possible_solutions_box = []\n key = \"#{row/3}#{col/3}\"\n (0..9).each do |i|\n if @hash[key].include?(i.to_s) == false\n @possible_solutions_box << i.to_s\n end\n end\n @possible_solutions_box\n end",
"def key?(p0) end",
"def test_whichways_toobig\n bbox = [-0.1, -0.1, 1.1, 1.1]\n check_bboxes_are_bad [bbox] do |map, _bbox|\n assert_boundary_error map, \" The server said: The maximum bbox size is 0.25, and your request was too large. Either request a smaller area, or use planet.osm\"\n end\n end",
"def boxed_price\n if mode == 'boxed'\n price * volume\n else\n raise \"Boxed prices are only available on boxed price points\"\n end\n end",
"def check_place_params *args\n if args.length != 3\n throw_error \"wrong number of arguments for place: (#{args.length} for 3)\"\n return false\n end\n # params number is 3 ...\n x = args[0].to_i if is_integer args[0]\n y = args[1].to_i if is_integer args[1]\n face = args[2]\n faces = Constants::FACES\n\n case\n when !is_integer(args[0])\n throw_error \"x should be an integer\"\n when !is_integer(args[1])\n throw_error \"y should be and integer\"\n when face.class != String\n throw_error \"face should be string type\"\n when x > @xmax || x < 0\n throw_error \"x exceed the limitation\"\n when y > @ymax || y < 0\n throw_error \"y exceed the limitation\"\n when faces.index(face.downcase).nil?\n throw_error \"face value should be one of the #{faces}\"\n else\n return true\n end \n end",
"def v1_box?(dir)\n # We detect a V1 box given by whether there is a \"box.ovf\" which\n # is a heuristic but is pretty accurate.\n dir.join(\"box.ovf\").file?\n end",
"def which_box(row, col)\n if (0..2).include?(row) && (0..2).include?(col)\n return \"box_1\"\n elsif (0..2).include?(row) && (3..5).include?(col)\n return \"box_2\"\n elsif (0..2).include?(row) && (6..8).include?(col)\n return \"box_3\"\n elsif (3..5).include?(row) && (0..2).include?(col)\n return \"box_4\"\n elsif (3..5).include?(row) && (3..5).include?(col)\n return \"box_5\"\n elsif (3..5).include?(row) && (6..8).include?(col)\n return \"box_6\"\n elsif (6..8).include?(row) && (0..2).include?(col)\n return \"box_7\"\n elsif (6..8).include?(row) && (3..5).include?(col)\n return \"box_8\"\n elsif (6..8).include?(row) && (6..8).include?(col)\n return \"box_9\"\n else\n p \"illegal index\"\n end\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 ace_value?(value)\n value.size == 2\n end",
"def is_elkey?(); @type == GRT_ELKEY; end",
"def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end",
"def outside?(key)\n @counter[key] == 0\n end",
"def check_box(box)\n\t\tunless @board_status.keys.include?(box)\n\t\t\treturn \"please choose a square like this\\r\\n1 2 3\\r\\n4 5 6\\r\\n7 8 9\"\n\t\tend\n\t\tunless @board_status[box] == @default_box\n\t\t\treturn \"Something is already there\"\n\t\tend\n\t\t@swap_player = true\n\t\treturn \"\"\n\tend",
"def findSpot(box)\n spotFound = false\n \n if @points.size == 0\n #sp = Point.new(0,0)\n spotFound = checkSpot(box)\n else\n #extend list of possible attachpoint with all corners of the Box\n # make sure the cloud doesn't get too wide\n if !in_shape? && box.values[:angle] == 0\n box.rotate\n end\n pss=createSpotGroup(box)\n spotFound = checkSpotGroup(pss,box) \n if (!spotFound)\n box.rotate\n pss=createSpotGroup(box)\n spotFound=checkSpotGroup(pss,box)\n end \n end\n\n if spotFound\n # mark box as in position\n box.inPosition = true\n \n # add the box attachpoints\n @points = @points.concat box.corners\n \n # recalculate (cloud) box boundaries\n @ul.x = [@ul.x, box.ul.x].min\n @ul.y = [@ul.y, box.ul.y].min\n @lr.x = [@lr.x, box.lr.x].max\n @lr.y = [@lr.y, box.lr.y].max\n \n @height = @lr.y - @ul.y\n @width = @lr.x - @ul.x\n else\n #puts(\"XXX WTF????? can't find spot!!!\")\n end\n return spotFound\n end",
"def box!(banner = nill)\n\n theEdge = self.genBar('=')\n theEdge.lPad!('+')\n theEdge.rPad!('==+')\n self.lPad!('| ')\n self.rPad!(' |')\n\n theBox = TextRect.new(banner)\n theBox.below!(theEdge)\n theBox.below!(self)\n @theLines = theBox.lines\n return self.below!(theEdge)\n\n end",
"def exists_in_box(grid, start_row, start_column, number)\n row = 0\n column = 0\n while row < 3\n column = 0\n while column < 3\n return true if grid[row + start_row][column + start_column] == number\n column += 1\n end\n row += 1\n end\n return false\nend",
"def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, Float::MAX, -Float::MAX, Float::MAX \r\n if with_z\r\n max_z, min_z = -Float::MAX, Float::MAX\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n [Point.from_x_y_z(min_x,min_y,min_z),Point.from_x_y_z(max_x,max_y,max_z)]\r\n else\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n end\r\n [Point.from_x_y(min_x,min_y),Point.from_x_y(max_x,max_y)]\r\n end\r\n end",
"def is_platform_block?(key)\n raise 'No key given'.red unless key\n\n return false if (self.runner.blocks[nil][key.to_sym] rescue false)\n return true if self.runner.blocks[key.to_sym].kind_of?Hash\n\n raise \"Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}\".red\n end",
"def valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n return false if !point_satisfies_equation?(point)\n point.multiply_by_scalar(order).infinity?\n end",
"def boxed\n @boxed = true\n end",
"def test_bbox_span_equator\n\n hIn = @@aIn[6]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal -179.0, metadata[:westLongitude]\n assert_equal -65.0, metadata[:southLatitude]\n assert_equal -48.0, metadata[:eastLongitude]\n assert_equal 62.45, metadata[:northLatitude]\n\n end",
"def check_hit(box) # Checa se a hitbox tem overlap com outra hitbox\n heightimp = false\n @zlist.each do |heightLevel| # Checa impacto de altura, se não tem impacto de altura, um objeto no maximo passa por cima do outro sem colidir\n box.zlist.each do |hitheight|\n if (heightLevel == hitheight) # Qualquer nivel de altura ser igual a qualquer nivel de altura da outra hitbox é o bastante pra ter impacto de altura\n heightimp = true\n end\n end\n end\n if (((@x > box.x + box.width or box.x > @x + @width) or (@y > box.y + box.length or box.y > @y + @length)) or (heightimp == false)) # Se não tem overlap bidimensional ou não há impacto de altura, não tem colisão\n return false\n else\n return true\n end\n end",
"def key?(key)\n key = to_key key\n @group.key? key\n end",
"def box_it(array_of_lines, padding = 1, _box_colour = :bc_cyan)\n max_length = max_box_line_length(array_of_lines)\n pad_string = \"\\s\" * padding\n\n box_lines = [\n # Set the top box line\n \"#{BOX_TOP_LEFT}#{BOX_HORIZONTAL_LINE * (max_length + (padding + 1))}#{BOX_TOP_RIGHT}\"\n ]\n\n array_of_lines.each do |line|\n line_length = line.sanitize.length\n box_lines << \"#{BOX_SIDE}#{pad_string}\" + line.to_s + \"#{\"\\s\" * (max_length - line_length)}#{pad_string}#{BOX_SIDE}\"\n end\n\n # Set the bottom box line\n box_lines << \"#{BOX_BOTTOM_LEFT}#{BOX_HORIZONTAL_LINE * (max_length + (padding + 1))}#{BOX_BOTTOM_RIGHT}\"\n box_lines\n end",
"def valid_coordinates\n input.length == 2 && input.all? { |value| value.match? /\\A\\d+\\z/ }\n end",
"def airship_land_ok_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0800) && check_passage(x2, y2, 0x0f)\r\r\n return false unless check_passage(x2, y3, 0x0800) && check_passage(x2, y3, 0x0f)\r\r\n return false unless check_passage(x3, y2, 0x0800) && check_passage(x3, y2, 0x0f)\r\r\n return check_passage(x3, y3, 0x0800) && check_passage(x3, y3, 0x0f)\r\r\n end",
"def bounding_box\r\n end",
"def multiple_pieces?\n 1 < all_coords.count { |coord| self[coord] != :empty }\n end",
"def any_space?(volume_to_add)\n if current_space > volume_to_add.to_i\n true\n else\n puts 'Can\\'t add parcel. Too Big'\n false\n end\n end",
"def boat_passable_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0200)\r\r\n return false unless check_passage(x2, y3, 0x0200)\r\r\n return false unless check_passage(x3, y2, 0x0200)\r\r\n return check_passage(x3, y3, 0x0200)\r\r\n end",
"def geo_within_box_query(box)\n {\n '$geoWithin' => {\n '$box' => [[box.w, box.s], [box.e, box.n]]\n }\n }\n end",
"def collision_detected?\n ($boxes - Array(self)).any? do |other_box|\n # .include method with other_square\n other_box.include?(@square)\n end\nend",
"def boxes\n return @@boxes\n end",
"def boxes \n\n all_boxes = []\n @raw.each do |h|\n\n if [\"status\", \"media\", \"request\"].include?(h[0]) == false && h[1]['boxes'] != nil \n all_boxes << h[1]['boxes'][0] \n end \n end \n return all_boxes\n end",
"def key?(*) end",
"def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end",
"def allure?(key)\n key.to_s.match?(/allure(_\\d+)?/i)\n end",
"def getBlockType posX posY\n\t\t# true: lugar vazio ou com bloco de buff\n\t\t# false: demais ocasioes\n\tend",
"def contains?(point_or_bb)\n end",
"def box_text_by_value(val, lang = I18n.locale)\n raise \"Value must be integer\" unless val.is_a?(Integer)\n raise \"Value is out of range. Only 1-#{boxes.size} is valid, given was #{val}.\" unless val.between?(1, boxes.size)\n boxes[val-1] ? boxes[val-1].any_text : \"#{val}/#{boxes.size}\"\n end",
"def test_whichways_badlat\n bboxes = [[0, 0.1, 0.1, 0], [-0.1, 80, 0.1, 70], [0.24, 54.35, 0.25, 54.33]]\n check_bboxes_are_bad bboxes do |map, bbox|\n assert_boundary_error map, \" The server said: The minimum latitude must be less than the maximum latitude, but it wasn't\", bbox.inspect\n end\n end",
"def partially_valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n point_satisfies_equation?(point)\n end",
"def pbBoxesFull?\n return !$Trainer || ($Trainer.party.length==6 && $PokemonStorage.full?)\nend",
"def valid_spot args\n ball_center_x = args.state.cueball[:x] + (args.state.ball_diameter / 2)\n ball_center_y = args.state.cueball[:y] + (args.state.ball_diameter / 2)\n pocket_radius = args.state.pocket_diameter / 2\n\n # if you can place anywhere, check each pocket, else, just check left two pockets\n if args.state.scratch_choice == 0\n args.state.pockets.each do |pocket|\n dist = (((ball_center_x - pocket[0]) ** 2) + ((ball_center_y - pocket[1]) ** 2)) ** (1/2)\n if dist <= pocket_radius\n return false\n end\n end\n else\n dist_to_bottom = (((ball_center_x - args.state.tableleft) ** 2) + ((ball_center_y - args.state.tablebottom) ** 2)) ** (1/2)\n dist_to_top = (((ball_center_x - args.state.tableleft) ** 2) + ((ball_center_y - args.state.tabletop) ** 2)) ** (1/2)\n if dist_to_bottom < pocket_radius || dist_to_top < pocket_radius\n return false\n end\n end\n\n # check each ball on the table\n num_balls = args.state.balls.length\n ball1 = args.state.balls[0]\n (1..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n return false\n end\n end\n return true\nend",
"def sanity_check_ballot_coords\n \n end",
"def rectangle?()\n return @type == \"rectangle\"\n end",
"def partify key\n nums = key.scan(/[0-9]/).join.to_i\n spaces = key.scan(/ /).size\n \n raise \"Key Error: #{key} has no spaces\" if spaces == 0\n raise \"Key Error: #{key} nums #{nums} is not an integral multiple of #{spaces}\" if (nums % spaces) != 0\n\n [nums / spaces].pack(\"N*\")\n end",
"def leaf?\n (keys - [:name, :balance]).empty?\n end",
"def empty_square(b)\n b.keys.select{|position| b[position] == \" \"}\nend",
"def balance_space?\n inside_empty_brackets?\n end",
"def key_length_valid?(number)\n number >= 1024 && ( number & (number - 1) == 0 )\n end",
"def key_length_valid?(number)\n number >= 1024 && ( number & (number - 1) == 0 )\n end",
"def play(figure, box)\n\t\t\n\t\tif @ca[box.byteslice(0).to_i][box.byteslice(1).to_i] == \" \"\n\t\t\t@ca[box.byteslice(0).to_i][box.byteslice(1).to_i] = figure \n\t\t\t\telse\n\t\t\t\t\tputs \"rentre une case vide!!!!!\".center(200)\n\t\tend\n#les combinaisons gagnantes\n\t\tif (@ca[0][0].include?(figure) && @ca[0][0] == @ca[0][1] && @ca[0][1] == @ca[0][2]) ||\n\t\t\t (@ca[1][0].include?(figure) && @ca[1][0] == @ca[1][1] && @ca[1][1] == @ca[1][2]) ||\n\t\t\t (@ca[2][0].include?(figure) && @ca[2][0] == @ca[2][1] && @ca[2][1] == @ca[2][2]) ||\n\t\t\t (@ca[0][0].include?(figure) && @ca[0][0] == @ca[0][1] && @ca[0][1] == @ca[0][2]) ||\n\t\t\t (@ca[1][0].include?(figure) && @ca[1][0] == @ca[1][1] && @ca[1][1] == @ca[1][2]) ||\n\t\t\t (@ca[2][0].include?(figure) && @ca[2][0] == @ca[2][1] && @ca[2][1] == @ca[2][2]) ||\n\t\t\t (@ca[0][0].include?(figure) && @ca[0][0] == @ca[1][1] && @ca[1][1] == @ca[2][2]) ||\n\t\t\t (@ca[2][0].include?(figure) && @ca[2][0] == @ca[1][1] && @ca[1][1] == @ca[0][2])\n\t\t\t then\n\t\t\t return true\n\t\t\t\telse\n\t\t\t\treturn false\n\t\tend\n\tend",
"def build_bounding_box(bounding_box)\n \"#{bounding_box[:sw_latitude]},#{bounding_box[:sw_longitude]}|#{bounding_box[:ne_latitude]},#{bounding_box[:ne_longitude]}\"\n end",
"def valid1 deck\n print \"\\t#{1}) %-39s \" % deck[12][4, 20]\n print \"\\t#{2}) %-39s \" % deck[9][4, 20]\n print \"\\t#{3}) %-39s \" % deck[15][4, 20]\n puts 'same color - same number - same shape - dif shade'\n puts\nend",
"def po_box\n \"PO BOX #{po_box_number}\" unless po_box_number.vacant?\n end",
"def returnBlocked?(x, y)\n #Gets the coordinate of the position in terms of tiles. If the key object array reveals that\n #this coordinate space is occupied, returns true. Otherwise, returns false.\n if @KobjectArray[x / 16][(y + 16) / 16] == true\n return true\n else\n return false\n end\n end",
"def bounding_box\r\n unless with_z\r\n [Point.from_x_y(@x,@y),Point.from_x_y(@x,@y)]\r\n else\r\n [Point.from_x_y_z(@x,@y,@z),Point.from_x_y_z(@x,@y,@z)]\r\n end\r\n end",
"def enumerateBoxes(stepSize, row, col, rows, cols)\r\n maxBoxCol = cols-stepSize\r\n raise(\"LCU::enumerateBoxes - step size wider than map\") if maxBoxCol < 0\r\n \r\n maxBoxRow = rows-stepSize\r\n raise(\"LCU::enumerateBoxes - step size taller than map\") if maxBoxRow < 0\r\n \r\n boxC = col\r\n \r\n boxR = row\r\n \r\n boxesPresent = {}\r\n \r\n # include all neighboring boxes\r\n (-stepSize+1).upto(0) do | dr |\r\n tRow = boxR + dr\r\n next if tRow < 0 or tRow > maxBoxRow\r\n (-stepSize+1).upto(0) do | dc |\r\n tCol = boxC + dc\r\n next if tCol < 0 or tCol > maxBoxCol\r\n boxesPresent[boxNum(tRow,tCol,maxBoxCol+1)] = true\r\n end\r\n end\r\n \r\n # print \"EnumBoxes() - size: #{stepSize} row: #{row} col:#{col} boxes: #{boxesPresent.keys.join(\",\")}\\n\"\r\n \r\n boxesPresent.keys\r\n end",
"def check_the_bucket(bucket)\n bucket.include? 'gold'\nend",
"def box_index(slot)\n box_index = {\n 0 => [0, 1, 2, 9, 10, 11, 18, 19, 20],\n 1 => [3, 4, 5, 12, 13, 14, 21, 22, 23],\n 2 => [6, 7, 8, 15, 16, 17, 24, 25, 26],\n 3 => [27, 28, 29, 36, 37, 38, 45, 46, 47],\n 4 => [30, 31, 32, 39, 40, 41, 48, 49, 50],\n 5 => [33, 34, 35, 42, 43, 44, 51, 52, 53],\n 6 => [54, 55, 56, 63, 64, 65, 72, 73, 74],\n 7 => [57, 58, 59, 66, 67, 68, 75, 76, 77],\n 8 => [60, 61, 62, 69, 70, 71, 78, 79, 80]\n }\n # FIND the box(key) that includes to the given slot(value)\n box_index.keys.find { |k| box_index[k].include?(slot) }\n end",
"def print_employee_data_box(box_x, box_y)\n\n # Draw box.\n x = box_x\n y = box_y - 0.375\n self.vms_text_box(@data[:employee][:ssn], x, y, 1.25, 0.25, 7, :bold, :center, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:wages][:gross]), x + 1.3, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:taxes][:federal]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.25\n self.vms_text_box(curr(@data[:wages][:social_security]), x + 1.3, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:taxes][:social_security]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.125\n self.vms_text_box(@data[:employer][:ein], x, y, 1.25, 0.25, 7, :bold, :center, :center, @data_font, @data_color)\n y -= 0.125\n self.vms_text_box(curr(@data[:wages][:medicare]), x + 1.3, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:taxes][:medicare]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.25\n self.vms_text_box(\"#{@data[:employer][:name]}\\n#{@data[:employer][:street]}\\n#{@data[:employer][:city]}, #{@data[:employer][:state]} #{@data[:employer][:zip]}\", x + 0.05, y, 3.65, 0.625, 7, :bold, :left, :center, @data_font, @data_color)\n y -= 1\n self.vms_text_box(\"#{@data[:employee][:name]}\\n#{@data[:employee][:street]}\\n#{@data[:employee][:city]}, #{@data[:employee][:state]} #{@data[:employee][:zip]}\", x + 0.05, y, 3.65, 0.625, 7, :bold, :left, :center, @data_font, @data_color)\n y -= 1\n self.vms_text_box(@data[:box_12][:a][:code], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:box_12][:a][:amount]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.25\n self.vms_text_box(\"X\", x + 0.05, y, 0.9, 0.125, 7, :bold, :center, :center, @data_font, @data_color) if @data[:box_13][:statutory]\n self.vms_text_box(@data[:box_12][:b][:code], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:box_12][:b][:amount]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.25\n self.vms_text_box(\"X\", x + 0.05, y, 0.9, 0.125, 7, :bold, :center, :center, @data_font, @data_color) if @data[:box_13][:retirement]\n self.vms_text_box(@data[:box_12][:c][:code], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:box_12][:c][:amount]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.25\n self.vms_text_box(\"X\", x + 0.05, y, 0.9, 0.125, 7, :bold, :center, :center, @data_font, @data_color) if @data[:box_13][:third_party_sick]\n self.vms_text_box(@data[:box_12][:d][:code], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:box_12][:d][:amount]), x + 2.55, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n y -= 0.125\n unless @data[:state][0].blank?\n self.vms_text_box(@data[:state][0][:code], x, y, 0.3, 0.125, 7, :bold, :center, :center, @data_font, @data_color)\n self.vms_text_box(@data[:state][0][:ein], x + 0.35, y, 1, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:state][0][:wages]), x + 1.45, y, 1.1, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:state][0][:tax]), x + 2.65, y, 1.05, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n end\n y -= 0.125\n unless @data[:state][1].blank?\n self.vms_text_box(@data[:state][1][:code], x, y, 0.3, 0.125, 7, :bold, :center, :center, @data_font, @data_color)\n self.vms_text_box(@data[:state][1][:ein], x + 0.35, y, 1, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:state][1][:wages]), x + 1.45, y, 1.1, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:state][1][:tax]), x + 2.65, y, 1.05, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n end\n y -= 0.375\n unless @data[:local][0].blank?\n self.vms_text_box(curr(@data[:local][0][:wages]), x + 0.05, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:local][0][:tax]), x + 1.3, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(@data[:local][0][:name], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n end\n y -= 0.125\n unless @data[:local][1].blank?\n self.vms_text_box(curr(@data[:local][1][:wages]), x + 0.05, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(curr(@data[:local][1][:tax]), x + 1.3, y, 1.15, 0.125, 7, :bold, :right, :center, @data_font, @data_color)\n self.vms_text_box(@data[:local][1][:name], x + 2.55, y, 1.15, 0.125, 7, :bold, :left, :center, @data_font, @data_color)\n end\n\n end"
] | [
"0.65874696",
"0.6503024",
"0.5919946",
"0.5908663",
"0.5664747",
"0.56501156",
"0.55428696",
"0.5420609",
"0.5377301",
"0.5297279",
"0.5212655",
"0.52116174",
"0.50986236",
"0.5096228",
"0.5089915",
"0.5082816",
"0.49951968",
"0.49728826",
"0.49382535",
"0.49322402",
"0.49093297",
"0.48570862",
"0.4856026",
"0.48227265",
"0.48214334",
"0.48209903",
"0.48152336",
"0.47883955",
"0.47786",
"0.47609186",
"0.47572106",
"0.4730526",
"0.47302076",
"0.47285476",
"0.47268608",
"0.47262636",
"0.4726186",
"0.4723769",
"0.4721199",
"0.4705742",
"0.46931756",
"0.46931756",
"0.46931756",
"0.46931756",
"0.46931756",
"0.46931756",
"0.46910515",
"0.4672926",
"0.46435913",
"0.46390378",
"0.46371555",
"0.46344483",
"0.46327096",
"0.4632652",
"0.4630808",
"0.46059436",
"0.4576989",
"0.45714867",
"0.45658013",
"0.45635417",
"0.4562965",
"0.45628858",
"0.45555794",
"0.45094717",
"0.45071846",
"0.45041928",
"0.44978213",
"0.4492467",
"0.4491996",
"0.44855282",
"0.4483917",
"0.44797757",
"0.44778064",
"0.44681725",
"0.44654533",
"0.44626886",
"0.44598836",
"0.44572958",
"0.44562748",
"0.44530967",
"0.44486266",
"0.44480583",
"0.44475105",
"0.44459426",
"0.44432274",
"0.44319263",
"0.44291323",
"0.4416612",
"0.44129297",
"0.44129297",
"0.44056517",
"0.440535",
"0.44028217",
"0.4402589",
"0.43982357",
"0.43880355",
"0.4387719",
"0.43862203",
"0.43827495",
"0.43767002"
] | 0.5080894 | 16 |
Tries to store the associated key in the filtered key, transforming it with the given process. | def store(key, process, options)
if(options.has_key?(:at_least))
box_contains?(key, validator.datas[key], options[:at_least])
end
if(options.has_key?(:at_most))
box_contains?(key, options[:at_most], validator.datas[key])
end
super(key, ->(item){parse_box(key, validator.datas[key])}, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store(key, process, options = {})\n unless (options.has_key?(:extract) and options[:extract] == false)\n if datas.has_key?(key)\n value = ((options.has_key?(:cast) and options[:cast] == false) ? datas[key] : process.call(datas[key]))\n if(options.has_key?(:in))\n in_array?(key, options[:in])\n elsif(options.has_key?(:equals))\n equals_to?(key, options[:equals])\n end\n options.has_key?(:rename) ? (@filtered[options[:rename]] = value) : (@filtered[key] = value)\n end\n end\n end",
"def store_hash(key, process, options)\n has_keys?(key, options[:has_keys]) if(options.has_key?(:has_keys))\n contains?(filtered, datas[key].values, options[:contains]) if(options.has_key?(:contains))\n store(key, process, options)\n end",
"def store(key, process, options)\n has_keys?(key, options[:has_keys]) if(options.has_key?(:has_keys))\n contains?(validator.filtered, validator.datas[key].values, options[:contains]) if(options.has_key?(:contains))\n super(key, process, options)\n end",
"def store(key, process, options)\n contains?(key, validator.datas[key], options[:contains]) if(options.has_key?(:contains))\n super(key, process, options)\n end",
"def process(key, options = {})\n before_all(key, options)\n is_typed?(key, Hash) ? store(key, ->(item){Hash.try_convert(item)}, options) : raise_type_error(key, \"Hash\")\n end",
"def match_key_filter(p, value)\n @@key_filter_map[p[0]].call(p[1], value)\n end",
"def store_text(key, process, options)\n match_regex?(key, datas[key], options[:regex]) if(options.has_key?(:regex))\n store(key, process, options)\n end",
"def process\n key_value = get_key_value_\n puts \"Key header field value: #{key_value}\"\n\n if !key_value.nil?\n begin\n seckey = calculate_key_(key_value, get_headers_)\n puts \"Secondary cache key: #{seckey}\"\n\n genid = generate_generation_id_(seckey)\n puts \"Genid: #{genid}\"\n\n set_generation_id_(genid)\n rescue FailingParameterProcessing\n # 2.2.2. Failing Parameter Processing\n # behave as if the Key header was not present ...\n return\n end\n end\n end",
"def transform!(pallet)\n @key_transforms.each do |keytrans_item|\n # Enable early termination of transforms for a key\n # by wrapping execution in a catch block.\n catch do |abort_tag|\n key, transforms = keytrans_item.flatten\n context = {\n pallet: pallet,\n key: key,\n value: pallet[key, shallow: true],\n abort: abort_tag\n }\n\n transforms.each do |t|\n transform, param = t.flatten\n if self.respond_to?(transform.to_sym)\n if new_value = self.send(transform.to_sym, param, context)\n new_value = TraceableString.new(new_value)\n new_value.file = transform.file\n new_value.line = transform.line\n new_value.column = transform.column\n new_value.byte = transform.byte\n pallet[key] = new_value\n break\n end\n end\n end\n end\n end\n @hash\n end",
"def process_key(key)\n if ::File.exists?(key)\n key\n else\n tempfile = ::Tempfile.new('key')\n tempfile.write(key)\n tempfile.flush\n\n tempfile.path\n end\n end",
"def assign_key(input)\n return instance_exec input, &Database.assign_key\n end",
"def prepare_key\n return item_in_use.prepare_key\n end",
"def prepare_key\n return item_in_use.prepare_key\n end",
"def transform_keys!(&block); end",
"def process(key, options = {})\n before_all(key, options)\n match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, options) : raise_type_error(key, \"Numeric\")\n end",
"def store_array(key, process, options)\n contains?(key, datas[key], options[:contains]) if(options.has_key?(:contains))\n store(key, process, options)\n end",
"def transform_keys(&block); end",
"def process(row)\n if row\n @surrogate_key += 1\n row[destination] = @surrogate_key\n row\n end\n end",
"def process_to_hash(ip, numbers)\n if @hash_of_merged_data.has_key?(ip)\n store_values_in_existing_key(ip, numbers)\n else\n @hash_of_merged_data.store(ip, numbers)\n end\n end",
"def cache_result(policy, result, key)\n policy_cache[policy][key] = result\n end",
"def picky_procipher(sentence, hash)\n new_sentence = []\n sentence.split(' ').each do |word|\n proc_count = 0\n new_word = word\n hash.each do |k, v|\n if k.call(word) && proc_count < 1\n new_word = v.call(new_word)\n proc_count +=1\n end\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend",
"def copy_key(pipe, key)\n key_type = redis.type(key)\n return false unless ['list', 'hash', 'string', 'set', 'zset'].include?(key_type)\n\n self.send(\"copy_#{key_type}\", pipe, key)\n end",
"def with_key_transform(proc = nil, &block)\n fn = proc || block\n\n raise ArgumentError, \"a block or callable argument is required\" if fn.nil?\n\n handle = Dry::Types::FnContainer.register(fn)\n with(key_transform_fn: handle)\n end",
"def procipher(sentence, hash)\n new_sentence = []\n sentence.split(' ').each do |word|\n new_word = word\n hash.each do |k, v|\n new_word = v.call(new_word) if k.call(word)\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend",
"def update_filter_cache\n child_person.save\n end",
"def process(key, options = {})\n before_all(key, options)\n is_typed?(key, Array) ? store(key, ->(item){item.to_a}, options) : raise_type_error(key, \"Array\")\n end",
"def key_transform=(key_transform)\n self.key_transformer = key_transform&.to_proc\n end",
"def process primary_key\n entity = collection.find(primary_key)\n\n unless entity\n result.errors[entity_name].add(\n Bronze::Collections::Collection::Errors.record_not_found,\n :id => primary_key\n )\n end\n\n persist_entity(entity)\n end",
"def _process_hashed(hashed)\n hashed.each_pair do |key, value|\n if value.equal?(Utils::DeletedMarker)\n hashed.delete(key)\n elsif Utils.hashable?(value)\n _process_hashed(value.to_hash).freeze\n end\n end\n\n hashed\n end",
"def permitted_filter(params, key)\n params[key] = self[key] if has_key? key\n end",
"def process_persist(command)\n key = command.first\n options = {:expiration => -1 }\n @connection.touch(as_key(key), options)? 0 : 1 # return 1 when result is OK = 0\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_NOT_FOUND_ERROR)\n return 0\n else\n raise\n end\n end",
"def convert_key(key); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def persist(key); end",
"def persist(key); end",
"def process(step)\n step.inputs.each do |key, val|\n @inputs[key] = val unless @inputs.key?(key) || @outputs.key?(key)\n end\n @outputs.merge!(step.outputs)\n end",
"def process(log_entry, loomio)\n puts(\"Processing %s\" % log_entry.description)\n\n @predefined_entry_types.each do |predefined_entry_type|\n if log_entry.entry_type == predefined_entry_type\n @processors_hash[predefined_entry_type].(log_entry, loomio)\n return\n end\n\n puts(\"Event I don't care about: %s\" % log_entry.entry_type)\n log_entry.loomio_consumed = true\n log_entry.save!\n\n puts(\"Done processing %s\" % log_entry.description)\n end\nend",
"def handle_key(key); end",
"def process_input_for_key(value = nil)\n return value unless is_blank?(value)\n make_md5\n end",
"def build_key(instance)\n @key_processor.call(instance)\n end",
"def store_on(key, prc=payload['ret'], criteria=[ '*' ])\n\n return unless Flor.is_func_tree?(prc)\n\n pnode =\n @node; loop do\n pnode = parent_node(pnode)\n return unless pnode\n break unless IF_UNLESS.include?(pnode['heap'])\n end\n\n flavour = \"on_#{key}\"\n\n prc[1][flavour] = true\n\n a = (pnode[flavour] ||= [])\n i = a.index { |e| e[0] == criteria } || -1\n #\n a.insert(i, [ criteria, prc ])\n end",
"def store_decimal(key, process, options)\n store_numeric(key, process, options)\n if(options.has_key?(:round) and options[:round].kind_of?(Integer))\n filtered[key] = filtered[key].round(options[:round]) if filtered.has_key?(key)\n elsif(options.has_key?(:floor) and options[:floor] == true)\n filtered[key] = filtered[key].floor if filtered.has_key?(key)\n elsif(options.has_key?(:ceil) and options[:ceil] == true)\n filtered[key] = filtered[key].ceil if filtered.has_key?(key)\n end\n end",
"def process(something)\n if something.is_a? Hash\n something = something.to_a\n something = something.map { |pair| [process(pair[0]).to_sym, pair[1]] }\n something = something.flatten(1)\n Hash[*something]\n else\n something.to_s.split('_').map! do |s|\n [s[0,1].capitalize, s[1..-1]].join\n end.join\n end\n end",
"def process_map(map, keymap, path)\n map.all_attributes.each do |attr|\n next if KeyMap::NO_CONFLICTS.include?(attr.name)\n if u = $user_attributes[attr.name]\n u.value.all.each do |key|\n keymap.add(key, u, path: path, default: false)\n end\n elsif DefaultKeymaps.instance.has_alts?(attr.name)\n attr.value.all.each do |key|\n keymap.add(key, attr, path: path, default: true)\n end\n else\n keymap.add(attr.value.pri, attr, path: path, default: true) if attr.value.pri\n end\n end\nend",
"def <<(key)\n key_to_hashes(key).each { |hash| filter.set!(hash) }\n self\n end",
"def process_empty_object\n clear_data!\n self.key = transform_to_empty_key(key)\n end",
"def whiskey_process\n end",
"def process_set(command)\n key = command.slice!(0)\n val = command.slice!(0)\n\n options = {}\n while !command.empty? do\n case command.slice!(0)\n when 'EX'\n options[:expiration] = command.slice!(0)\n when 'PX'\n options[:expiration] = command.slice!(0) / 1000.0\n when 'NX'\n options[:record_exists_action] = ::Aerospike::RecordExistsAction::CREATE_ONLY\n when 'XX'\n options[:record_exists_action] = ::Aerospike::RecordExistsAction::UPDATE_ONLY\n end\n end\n\n @connection.put(as_key(key), {@bin => val}, options)\n return 'OK'\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_NOT_FOUND_ERROR) || (e.result_code == ::Aerospike::ResultCode::KEY_EXISTS_ERROR)\n return false\n else\n raise\n end\n end",
"def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end",
"def process_setnx(command)\n key = command[0]\n val = command[1]\n options = {:record_exists_action => ::Aerospike::RecordExistsAction::CREATE_ONLY}\n @connection.put(as_key(key), {@bin => val}, options)\n return 1\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_EXISTS_ERROR)\n return 0\n else\n raise\n end\n end",
"def preprocess_data\n # Remove things if needed\n if @filter_keys\n @input = @input.delete_if{|k, v| !@filter_keys.include?(k)}\n end\n end",
"def __convert(key); end",
"def _output_dir_file_data_filter(hash, filter_key)\n hash.select { |key, _| key == filter_key }\n end",
"def filterKeyPair(line=\"\", store={})\n\n temp = line.split(\"=\")\n left = temp[0].strip\n key_comb = left.split(/<|>/)\n key = key_comb[0].strip.to_sym\n\n if temp[1].include? \"\\\"\"\n value = temp[1].strip.split('\"')[1]\n elsif [\"yes\", \"true\", \"1\"].include? temp[1].strip # assumption yes, true , 1 => true; no false 0 => false\n value = true\n elsif [\"no\", \"false\", \"0\"].include? temp[1].strip\n value = false\n elsif temp[1].strip.split(\",\").length > 1\n value = temp[1].strip.split(\",\")\n else\n value = temp[1].strip\n end\n\n if key_comb.length == 1\n store[key]=value\n elsif @overrides.include? key_comb[1].strip\n store[key]=value\n elsif !store.include?(key)\n store[key]=value\n end\n\n end",
"def reserve_key(key); end",
"def store(key, value, localize = true)\n super(key, evolve(value, localize))\n end",
"def do_operation(dict, key)\n\n end",
"def process_collection!(name, key, value, remote)\n if collection.key?(name)\n existing_remote = collection[name.to_s][:remote]\n # skip if the existing item is local and the new item is remote\n return if remote && !existing_remote\n raise \"Duplicate item with name '#{name}' was detected.\" unless existing_remote && !remote\n\n # override if the existing item is remote and the new is local\n logger.info \"Duplicate item with name '#{name}' was detected from the remote folder.\"\n end\n collection[name.to_s] = { name: name.to_s, type: key, value: value, remote: remote }\n end",
"def procipher(sent, hash)\r\n new_sent = []\r\n sent.split(\" \").each do |word|\r\n new_word = word.clone\r\n hash.each do |k, v|\r\n if k.call(word)\r\n new_word = v.call(new_word)\r\n found = true\r\n end\r\n end\r\n new_sent << new_word\r\n end\r\n new_sent.join(\" \")\r\nend",
"def check_or_create_for!(hash, key)\n hash[key] = \"\" unless hash.include?(key)\n end",
"def key_maker(hash, key, value)\n case\n when value.include?(\"true\")\n value = true\n when value.include?(\"false\")\n value = false\n when value.to_i > 0 && value.length < 4\n value = value.to_i\n when value == \"0\"\n value = value.to_i\n else\n value\n end\n hash.store(key.to_sym, value)\nend",
"def item_cache_key(item, cache_key_proc)\n ActiveSupport::Cache.expand_cache_key(cache_key_proc.call(item))\n end",
"def hexists(key, field); end",
"def hexists(key, field); end",
"def transform_attr(key, value); end",
"def process_mset(command)\n command.each_slice(2) { |kv|\n key = kv[0]\n val = kv[1]\n begin\n @connection.put(as_key(key), {@bin => val})\n rescue ::Aerospike::Exceptions::Aerospike\n # ignore and continue to set other keys\n end\n }\n return 'OK'\n end",
"def set_exists(policy, key)\n begin_cmd\n field_count = estimate_key_size(key)\n\n predexp_size = estimate_predexp(policy.predexp)\n field_count += 1 if predexp_size > 0\n\n exp_size = estimate_expression_size(@policy.filter_exp)\n field_count += 1 if exp_size > 0\n\n size_buffer\n write_header(policy, INFO1_READ | INFO1_NOBINDATA, 0, field_count, 0)\n write_key(key)\n write_predexp(policy.predexp, predexp_size)\n write_filter_exp(@policy.filter_exp, exp_size)\n end_cmd\n end",
"def process matching: {}\n query = collection.query\n\n query = query.matching(matching) if matching.is_a?(Hash)\n\n query.to_a.map { |entity| persist_entity(entity) }\n end",
"def canonicalize(key, node)\n treecache.canonicalize(key, node)\n end",
"def store(key, value)\n value = apply_store_hook(key, value)\n key = aliases[key] || key\n super(key, value) unless @frozen_keys.include?(key)\n end",
"def hash_mapped(hash, proc_a, &prc)\n new_hash = Hash.new(0)\n\n hash.each do |k, v|\n new_k = prc.call(k)\n new_hash[new_k] = proc_a.call(v)\n end\n new_hash\nend",
"def process(items)\n found = false\n to_process = items.select {|item| found ||= (item.checksum == self.checksum) }\n to_process.blank? ? to_process = items : to_process.shift\n to_process.each {|entry| store(entry) }\n end",
"def new_key(school,key,value)\n school[key.to_sym] = value\nend",
"def add_unprocessed_thing_key_info(value)\n @children['unprocessed-thing-key-info'][:value] << value\n end",
"def rekey_as_needed; end",
"def normalize_key(key)\n KEY_NORMALIZER.call(key)\n end",
"def perform(group, key)\n @realize_proc.call(group, key)\n end",
"def transformed?(old_primary_key)\n @transformed ||= {}\n @transformed.has_key?(old_primary_key)\n end",
"def deep_transform_keys(&block); end",
"def process_group(group, result)\n\t\tif result.has_key?(group)\n\t\t\traise 'Repeated group. Invalid config file. ' << group\n\t\tend\n\t\t\n\t\tresult[group] = ModifiedHash.new\n\t\t#set global var to hold current group name. Used while processing key-val pair\n\t\t$current_group = group\n\tend",
"def update_filter_cache\n participant.save\n end",
"def update_filter_cache\n participant.save\n end",
"def update_filter_cache\n participant.save\n end",
"def modify_from_hash(column)\n %i[sequence_no namespaced_name data_type caption width format hide pinned\n groupable group_by_seq group_sum group_avg group_min group_max].each do |att|\n send(\"#{att}=\", column[att])\n end\n end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def deep_transform_keys!(&block); end",
"def associate_provenance(index:, key:, data:)\n to_item = @collection.part(index[0], index[1])\n data.each do |datum|\n # Make sure you aren't modifying a shared data structure\n datum = datum.dup\n from_item = datum.delete(:item)\n next unless from_item\n\n add_one_to_one_provenance(\n from_item: from_item,\n to_item: to_item,\n additional_relation_data: datum\n )\n end\n associate(index: index, key: key, data: 'added')\n end",
"def normalize(key, hash)\n token, *dangling = hash[key]\n unmatched(key, hash, dangling) unless dangling.empty?\n\n token.gsub!(/^[^[:alnum:]]+|[^[:alnum:]]+$/, '')\n\n hash[key] = token\n hash\n end",
"def key=(_); end",
"def key=(_); end",
"def transform_keys\n { a: 1, b: 2 }.transform_keys { |key| key_map[key] || key }\n end",
"def do_search_for(key, value)\n search_term = self.send(\"filter_by_#{key}\", value)\n prepare_search_term_for(key, search_term)\n end",
"def _process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n chr = nil\n ch = keycode\n if ch > 0 and ch < 256\n chr = ch.chr\n end\n blk = @_key_map[keycode]\n # i am scrappaing this since i am once again complicating too much\n=begin\n # if blk then we found an exact match which supercedes any ranges, arrays and regexes\n unless blk\n @_key_map.each_pair do |k,p|\n $log.debug \"KKK: processing key #{ch} #{chr} \"\n if (k == ch || k == chr)\n $log.debug \"KKK: checking match == #{k}: #{ch} #{chr} \"\n # compare both int key and chr\n $log.debug \"KKK: found match 1 #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n elsif k.respond_to? :include?\n $log.debug \"KKK: checking match include #{k}: #{ch} #{chr} \"\n # this bombs if its a String and we check for include of a ch.\n if !k.is_a?( String ) && (k.include?( ch ) || k.include?(chr))\n $log.debug \"KKK: found match include #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n elsif k.is_a? Regexp\n if k.match(chr)\n $log.debug \"KKK: found match regex #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n end\n end\n end\n=end\n # blk either has a proc or is nil\n # we still need to check for a complex map. if none, then execute simple map.\n ret = check_composite_mapping(ch, window)\n $log.debug \" composite returned (#{ret}) for #{ch} \"\n if !ret\n return execute_mapping(blk, ch, object) if blk\n end\n return execute_mapping(ret, ch, object) if ret\n return :UNHANDLED\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end",
"def picky_procipher(sent, hash)\r\n new_sent = []\r\n found = false\r\n sent.split(\" \").each do |word|\r\n hash.each do |k, v|\r\n found = false\r\n if k.call(word)\r\n new_sent << v.call(word)\r\n found = true\r\n break \r\n end\r\n end\r\n new_sent << word if !found\r\n end\r\n new_sent.join(\" \")\r\nend",
"def process(value)\n case value\n when Hash\n value.frozen? ? value.merge(value) { |_, v| process v } : value.merge!(value) { |_, v| process v }\n when Array\n value.frozen? ? value.map { |v| process v } : value.map! { |v| process v }\n when Exception\n sanitized_exception(value)\n when String\n sanitized_string(value)\n else\n value\n end\n end",
"def update_quantity(input_hash, item, qty)\n# steps: use input item as key and input quantity as value\n# output: hash \n input_hash[item] = qty\n \nreturn input_hash\nend",
"def pass(key, value)\n @out_args[key] = value\n end",
"def process(obj)\n if obj.is_a?(Hash)\n obj.each do |key,value|\n if value.is_a?(String)\n if value =~ /___WAITING_JOB:[0-9]+___/\n job_id = value.scan(/___WAITING_JOB:([0-9]+)___/).first.first\n res = get_job_result(job_id.to_i)\n \n obj[key] = res if res\n end\n else\n process(value)\n end\n end\n end\n end"
] | [
"0.724382",
"0.63120264",
"0.60612667",
"0.59091693",
"0.56819457",
"0.54308206",
"0.5292139",
"0.5234593",
"0.52061737",
"0.5183842",
"0.51351756",
"0.5082784",
"0.5082784",
"0.5024683",
"0.50178486",
"0.50082994",
"0.5007856",
"0.49984244",
"0.49705675",
"0.49603388",
"0.49223736",
"0.49198595",
"0.49192828",
"0.4866439",
"0.4866277",
"0.485968",
"0.48589033",
"0.48492056",
"0.48460752",
"0.48378813",
"0.48177522",
"0.4810925",
"0.4810925",
"0.4810925",
"0.47747976",
"0.47747976",
"0.47674006",
"0.4756809",
"0.47265753",
"0.47000778",
"0.46993145",
"0.46699956",
"0.46551058",
"0.46537957",
"0.46416298",
"0.46401975",
"0.46144316",
"0.4613272",
"0.4607653",
"0.46030593",
"0.4598225",
"0.45943037",
"0.459253",
"0.4589301",
"0.45607388",
"0.4526998",
"0.45238134",
"0.451965",
"0.45190972",
"0.45170727",
"0.45141676",
"0.45051223",
"0.44945228",
"0.44842944",
"0.44842944",
"0.44824472",
"0.44751987",
"0.44733286",
"0.4463664",
"0.44591925",
"0.44561142",
"0.44556618",
"0.4443659",
"0.44420472",
"0.44409084",
"0.44328573",
"0.44306314",
"0.44298682",
"0.44251114",
"0.4424488",
"0.44239068",
"0.44236058",
"0.44236058",
"0.44236058",
"0.44233382",
"0.44219616",
"0.4421855",
"0.44185996",
"0.44112906",
"0.44025788",
"0.44025788",
"0.43988296",
"0.4396235",
"0.4395053",
"0.4390209",
"0.43819132",
"0.4379119",
"0.43728355",
"0.43723765",
"0.43706578"
] | 0.45004344 | 62 |
Verify if a box contains another box. | def box_contains?(key, container, contained)
container = parse_box(key, container)
contained = parse_box(key, contained)
result = ((container[0][0] <= contained[0][0]) and (container[0][1] <= container[0][1]) and (container[1][0] >= container[1][0]) and (container[1][1] >= container[1][1]))
raise_error(type: "box.containment", contained: contained, container: container, key: key) unless result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collision_detected?\n ($boxes - Array(self)).any? do |other_box|\n # .include method with other_square\n other_box.include?(@square)\n end\nend",
"def notify_collision(another_box)\n @box.overlaps_with?(another_box)\n end",
"def in_box?(box_key, num)\n @boxes[box_key].each {|square| return true if square.number == num}\n false\n\n end",
"def contained?(other); end",
"def contained?(other); end",
"def contained?(other); end",
"def inBox(box, point)\n # Make a box with the point and the SE corner of the box.\n # Make another box with the point and the NE Corner of the box.\n # Combine the new boxes.\n # The point is inside the given box, if the area of the combined boxes is\n # equal (or a little less than due to roundoff error) than the area of the given box.\n box1 = getBox(point,box[1])\n box2 = getBox(box[1],point)\n box3 = combineBoxes( box1, box2 )\n return area(box3) <= area(box)\n end",
"def contains?(_other)\n true\n end",
"def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end",
"def exists?(box_name)\n all.any? { |box| box.first.eql?(box_name) }\n end",
"def contained?(other)\n other.contains?(self)\n end",
"def include?(x, y)\n # assume a rectangular shape by default\n contain?(x, y)\n end",
"def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end",
"def check_hit(box) # Checa se a hitbox tem overlap com outra hitbox\n heightimp = false\n @zlist.each do |heightLevel| # Checa impacto de altura, se não tem impacto de altura, um objeto no maximo passa por cima do outro sem colidir\n box.zlist.each do |hitheight|\n if (heightLevel == hitheight) # Qualquer nivel de altura ser igual a qualquer nivel de altura da outra hitbox é o bastante pra ter impacto de altura\n heightimp = true\n end\n end\n end\n if (((@x > box.x + box.width or box.x > @x + @width) or (@y > box.y + box.length or box.y > @y + @length)) or (heightimp == false)) # Se não tem overlap bidimensional ou não há impacto de altura, não tem colisão\n return false\n else\n return true\n end\n end",
"def checkSpot(box)\n #validate if the cloud maxwidth isn't violated\n if @maxWidth > 0\n lx = [@ul.x, box.ul.x].min\n rx = [@lr.x, box.lr.x].max\n if((rx - lx) > @maxWidth)\n return false\n end\n end\n \n # validate if the box doesn't overlap other boxes\n ok = true\n for tb in @boxes\n if tb.inPosition && box.overlaps(tb)\n ok = false\n \n break\n end\n end\n return ok\n end",
"def contain?(rect)\n nself = self#.normalize\n rect = Rect.new_from_object(rect)#.normalize!\n return (nself.left <= rect.left and rect.right <= nself.right and\n nself.top <= rect.top and rect.bottom <= nself.bottom)\n end",
"def is_box?(); @type == GRT_BOX; end",
"def intersects?(other)\n return false if separate? other\n return false if contained? other\n return false if coincident? other\n true\n end",
"def contains?(other); end",
"def contains?(other); end",
"def contains?(other); end",
"def contains?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#contains? not defined.\"\n end",
"def intersects?(other_cuboid)\n\t\toverlaps_along_x_with?(other_cuboid) && overlaps_along_y_with?(other_cuboid) && overlaps_along_z_with?(other_cuboid)\n\tend",
"def fits_inside?(other)\n width <= other.width && height <= other.height\n end",
"def contains(box, fuzz=Arigatomation::Pixel(0x020202))\n each do |p|\n return p if self[p].approx(box[Arigatomation::ORIGIN], fuzz) && box.match(self, p, fuzz)\n end\n false\n end",
"def included_in?(other_rect)\n self == self.intersects(other_rect)\n end",
"def box_imported?(box)\n run_cmd(\"vagrant box list\").include?(box)\n end",
"def intersect(boundingbox)\n end",
"def crossing?(other); end",
"def crossing?(other); end",
"def crossing?(other); end",
"def contain\n c = nil\n if contained_in.is_a?(Container)\n c = contained_in\n else\n c = Container.find(contained_in)\n end\n\n put_in_container(c)\n end",
"def include?(other_square)\n # top left\n @square.contains?(other_square.x1, other_square.y1) || \n # top right\n @square.contains?(other_square.x1, other_square.y2) || \n # bottom right\n @square.contains?(other_square.x1, other_square.y3) || \n # bottom left\n @square.contains?(other_square.x1, other_square.y4) \nend",
"def test_contains?\n testCard = Card.new(:Jack)\n\n assert(@LiarHand.contains?(testCard) == true, 'Jack was expected to be in hand <LiarHand>')\n assert_not_equal(true, @IdiotHand.contains?(testCard), 'Jack was not expected to be in hand <IdiotHand>')\n\n assert(@LightHand.contains?(testCard) == false, 'Card Jack not expected to be in <LightHand>')\n assert_not_equal(true, @SpiderHand.contains?(testCard), 'Jack was not expected to be in hand <SpiderHand>')\n end",
"def exists_in_box(grid, start_row, start_column, number)\n row = 0\n column = 0\n while row < 3\n column = 0\n while column < 3\n return true if grid[row + start_row][column + start_column] == number\n column += 1\n end\n row += 1\n end\n return false\nend",
"def in_bounding_box?(point, box)\n if point.lon > box.west_lon and point.lon < box.east_lon and point.lat < box.north_lat and point.lat > box.south_lat\n return true\n else\n return false \n end\n end",
"def contains?(*args)\n x, y = *Vector2.extract(args.singularize)\n x.between?(self.x, self.x2 - 1) && y.between?(self.y, self.y2 - 1)\n end",
"def coordinates_inside_box?(x_idx, y_idx)\n (x_idx >= 0 && x_idx < width) && (y_idx >= 0 && y_idx < height)\n end",
"def contains?(point_or_bb)\n end",
"def contains?(x, y)\n x > bounds.x && x < bounds.x+bounds.width && y > bounds.y && y < bounds.y+bounds.height\n end",
"def is_boxtype?(); @type == GRT_BOXTYPE; end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def contains(x, y)\n\t\tcontains_x(x) && contains_y(y)\n\tend",
"def ==(other)\n number == other.number && size == other.size\n end",
"def contain?(x, y)\n # assume a rectangular filled shape by default (works for several shapes like image, text, and focus)\n x.between?(self.absolute_x, self.absolute_x + calculated_width) && y.between?(self.absolute_y, self.absolute_y + calculated_height)\n end",
"def test_contains_point_false\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(15,15,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: greater' )\n\n point = Geom::Point3d.new(-10,-10,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: lessthan' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed1' )\n\n point = Geom::Point3d.new(5,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed3' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed3' )\n\n point = Geom::Point3d.new(-10,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed4' )\n\n point = Geom::Point3d.new(-10,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed5' )\n\n point = Geom::Point3d.new(-10,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed6' )\n\n\n point = Geom::Point3d.new(15,5,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed7' )\n\n point = Geom::Point3d.new(15,15,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed8' )\n\n point = Geom::Point3d.new(15,5,15)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed9' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed10' )\n\n point = Geom::Point3d.new(5,-10,5)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed11' )\n\n point = Geom::Point3d.new(5,5,-10)\n assert_equal(false, bbox.contains?(point),\n 'Failed in test_contains_point_false: mixed12' )\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def intersect? rect\n rect.is_a?(Rectangle) && !(@x + @width < rect.x || rect.x + rect.width < @x || @y + @height < rect.y || rect.y + rect.height < @y)\n end",
"def isCollidedWith(obj)\n if(self == obj)\n return false ;\t\t\t\n end\n\n r = @pos.distanceTo(obj.pos) ;\t\n l = @size + obj.size ;\t\t\n\n return (r < l) ;\t\t\n end",
"def assert_does_not_contain(collection, x) # :nodoc:\n !assert_contains(collection, x)\n end",
"def test_contains_point_true\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(5,5,5)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: center' )\n\n point = Geom::Point3d.new(0,0,0)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: min' )\n\n point = Geom::Point3d.new(10,10,10)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: max' )\n end",
"def contains?(x, y)\n x >= @x && x <= (@x + @width) && y >= @y && y <= (@y + @height)\n end",
"def checkCollision?(other)\n refresh()\n other.refresh()\n \n xMin = @center_left[X]\n xMax = @center_right[X]\n yMin = @center_bottom[Y]\n yMax = @center_top[Y]\n\n xMax > other.center_left[X] && xMin < other.center_right[X] && \n yMin > other.center_top[Y] && yMax < other.center_bottom[Y]\n end",
"def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end",
"def contains?(point)\n point.inside?(self)\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor!\n collision_left!\n collision_right!\n collision_ceiling!\n end",
"def assign_box(box_id)\n return true unless box_id\n curation_concern.member_of_collections.concat [::EphemeraBox.find(box_id)]\n end",
"def place_free(x, y)\n if @parent.entities.count < 2\n return true # If there is no other object, what could you collide against?\n else\n @parent.entities.each do |e|\n unless e === self\n if MathG::check_collision(e.x,e.y,e.width,e.height, x, y, x + @width,y + @height)\n return false # unless collision, place is free!\n end\n end\n end\n end\n end",
"def overlaps?(other)\n (self.check_in - other.check_out) * (other.check_in - self.check_out) >= 0\n end",
"def contains_all?(other)\n (other & self) == self\n end",
"def test_ships_overlap?\n board = Board.new\n cruiser = Ship.new('Cruiser', 3)\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n submarine = Ship.new(\"Submarine\", 2)\n assert_equal true, board.ship_overlap?(submarine, [\"A1\", \"B1\"])\n\n assert_equal false, board.valid_placement?(submarine, [\"A1\", \"B1\"])\n assert_equal true, board.valid_placement?(submarine, [\"C1\", \"C2\"])\n end",
"def similar_to?(other)\n self.composition == other.composition\n end",
"def collide?(other)\r\n max_left = [left, other.left].max\r\n max_top = [top, other.top].max\r\n min_right = [right,other.right].min\r\n min_bottom = [bottom,other.bottom].min\r\n return max_left <= min_right && max_top <= min_bottom\r\n end",
"def collision?(other)\n Gosu::distance(@x, @y, other.x, other.y) < @radius * @size + other.radius * other.size\n end",
"def intersects?(other)\n self_index = dimensions(self.vertices)\n other_index = dimensions(other.vertices)\n\n intersection = {}\n intersection[:x] = self_index[:x] & other_index[:x]\n intersection[:y] = self_index[:y] & other_index[:y]\n intersection[:z] = self_index[:z] & other_index[:z]\n\n intersection.value?([]) ? false : true\n end",
"def eql?(other_grid)\n return @id == other_grid.id\n #return @id == other_grid.id\n #result = false\n #if other_grid.x == @x && other_grid.y == @y \n # result = true\n # for y in 0...other_grid.y do\n # for x in 0...other_grid.x do\n # unless other_grid.block(x, y) == self.block(x, y)\n#\t result = false\n#\t break\n#\t end\n#\tend\n# end\n# end\n# result\n end",
"def intersects?(cuboid)\n cuboid.vertices.each do |vertex|\n if self.contains?(vertex) || self.touches?(vertex)\n return true\n end\n end\n return false\n end",
"def ==(other)\n if other.is_a?(Moon::Rect)\n x == other.x && y == other.y && w == other.w && h == other.h\n else\n false\n end\n end",
"def ==(other)\n if other.is_a?(Moon::Rect)\n x == other.x && y == other.y && w == other.w && h == other.h\n else\n false\n end\n end",
"def contains?(other)\n @pairs & other.pairs == other.pairs\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor\n collision_left\n collision_right\n collision_ceiling\n end",
"def contained?\n !container.nil?\n end",
"def contain?(position); end",
"def collision_between obj1, obj2\n\t\t\tif obj1.y + obj1.height < obj2.y ; return false ; end\n\t\t\tif obj1.y > obj2.y + obj2.height ; return false ; end\n\t\t\tif obj1.x + obj1.width < obj2.x ; return false ; end\n\t\t\tif obj1.x > obj2.x + obj2.width ; return false ; end\n\t\t\treturn true\n\t\tend",
"def contains(&block)\n [:contains, block]\n end",
"def contains(&block)\n [:contains, block]\n end",
"def collide_rect?(other_rect)\n !intersects(other_rect).empty?\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def contains?(x, y)\n self_area = triangle_area(@x1, @y1, @x2, @y2, @x3, @y3)\n questioned_area =\n triangle_area(@x1, @y1, @x2, @y2, x, y) +\n triangle_area(@x2, @y2, @x3, @y3, x, y) +\n triangle_area(@x3, @y3, @x1, @y1, x, y)\n\n questioned_area <= self_area\n end",
"def contains?(x, y)\n self_area = triangle_area(@x1, @y1, @x2, @y2, @x3, @y3)\n questioned_area =\n triangle_area(@x1, @y1, @x2, @y2, x, y) +\n triangle_area(@x2, @y2, @x3, @y3, x, y) +\n triangle_area(@x3, @y3, @x1, @y1, x, y)\n\n questioned_area <= self_area\n end",
"def test_add_guest__exist_in_room()\n @room1.add_guest(@guest1)\n @room1.add_guest(@guest1)\n assert_equal(1,@room1.guests.count())\n end",
"def in?(x, y)\n check_x = x.between?(self.x, self.x+self.width)\n check_y = y.between?(self.y, self.y+self.height)\n check_x && check_y\n end",
"def within?(width, height)\n check(@width_boundary, width) && check(@height_boundary, height)\n end",
"def checkSubgrid(row, col, num)\n\t\tx = (row / 3) * 3\n\t\ty = (col / 3) * 3\n\n\t\tbox = @sudokuBoard[x][y..(y+2)] + @sudokuBoard[x+1][y..(y+2)] + @sudokuBoard[x+2][y..(y+2)]\n\t\tdisjointSet = box - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add num to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add num to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\t\n\t\n\t\n\tend",
"def within?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#within? not defined.\"\n end",
"def can_be_placed?(x, y)\n return false unless (0..(rows - 1)).include?(x)\n return false unless (0..(columns - 1)).include?(y)\n\n true\n end",
"def eql?(other)\n @left == other.left && @middle == other.middle && @right == other.right\n end",
"def can_contain?(element)\n false\n end",
"def in?(x, y)\n check_x = x.between?(@x, @x+@width)\n check_y = y.between?(@y, @y+@height)\n check_x && check_y\n end",
"def test_clear_already_empty\n assert_nothing_raised do \n bbox = Geom::BoundingBox.new\n bbox.clear\n end\n end",
"def intersects?(other)\n return false if self.xMax < other.xMin\n return false if self.xMin > other.xMax\n return false if self.yMax < other.yMin\n return false if self.yMin > other.yMax\n return false if self.zMax < other.zMin\n return false if self.zMin > other.zMax\n true\n end",
"def collides?(other)\n !(\n @pos.x + width <= other.pos.x ||\n @pos.x >= other.pos.x + other.width ||\n @pos.y + height <= other.pos.y ||\n @pos.y >= other.pos.y + other.height\n )\n end",
"def inside_rect? outer, tolerance = 0.0\n Geometry.inside_rect? self, outer, tolerance\n end",
"def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end",
"def overlap?(object1, object2)\n\t#upper left corner\n\tlx1 = object1.x\n\tly1 = object1.y\n\n\tlx2 = object2.x\n\tly2 = object2.y\n\t\n\t#lower right corner\n\trx1 = object1.x + object1.class::WIDTH\n\try1 = object1.y + object1.class::HEIGHT\n\n\trx2 = object2.x + object2.class::WIDTH\n\try2 = object2.y + object2.class::HEIGHT\n\n\tif rx1 - lx2 < 5 or\n\t\t\trx2 - lx1 < 5 then\n\t\treturn false\n\tend\n\n\tif ry1 - ly2 < 5 or\n\t\t\try2 - ly1 < 5 then\n\t\treturn false\n\tend\n\n\treturn true\nend",
"def findSpot(box)\n spotFound = false\n \n if @points.size == 0\n #sp = Point.new(0,0)\n spotFound = checkSpot(box)\n else\n #extend list of possible attachpoint with all corners of the Box\n # make sure the cloud doesn't get too wide\n if !in_shape? && box.values[:angle] == 0\n box.rotate\n end\n pss=createSpotGroup(box)\n spotFound = checkSpotGroup(pss,box) \n if (!spotFound)\n box.rotate\n pss=createSpotGroup(box)\n spotFound=checkSpotGroup(pss,box)\n end \n end\n\n if spotFound\n # mark box as in position\n box.inPosition = true\n \n # add the box attachpoints\n @points = @points.concat box.corners\n \n # recalculate (cloud) box boundaries\n @ul.x = [@ul.x, box.ul.x].min\n @ul.y = [@ul.y, box.ul.y].min\n @lr.x = [@lr.x, box.lr.x].max\n @lr.y = [@lr.y, box.lr.y].max\n \n @height = @lr.y - @ul.y\n @width = @lr.x - @ul.x\n else\n #puts(\"XXX WTF????? can't find spot!!!\")\n end\n return spotFound\n end",
"def contains\n \t\tfalse\n\tend",
"def subsume?(other)\n range_within_other?(other,self)\n end"
] | [
"0.7028195",
"0.6791319",
"0.66296095",
"0.64564013",
"0.64564013",
"0.64564013",
"0.6310608",
"0.6092203",
"0.60843647",
"0.60819274",
"0.60197717",
"0.59853286",
"0.59601456",
"0.5803587",
"0.5788798",
"0.57866496",
"0.5732989",
"0.57077026",
"0.5701991",
"0.5701991",
"0.5701991",
"0.5695208",
"0.56281483",
"0.56050396",
"0.5601975",
"0.5594013",
"0.5570238",
"0.5560662",
"0.5532693",
"0.5532693",
"0.5532693",
"0.5531894",
"0.5502436",
"0.5502301",
"0.54815155",
"0.54591084",
"0.5458541",
"0.5455915",
"0.545531",
"0.5454822",
"0.5452279",
"0.544658",
"0.544658",
"0.544658",
"0.5433846",
"0.53962505",
"0.5388046",
"0.5386506",
"0.53617305",
"0.53522635",
"0.53489834",
"0.5333672",
"0.5326043",
"0.53191024",
"0.5307951",
"0.53078216",
"0.53028166",
"0.52940875",
"0.52860117",
"0.52815247",
"0.52770936",
"0.5271205",
"0.52642924",
"0.52590936",
"0.5245547",
"0.52437127",
"0.5239105",
"0.52264065",
"0.5213999",
"0.5203429",
"0.5203429",
"0.5199494",
"0.5197197",
"0.5195808",
"0.51836747",
"0.51722765",
"0.51720613",
"0.51720613",
"0.51691544",
"0.5163925",
"0.51634926",
"0.51634926",
"0.51615864",
"0.51488495",
"0.5146353",
"0.51452136",
"0.51451546",
"0.51412946",
"0.51408005",
"0.5133239",
"0.5132271",
"0.5130724",
"0.51299566",
"0.512673",
"0.5125731",
"0.5124978",
"0.51191694",
"0.5109472",
"0.5102571",
"0.5094101"
] | 0.65630674 | 3 |
Parses a box given as a string of four numbers separated by commas. | def parse_box(key, box)
if box.kind_of?(String)
begin
raw_box = box.split(",").map(&:to_f)
box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_box[3]]]
rescue
raise_error(type: "box.format", key: "key", value: box)
end
end
return box
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n p number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n end\nend",
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n end\nend",
"def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end",
"def bbox_from_string(string, factory)\n return unless string\n minlon, minlat, maxlon, maxlat = string.split(',').collect { |i| i.to_f }\n bbox = RGeo::Cartesian::BoundingBox.new(factory)\n bbox.add(factory.point(minlon, minlat)).add(factory.point(maxlon, maxlat))\n end",
"def separate_comma(number)\n array = number.to_s.split('') #creates an array from number w/ digits\n number_commas = array.size/3.0 #how many commas\n if array.size < 4 #this is a 3 digit number\n return number.to_s #return number no comma needed\n elsif array.size%3 == 0\n n = -4\n (number_commas.to_i-1).times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n else\n n = -4\n number_commas.to_i.times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n end\nend",
"def separate_comma(num)\n numbers = num.to_s.split('')\n size = numbers.size/3.0\n if numbers.size < 4\n return num.to_s\n elsif numbers.size%3 == 0\n comma = -4\n (size.to_i-1).times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n strings = ''\n return numbers.join(\"\")\n else\n comma = -4\n size.to_i.times do |x|\n numbers.insert(comma, ',')\n comma -= 4\n end\n return numbers.join(\"\")\n end\nend",
"def parse(input)\t\n\t\tlines = input.each_line \n\n\t\trows = []\n\t\tboxes = []\n\t\tcols = []\n\t\t1.upto(9) {\n\t\t\trows << Block.new\n\t\t\tboxes << Block.new\n\t\t\tcols << Block.new\t\t\n\t\t}\n\n\t\tr = 0 # The current row\n\t\tcell_index = 0 # The current cell\n\n\t\tlines.each do |line|\n\t\t\tif r > 8 \n\t\t\t\tbreak\n\t\t\tend\n\t\t\tnumbers = line.split(',')\t\n\t\t\tc = 0 # The current column\n\t\t\t\n\t\t\tnumbers.each do |number|\t\t\t\t\n\t\t\t\tb = c / 3 + 3 * (r / 3) # The current box\n\t\t\t\tnumber = number.delete \",\"\n\t\t\t\tnumber = number.to_i\n\t\t\t\t\n\t\t\t\tcell= Cell.new(rows[r], cols[c], boxes[b])\n\t\t\t\t#print r.to_s + c.to_s + b.to_s + \" \"\n\t\t\t\tnumber = 0 if number == nil\n\t\t\t\tcell.set(number)\n\n\t\t\t\tif number == 0\n\t\t\t\t\t@unsolved << cell\n\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t@cells[cell_index] = cell;\n\t\t\t\t\n\t\t\t\tc += 1\n\t\t\t\tcell_index += 1 \n\t\t\tend\t\n\t\t\tr += 1 \n\t\t\t#puts\n\t\tend\n\t\t#puts\n\t\t#show\n\t\t#gets\n\tend",
"def separate_comma(integer)\n strinteger = integer.to_s.split('')\n figures = strinteger.size / 3\n if strinteger.size <= 3\n \tp integer.to_s\n elsif strinteger.size%3 == 0\n \tt = -4\n \t(figures.to_i - 1).times do |x|\n \t strinteger.insert(t, ',')\n \t t -= 4\n \tend\n p strinteger.join\n else\n \tt = -4\n \t(figures.to_i).times do |x|\n \t strinteger.insert(t, ',')\n \t t -= 4\n \tend\n p strinteger.join\n end\nend",
"def separate_comma(num)\n number = num.to_s\n position = -4\n if number.length < 4\n number\n elsif number.length % 3 == 0\n ((number.length/3) - 1).times { number.insert(position, \",\"); position -= 4 }\n number\n else\n (number.length/3).times { number.insert(position, \",\"); position -= 4 }\n number\n end\nend",
"def parse_line(match)\n raise InvalidFormat.new \"Couldn't parse box list\" if match.nil?\n Derelict::Box.new *match.captures[0..1]\n end",
"def separate_comma(number)\n number = number.to_s\n if number.length < 4\n return number\n else\n new_number = []\n number.reverse.split('').each_with_index do |x, i|\n new_number.push(x)\n if (i + 1) % 3 == 0\n new_number.push(\",\")\n end\n end\n return new_number.reverse.join\n end\nend",
"def separate_comma(number)\n\tnumber_string = number.to_s\n\tsize = number_string.length\n\n\tif size < 4\n\t\tnumber_string\n\telse\n\t\tarray = number_string.split(//).reverse!\n\t\tcounter = 0\n\t\tnew_array = []\n\n\t\tarray.each do |element|\n\t\t\tnew_array << element\n\t\t\tcounter += 1\n\t\t\tnew_array << \",\" if counter % 3 == 0 && counter < size\n\t\tend\n\t\tnew_array.reverse!.join\n\tend\nend",
"def separate_comma(num)\n\tnum_s = num.to_s\n\tdigits = num_s.length\n\tif digits <= 3\n\t\tnum_s\n\telsif digits % 3 == 0\n\t\tnum_s.scan(/.../).join(\",\")\n\telse\n\t\ti = digits % 3\n\t\tnum_s[0..i-1] + \",\" + num_s[i..-1].scan(/.../).join(\",\")\n\tend\nend",
"def parse_string string\n self.coords = string.split(separator).map(&:to_f)\n end",
"def separate_comma(int)\n string_num = int.to_s\n number_with_commas = \"\"\n \n if string_num.length < 4\n return string_num\n end\n\n if string_num.length % 3 != 0\n number_with_commas.concat(string_num.slice!(0...(string_num.length % 3)))\n else\n \tnumber_with_commas.concat(string_num.slice!(0...3))\n end\n\n while string_num.length != 0\n \tnumber_with_commas << \",\"\n \tnumber_with_commas.concat(string_num.slice!(0...3))\n end\n\n number_with_commas\nend",
"def four_digit_parse(num)\n thousands = get_high_order(num,1000)\n num = get_remainder(num, 1000)\n hundreds = get_high_order(num, 100)\n num = get_remainder(num, 100)\n tens = get_high_order(num, 10)\n ones = get_remainder(num, 10)\n \n print \"The number is #{thousands} \" + pluralize(\"thousand\", thousands)\n print \" #{hundreds} \" + pluralize(\"hundred\", hundreds) + \" #{tens} \"\n print pluralize(\"ten\", tens) + \" and #{ones} \" + pluralize(\"one\", ones) + \".\\n\"\nend",
"def separate_comma(number)\n number_string = number.to_s.split(\"\")\n new_string = \"\"\n if number_string.length < 4\n return number_string.join\n else\n sub_str = \"\"\n number_string.reverse_each do |digit|\n sub_str = digit + sub_str\n if sub_str.length == 3\n new_string = \",\" + sub_str + new_string\n sub_str = \"\"\n end\n end\n new_string = sub_str << new_string\n if new_string[0] == \",\"\n new_string = new_string[1..-1]\n end\n end\n new_string\nend",
"def separate_comma(num)\n\treturn str if str.length < 4\n\treturn str[0] + \",\" + str[1..3] if str.length < 5\n\treturn str[0..1] + \",\" + str[2..4] if str.length < 6 \n\treturn str[0..2] + \",\" + str[3..5] if str.length < 7\n\treturn str[0] + \",\" + str[1..3] + \",\" + str[4..6] if str.length < 8\n\treturn str[0..1] + \",\" + str[2..4] + \",\" + str[5..7] if str.length < 9\n\tend",
"def split_number(s)\n if s =~ /(\\d+),(\\d+)/\n [$1.to_i,$2.to_i]\n else\n [s.to_i,s.to_i]\n end\nend",
"def separate_comma(num_to_comma)\n str = num_to_comma.to_s\n count = str.length\n if count < 4\n p str\n elsif (count - 1) % 3 == 0\n while count > 1 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 2) % 3 == 0\n while count > 2 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 3) % 3 == 0\n while count > 3 do\n count = count - 3\n str.insert(count, \",\")\n end\n end\n p str\nend",
"def separate_comma(num)\nnum = num.to_s\nnums = num.split(\"\")\ndot_nums = []\n\n\n\tfor i in 0 ... nums.size \n\t\tif (i != nums.size-1) && (i-(2*i+1))%3==0 && nums.size >= 4 \n\t\t\tdot_nums << \",\" + nums[i] \n\t\telse\n\t\t\tdot_nums << nums[i]\n\t\tend\n\tend\np dot_nums.join\n\nend",
"def separate_comma(num)\n chars = num.to_s.split('')\n comma_count = chars.size/3\n return num.to_s if chars.size < 4\n\n if chars.size % 3 == 0\n comma_count -= 1\n end\n\n n = -4\n comma_count.to_i.times do |i|\n chars.insert(n, ',')\n n -= 4\n end\n chars.join(\"\")\nend",
"def separate_comma (number)\n a = number.to_s.chars.to_a.reverse\n b = a.count/3\n if a.count < 4\n return number.to_s\n elsif a.count == 6\n a.insert(3, \",\")\n return a.join.reverse\n elsif\n c = 3\n b.times do |n|\n a.insert(c, \",\")\n c = c +4\n end\n return a.join.reverse\n end\nend",
"def separate_comma(integer)\n if integer.to_s.length <= 3\n comma_string = integer.to_s\n else\n integer_array = integer.to_s.split('')\n integer_array.each_with_index do |n, i|\n if i % 4 == 0\n integer_array.insert(-i, \",\")\n end\n comma_string = integer_array.join(\"\")\n comma_string[0] = \"\"\n end\n end\n p comma_string\nend",
"def separate_comma(integer)\n number_string = integer.to_s\n char_count = integer.to_s.length\n\n if char_count > 3\n\n -4.step((-char_count - 1), -4) do |x|\n number_string.insert(x, \",\")\n end\n\n return number_string\n else\n return number_string\n end\nend",
"def parse(str)\n parts = str.split(',')\n parts.each do |part|\n range = self.class.parse_part(part)\n merge!(range)\n end\n end",
"def formatted_number(str)\n str = str.first\n return false if str =~ /[^\\d\\.\\,]/\n if str.include?('.')\n return false if str.count('.') > 1 || str.start_with?('.') || str.end_with?('.')\n str = str.split('.').first\n end\n if str.include?(',')\n return false if str.start_with?(',') || str.end_with?(',')\n parts = str.split(',')\n parts.each_with_index do |part, idx|\n return false if part.empty? || part.size > 3\n next if idx == 0\n return false if part.size < 3\n end\n else\n return false if str.size > 3\n end\n true\nend",
"def parse_grid(grid)\n # Convert grid to a dict of possible values, {square: digits}, or\n # return False if a contradiction is detected.\n ## To start, every square can be any digit; then assign values from the grid.\n values = {}\n $squares.map{|s| values[s] = deep_copy($digits)}\n grid_values(grid).each{|s, d| return false if $digits.include?(d.to_i) and not assign(values, s, d)}\n return values\nend",
"def parse_grid(some_string)\n the_grid = []\n\n some_string.split(\"\\n\").each do |line|\n the_row = []\n line.split(\" \").each do |column|\n the_row.push(column.to_i)\n end\n the_grid << the_row\n end\n\n return the_grid\nend",
"def parse_string(value, base)\n digits = value.split(//)\n parse_array(digits, base)\n end",
"def parse_input(input)\n input = input.split(',').map(&:to_i)\n {\n people_amount: input[0],\n n: input[1]\n }\nend",
"def separate_comma(number)\n\tnum = number.to_s\n\tnum_array = num.split(\"\")\n\t\tif num.length <= 3\n\t\t\treturn num\n\t\telse\n\t\t\tif num.length % 3 == 0\n\t\t\t\ti = num.length-3\n\t\t\t\twhile i > 0\n\t\t\t\t\tnum_array.insert(i, \",\")\n\t\t\t\t\ti -= 3\n\t\t\t\tend\n\t\t\telsif num.length % 3 == 1\n\t\t\t\ti = num.length-3\n\t\t\t\twhile i > 0\n\t\t\t\t\tnum_array.insert(i, \",\")\n\t\t\t\t\ti -= 3\n\t\t\t\tend\n\t\t\telsif num.length % 3 == 2\n\t\t\t\ti = num.length-3\n\t\t\t\twhile i > 0\n\t\t\t\t\tnum_array.insert(i, \",\")\n\t\t\t\t\ti -= 3\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn \"You did something wrong!\"\n\t\t\tend\n\t\t\treturn num_array.join\n\t\tend\t\nend",
"def separate_comma(integer)\n\n\tstring = integer.to_s.split ('') #makes the integer a string so we can insert commas, making it readable\n\tdivision = string.length/3\n\t\tif string.length<4\n\t\t\tp integer.to_s\t\t\t\t\t#first if/else if is used to find if the number needs to use this method.\n\t\telsif string.length%3 == 0\n\t\t\t(division.to_i-1).times do |i| #every 3 spaces add a comma.\n\t\t\t\tstring.insert(n, ',')\n\t\tend\n\t\t\tp string.join (\"\") #join the string back together again, inside of \"\"\n\t\telse \n\t\t\t\tn = -4\n\t\t\t\t\n\t\t\t\tdivision.to_i.times do |i| # Start with -4 because it helps understand that we only need to use if more than 4 digits.\n\t\t\t\t\n\t\t\t\tstring.insert(n, ',')\n\t\tend\n\t\t\t\tp string.join (\"\")\n\tend\nend",
"def separate_comma(integer)\n\tinteger = integer.to_s\n\ti = -4\n\tif integer.length <= 3\n\t\tp integer\n\telse\n\t\twhile i.abs <= integer.length\n\t\t\tinteger.insert(i,\",\")\n\t\t\ti -= 4\n\t\tend\n\tend\n\tp integer\nend",
"def separate_comma(num)\n num_s = num.to_s\n\n if num_s.length <= 3\n return num_s\n else\n i = -4\n until i < -num_s.length\n num_s.insert(i,\",\")\n i -= 4\n end\n return num_s\n end\nend",
"def parse_grid_data(input_string)\n # pull grid information in the format <integer>x<integer> from the start of the input string\n grid_segment = input_string.match(@grid_format_regex)\n\n # first check that the grid has matched something\n if grid_segment == nil\n raise ArgumentError, \"Unable to find grid settings at start of input string: #{input_string}\"\n end\n\n # assign the grid dimensions\n @grid_dimensions = [grid_segment[1].to_i, grid_segment[2].to_i]\n\n @logger.info \"Grid dimensions are: #{@grid_dimensions}\"\n\n # check here that the grid contains only positive numbers\n @grid_dimensions.each do |a|\n raise ArgumentError, \"Invalid grid input: #{a} Only positive integers allowed.\" unless a >= 0\n end\n end",
"def separate_comma(num)\n\tnumber = num.to_s\n\tif number.length < 4\n\t\tp number\n\telse\n\t\tnum_of_loops = ((number.length - 1) / 3)\n\t\tposition = -4\n\t\tuntil num_of_loops == 0\n\t\t\tnumber.insert(position, \",\")\n\t\t\tposition -= 4\n\t\t\tnum_of_loops -= 1\n\t\tend\n\tend\n\tp number\nend",
"def extract_numbers(string)\n results = []\n numbers = string.scan(/(\\d+[.?,?\\d*]*\\s?)/i)\n\n if numbers != nil\n numbers.each do |number|\n puts number[0]\n formatted_number = number[0].gsub(\",\", \"\")\n final_number = formatted_number.gsub(\" \", \"\").to_f\n results << final_number\n end\n end\n\n results\nend",
"def separate_comma(number)\n comma_separated_number = number.to_s.reverse.split('').each_slice(3).map {|obj| obj.push(\",\") }.join.chop.reverse\nend",
"def separate_comma(number)\n number = number.to_s\n number = number.split('').reverse!\n array_of_ints = number.each_slice(3).to_a\n array_of_ints.each do |num|\n if num.length == 3\n num.push(',')\n end\n end\n answer = array_of_ints.flatten!.reverse!.join()\n if answer[0] == ','\n answer[0] = ''\n return answer\n end\n return answer\nend",
"def separate_comma(your_number)\nyour_number = your_number.to_s\n if your_number.length < 4\n return your_number\n elsif\n your_number.length >= 4 && your_number.length <= 6\n return your_number[0..-4] + ',' + your_number[-3..-1]\n elsif\n your_number.length >= 7 && your_number.length <= 9\n return your_number[0..-7] + ',' + your_number[-6..-4] + ',' + your_number[-3..-1]\n elsif\n your_number.length >= 10 && your_number.length <= 12\n return your_number[0..-10] + ',' + your_number[-9..-7] + ',' + your_number[-6..-4] + ',' + your_number[-3..-1]\n end\nend",
"def separate_comma(integer)\n\n string = integer.to_s\n if string.length > 3\n array = string.split(\"\")\n i = (string.length - 3)\n while i > 0\n array.insert(i, \",\")\n i -= 3\n end\n array.join\n else\n string\n end\n\nend",
"def separate_comma(integer)\n\n if(integer.is_a?(Integer))\n \n if integer < 0\n print \"Please enter a positive integer.\"\n elsif integer == 0\n print \"0\"\n else\n i_string = integer.to_s\n num_commas = (i_string.length - 1)/3.floor\n i_split = i_string.split('')\n \n i = -4\n num_commas.times do\n i_split.insert(i,',')\n i += -4\n end\n \n return i_split.join('')\n \n end\n else\n \n print \"Please enter an integer only\"\n \n end\nend",
"def separate_comma(number)\n number.to_s.reverse.split(\"\").each_with_index { |x,y| x << \",\" if y == 3 || y == 6 }.reverse.join\nend",
"def separate_comma(int)\n\n result = []\n\n int.to_s.split(\"\").reverse.each_slice(3) do |slice|\n slice << \",\"\n result << slice\n end\n\n p result.flatten.join.chop.reverse\n\nend",
"def separate_comma(integer)\n num = integer.to_s.split(\"\").reverse\n item_index = 0\n delimit_at = 3\n num.each do |item|\n if item_index == delimit_at #6, 9, 12, etc.\n num[item_index] += ','\n delimit_at += 3\n end\n item_index += 1\n end\n return num.reverse.join\nend",
"def parse_position_list(val)\n val.each_slice(2).map do |(_, position)|\n Integer(position)\n end\n end",
"def boxes\n box_lines.map {|l| parse_line l.match(PARSE_BOX) }.to_set\n end",
"def separate_comma(integer)\n\n# Convert integer to a string\n string_integer = integer.to_s\n\n# Get comma count\n comma_num = (string_integer.length - 1)/3\n return string_integer if comma_num == 0\n\n#insert comma every four characters\n comma_num.times {|i| string_integer.insert(-4*(i+1),\",\")}\n return string_integer\nend",
"def separate_comma(integer)\n comma_array = []\n array_of_strings = integer.to_s.reverse.split(//)\n array_of_strings.each_slice(3){|triple_digits| comma_array << triple_digits}\n comma_array = comma_array.map{|numbers| numbers.join}\n comma_array.join(\",\").reverse\nend",
"def parse_comma_seperated_string(s)\n list = s.split(',')\n end",
"def separate_comma(number)\n\tstring_number = number.to_s\n\t\n\tif string_number.length <= 3\n\t\treturn string_number\n\telse \n\t\tif string_number.length%3 == 0\n\t\t\tcomma_place = 3\n\t\t\t# if the length of the string is evenly divisible by 3, the first\n\t\t\t# comma goes after the third character in the string\n\t\telse\n\t\t\tcomma_place = string_number.length%3\n\t\t\t# if the length is not evenly divisible by 3, figure out the remainder\n\t\t\t# when you divde by 3 and put the first comma after that character in \n\t\t\t# the string\n\t\tend\n\t\t\t\n\t\tcomma_counter = 0\n\t\t\t\n\t\twhile comma_place < string_number.length\n\t\t\t\tstring_number.insert(comma_place, \",\")\n\t\t\t\tcomma_counter += 1\n\t\t\t\tcomma_place += 3 + comma_counter\n\t\tend\n\t\t\t\t\n\tend\n\n\treturn string_number\n\nend",
"def ubicacion2(cadena)\n cad=cadena.split(/\\s|,/)\n cad[0]=cad[0].to_i\n cad[1]=cad[1].to_i\n return cad #[2,2,\"S\"]\nend",
"def separate_comma(num)\n num_array = num.to_s.reverse.split()\n num_array.each_with_index do |item, index|\n if (index+1)%4==0\n num_array.insert(index,\",\")\n end\n end\n return num_array.reverse.join\nend",
"def separate_comma(number)\n num = number.to_s\n i = -4\n while i >= (-1 * num.length)\n num.insert(i, ',')\n i -= 4\n end\n p num.to_s\nend",
"def commas(num)\nend",
"def separate_comma(number)\n\tif number.to_s.length >= 4 \n\t need_comma=[]\n\t need_comma=number.to_s.split(\"\")\n\t comma_hash={}\n\n\t number.to_s.length.times do |i|\n comma_hash[i+3] = need_comma[i] \n end\n \n \n comma_hash.each do |k, v| \n \t if k%3==0\n \t \tcomma_hash[k]<<\",\"\n \t end\n \tend\n\n\n\t real_number=[]\n\t real_number=comma_hash.values\n\t length=real_number.length\n\t real_number_two=real_number.delete(length)\n\nif real_number.last==\",\"\n\tputs real_number_two \nend\n\n puts real_number.join\n\telse \n\t puts number\n\tend\nend",
"def separate_comma(num) #takes an integer and converts it to a string with commas in appropriate places\n\tnumber_as_string = num.to_s #converts num to a string\n\tif number_as_string.length < 4 #checks if number isn't long enough to need a comma\n\t\tnumber_as_string #return the number as a string\n\telsif number_as_string.length < 7 #checks if number is bigger than 999, but less than 999,999\n\t\tnumber_as_string.insert -4, ',' #inserts a comma at the 4th from last place in string\n\telse\n\t\tnumber_with_1comma = number_as_string.insert -4, ',' #inserts a comma at the 4th from last place in string and saves that in a variable\n\t\tnumber_with_1comma.insert -8, ',' #inserts second comma in 8th from last place\n\tend\nend",
"def separate_comma(input)\n number= input.to_s\n if number.length>9\n number.insert(-4,',')\n number.insert(-8,',')\n number.insert(-12,',') \n elsif number.length>6\n \tnumber.insert(-4,',')\n number.insert(-8,',')\n elsif number.length>3\n \tnumber.insert(-4,',')\n else\n \treturn number\nend\nend",
"def separate_comma(integer)\n integer = integer.to_s\n length = integer.length\n i = 0\n integer = integer.split(\"\")\n puts integer\n while i < (length - 1)\n if (length - 1) % 3 == 0 && (i % 3 ==0 || i == 0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 2) % 3 == 0 && ((i-1) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n elsif (length - 3) % 3 == 0 && ((i-2) % 3 ==0)\n x = integer[i]\n integer[i] = \"#{x}\" + \",\"\n end\n i += 1\n end\n puts integer\n integer=integer.join\n p integer\nend",
"def separate_comma(num)\n\tstr = num.to_s\n\treturn str if str.length < 4\n\treturn str[0] + \",\" + str[1..3] if str.length < 5\n\treturn str[0..1] + \",\" + str[2..4] if str.length < 6 \n\treturn str[0..2] + \",\" + str[3..5] if str.length < 7\n\treturn str[0] + \",\" + str[1..3] + \",\" + str[4..6] if str.length < 8\n\treturn str[0..1] + \",\" + str[2..4] + \",\" + str[5..7] if str.length < 9\nend",
"def separate_comma(input)\n number= input.to_s\n if number.length>9\n number.insert(-3,',')\n number.insert(-6,',')\n number.insert(-9,',') \n elsif number.length>6\n \tnumber.insert(-3,',')\n number.insert(-6,',')\n elsif number.length>3\n \tnumber.insert(-3,',')\n else\n \treturn number\nend\nend",
"def separate_comma(number)\n\tnumber\nend",
"def separate_comma(number)\n if number.to_s.length < 3\n puts number\n else number.to_s.length >= 4\n puts number.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n end\nend",
"def separate_comma(integer)\n\tinteger.to_s.reverse.scan(/.{1,3}/).join(\",\").reverse\nend",
"def parse( line )\n info = line.split(',')\n return info\nend",
"def separate_comma(number)\n case number.to_s.length\n when 0..3\n puts number.to_s\n when 4..6\n puts number.to_s.insert(-4,\",\")\n when 7..9\n puts number.to_s.insert(-4,\",\").insert(-8,\",\")\n when 10..12\n puts number.to_s.insert(-4,\",\").insert(-8,\",\").insert(-12,\",\")\n end\nend",
"def separate_comma (number)\n\nnumber\n.to_s\n.reverse\n.split(\"\")\n.map.with_index {|x, i| ((i+1)%3 == 0 && number.to_s.length - (i+1) > 0 ? x << \",\" : x)}\n.join\n.reverse\n\nend",
"def separate_comma(integer)\n\tstring = integer.to_s\n\tif string.length > 3 \n\t\ti = -4\n\t\twhile i >= -string.length\n\t\t\tstring.insert(i, \",\")\n\t\t\ti += -4\n\t\tend\n\tend\n\tstring\nend",
"def parse\n individual_parameters = @equation.split(' ')\n\n integer_equation = individual_parameters.map do |param|\n next param if OPERATORS.include?(param)\n\n RomanNumeral.new(param).to_int\n end\n\n integer_equation.join(' ')\n end",
"def input_parse(input)\n list_coords = []\n height = 0\n xMin, xMax, yMin = [500, 0, 500]\n input.split(\"\\n\").each do |com_coords|\n if com_coords[0]=='x'\n x_raw, y_raw = com_coords.split(\",\")\n x = x_raw.delete(\"^0-9\").to_i\n xMin, xMax = [[xMin, x].min, [xMax, x].max]\n y_min, y_max = y_raw.delete(\" y=\").split('..').map{|i| i.to_i}\n height = [height, y_max].max\n (y_min..y_max).each do |y| \n list_coords.push({x: x, y: y})\n end\n else\n y_raw, x_raw = com_coords.split(\",\")\n y = y_raw.delete(\"^0-9\").to_i\n height = [height, y].max\n x_min, x_max = x_raw.delete(\" x=\").split('..').map{|i| i.to_i}\n xMin, xMax = [[xMin, x_min].min, [xMax, x_max].max]\n (x_min..x_max).each do |x| \n list_coords.push({x: x, y: y})\n end\n end\n end\n\n drawing = []\n height.times{|h| drawing.push(' '*((xMax - xMin)+3))}\n list_coords.each{|coords| drawing[coords[:y]-1][coords[:x] - xMin+1] = '#'} # draw clay\n drawing[0][500-xMin+1] = '|'\n drawing\nend",
"def parse_coordinate_data(input_string)\n # extract substrings matching ( int , int ) into an array, ignoring whitespace\n coords_string = input_string.scan(@coords_regex)\n\n #if nothing matches then return an empty array\n if coords_string == nil\n return []\n end\n\n # remove the brackets, split the coordinate strings, convert to integers, leave as array of arrays\n coords_array = coords_string.map do |a|\n b = a.gsub(/[()]/, \"\")\n c = b.split(/,\\s*/)\n x, y = c.map { |x| x.to_i}\n end\n\n @logger.info coords_array\n\n # check here that the coordinates in the array don't exceed the grid dimensions ever\n coords_array.each do |a|\n if a[0] > @grid_dimensions[0] || a[0] < 0\n raise ArgumentError, \"x-coord exceeds grid size. Destination: #{a} in grid #{@grid_dimensions}\"\n end\n\n if a[1] > @grid_dimensions[1] || a[1] < 0\n raise ArgumentError, \"y-coord exceeds grid size. Destination: #{a} in grid #{@grid_dimensions}\"\n end\n end\n end",
"def separate_comma(number)\n\tnumber = number.to_s.split('')\n\tindex = number.length\n\twhile index > 3 do\n\t\t\tnumber.insert(index-3,\",\")\n\t\tindex-=3\n\tend\n\tnumber.join\nend",
"def separate_comma(i)\n num = i.to_s\n if num.length % 3 == 0 && num.length > 3\n (num.length - 3).step(3, -3) {|v| num.insert(v, \",\")}\n elsif num.length > 3\n (num.length - 3).step(0, -3) {|v| num.insert(v, \",\")}\n end\n num\nend",
"def separate_comma(num)\n\tnum = num.to_s\n\tif num.length < 4\n\t\treturn num\n\telse\n\t\tnum = num.reverse.gsub(/(.{3})/, '\\1,').reverse\n\t\tif num[0] == \",\"\n\t\t\tnum[0] = \"\"\n\t\tend\n\t\treturn num\n\tend\nend",
"def separate_comma(n)\n rev_string = n.to_s.reverse\n with_commas = rev_string.insert(3, \",\")\n output = with_commas.reverse\n \n if n.to_s.length < 7\n if n.to_s.length < 4\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts n\n elsif \n n.to_s.length % 3 == 0\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n elsif\n n.to_s.length % 3 == 1\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n else\n n.to_s.length % 3 == 2\n with_commas = rev_string.insert(3, \",\")\n \t output = with_commas.reverse\n puts output\n end\n else\n mil_or_more = with_commas.insert(7, \",\")\n big_num = mil_or_more.reverse\n puts big_num\n end \nend",
"def separate_comma(number)\nstring = number.to_s\n\nif number < 1000 then\n string\n return string\n\nelsif (string.length % 3) != 0 then\n num_of_comma = (string.length / 3)\n gnirts = string.reverse\n x = 3\n i=0\n until i == num_of_comma\n gnirts.insert(x, \",\")\n i += 1\n x += 4\n end\n return gnirts.reverse\n\nelse (string.length % 3) == 0\n num_of_comma = ((string.length / 3) - 1)\n gnirts = string.reverse\n x = 3\n i=0\n until i == num_of_comma\n gnirts.insert(x, \",\")\n i += 1\n x += 4\n end\n return gnirts.reverse\nend\nend",
"def separate_comma(num)\n\tstr = num.to_s.split('')\n\tstr.reverse!\n\tcommas = []\n\tcount = 0\n\tstr.each do |i|\n\t\tif count < 3\n\t\t\tcommas.unshift(i)\n\t\t\tcount += 1\n\t\telsif count == 3 \n\t\t\tcommas.unshift(\",\")\n\t\t\tcommas.unshift(i)\n\t\t\tcount = 1\n\t\tend \n\tend\n\tcommas.join(\"\")\nend",
"def test_for_various_length_inputs_for_commas\n assert_equal 10, @calculator.Add('10')\n assert_equal 20, @calculator.Add('10,10')\n assert_equal 30, @calculator.Add('10,10,10')\n assert_equal 101, @calculator.Add('1,0,0,0,100')\n end",
"def separate_comma(int)\r\n int_s = int.to_s\r\n int_l = int_s.length\r\n if int_l < 4 \r\n int_s\r\n elsif int_l >= 4 && int_l < 7\r\n int_s.insert(-4, ',')\r\n elsif int_l <= 8\r\n int_s.insert(-4, ',')\r\n int_s.insert(-8, ',')\r\n end\r\nend",
"def test_parser_recognizer_success\n assert_equal '4', @parser.recognizer(VALID_DIGIT.lines.to_a[1..3].map{|l| l.chomp})\n end",
"def split_number(number)\n if number.length > 4\n tokens = []\n\n # reverse & split by doubles\n number.reverse.scan(/.(?:.|$)/) do |token|\n token.reverse!\n if token.length == 1\n tokens.last.prepend token\n else\n tokens << token\n end\n end\n\n # merge back\n tokens.reverse!\n tokens.tap do |tokens|\n tokens.map! { |token| yield token } if block_given?\n end\n else\n yield number if block_given?\n [number]\n end\n end",
"def separate_comma(num)\n\tnum_string = num.to_s\n\ti = num_string.length\n\t# puts i\n\t# puts num_string\n\treturn num_string if i <= 3\n\twhile i > 0 do #i=5\n\t\t\tnum_string.insert((0-(i+1)),\",\") if i % 3 == 0\n\t\t\tnum_string.delete num_string[0] if num.to_s.length == 6\n\t\t\ti-=1\n\tend\n\tnum_string.slice!(0) if num_string[0].include? \",\"\n\t# puts num_string\n\tnum_string\nend",
"def separate_comma ( int )\n int.to_s.split('').to_a().reverse().each_slice(3).to_a.map(&:join).join(\",\").reverse()\nend",
"def separate_comma(num)\n arr = num.to_s.split(\"\")\n arr = arr.each_index {|x|\n x = -x - 1\n arr = arr.insert(x, \",\") if x % 4 == 0\n }\n return arr.join\nend",
"def separate_comma(integer)\n\tinteger_string = integer.to_s\n\tif integer_string.length <= 3\n\t\treturn integer_string\n\telsif integer_string.length <= 6\n\t\treturn integer_string.insert(-4,',')\n\telse\n\t\treturn integer_string.insert(-7,',').insert(-4,',')\n\tend\nend",
"def sbox(pt, sbox_vals)\n # converts each of the values to the value it is mapped to in the sbox\n ary = pt.split(//).map { |i| sbox_vals[i]}\n return ary.join\nend",
"def separate_comma(user_integer)\n\tif user_integer.to_s.length <= 3\n\t\treturn user_integer.to_s\n\telse\n\t\tfinal_array=[]\n\t\tcounter_comma = (user_integer.to_s.length - 1) / 3\n\t\tuser_integer.to_s.split(\"\").reverse.each_slice(3) do |array|\n\t\t\tarray = array.push(\",\") if counter_comma > 0\n\t\t\tp array\n\t\t\tfinal_array = final_array + array\n\t\t\tcounter_comma -=1\n\t\tend\n\t\treturn final_array.reverse.join\n\tend\nend",
"def separate_comma(my_integer)\n\n\tmy_string = my_integer.to_s\n\n\tif my_string.length % 3 == 0\n\t\tcommas_needed = my_string.length / 3 - 1\n\telse\n\t\tcommas_needed = my_string.length / 3\n\tend\n\n\tmy_array = Array.new(my_string.length + commas_needed)\n\n\tstring_position = my_string.length - 1\n\n\tarray_position = my_array.length - 1\n\n\tcomma_counter = 0\n\n\tresult_string = \"\"\n\n\tuntil array_position < 0\n\n\t\tif comma_counter == 3 \n\t\t\tmy_array[array_position] = \",\"\n\t\t\tcomma_counter = 0\n\t\t\tarray_position -= 1\n\t\telse\n\t\t\tmy_array[array_position] = my_string[string_position]\n\t\t\tarray_position -= 1\n\t\t\tstring_position -= 1\n\t\t\tcomma_counter += 1\n\t\tend\n\n\t\t#print my_array\n\n\tend\n\n\tmy_array.each do |character|\n\t\tresult_string += character\n\t\t\n\tend\n\n\treturn result_string\n\n\t#puts \"commas needed \" + commas_needed.to_s\n\t\nend",
"def number_array\n @input_string.split(' ')\n end",
"def separate_comma(number)\n\n number = number.to_s\n reference = number.length - 3\n number2 = number.split(//)\n\n if number.length > 3\n while reference > 0\n number2.insert(reference, \",\")\n reference -= 4\n end\n end\np number2.join\nend",
"def separate_digit_lines(parsed_text_file)\n parsed_text_file.each_slice(4).to_a\nend",
"def separate_comma(number)\n\tnumber = number.to_s.split('')\n\tsliced_array = []\n\tnumber.reverse.each_slice(3) { |group| sliced_array.push(group) }\n\t# For every slice in the array we need reverse the array then we need to piece it back together adding the comma after every slice (This was a royal pain to figure out) (The constant reversing)\n\tsliced_array.reverse.map{|i| i.reverse.join}.join(\",\")\nend",
"def format_bbox(box)\n box.values.each_slice(2).to_a\n end",
"def viewbox_coords(viewbox) # :nodoc:\n return viewbox.text.split(' ').map do |coords|\n coords.split(',').map { |c| c.to_f }\n end\n\n end",
"def separate_comma(num)\n num_array = num.to_s.chars\n\n num_array.each_index do |index|\n if index % 4 == 0\n num_array.insert(-index, \",\")\n end\n end\n num_array[0] = \"\"\n num_array.join(\"\")\nend",
"def separate_comma(number)\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length <= 6\n n = 0\n elsif length % 2 == 0\n n = 1\n else\n n = 2\n end\n\n if length < 4\n return array.join.reverse\n elsif length <= 9 \n i = 3 \n while i < length + n do \n array.insert(i, \",\")\n i = i + 4 \n end\n end\n\n return array.join.reverse.to_s\nend",
"def parse_string string\n string.split(separator).map(&:to_f)\n end",
"def separate_comma (num)\n rev_num = num.to_s.reverse\n count = rev_num.length/3.1\n for i in 1..count\n num = rev_num.insert(4*i-1, \",\").reverse\n end\n num\nend",
"def separate_comma(number)\n\treturn number.to_s if number < 1000\n\tarr_string = number.to_s.split(\"\")\n\tnew_string = \"\"\n\tif number >= 1000 && number <= 9999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 0\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 10000 && number <= 99999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 1\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 100000 && number <= 999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 2\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\telsif number >= 1000000 && number <= 9999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 0 || arr_string.index(n) == 3\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\t\n\telsif number >= 10000000 && number <= 99999999\n\t\tarr_string.map! do |n|\n\t\t\tif arr_string.index(n) == 1 || arr_string.index(n) == 4\n\t\t\t\tnew_string << n + \",\"\n\t\t\telse\n\t\t\t\tnew_string << n\n\t\t\tend\n\t\tend\n\tend\n\tnew_string\t\nend"
] | [
"0.5725185",
"0.56800514",
"0.5598327",
"0.5561332",
"0.55471665",
"0.55361533",
"0.5437865",
"0.5434925",
"0.54308045",
"0.5426325",
"0.54177195",
"0.5394734",
"0.5390538",
"0.5384195",
"0.53711957",
"0.5371127",
"0.53222734",
"0.52947557",
"0.52777505",
"0.52601725",
"0.52342075",
"0.5233502",
"0.5232614",
"0.5232199",
"0.52288496",
"0.522832",
"0.5223139",
"0.52083504",
"0.5203812",
"0.51870954",
"0.5186136",
"0.5179934",
"0.51560116",
"0.51449716",
"0.51404804",
"0.51373535",
"0.51332045",
"0.5132003",
"0.5114357",
"0.5107717",
"0.51060164",
"0.5103398",
"0.5094137",
"0.5087567",
"0.50680536",
"0.50655204",
"0.50608844",
"0.5051913",
"0.50329566",
"0.50325227",
"0.5030739",
"0.5030257",
"0.5029052",
"0.50275743",
"0.5025065",
"0.50182664",
"0.50166535",
"0.5015476",
"0.50120914",
"0.50085956",
"0.5007866",
"0.5003619",
"0.5001548",
"0.49964708",
"0.49963045",
"0.49961627",
"0.49954003",
"0.4981537",
"0.49771816",
"0.4975375",
"0.49626556",
"0.4958716",
"0.49582064",
"0.49523836",
"0.4951896",
"0.49475202",
"0.49417183",
"0.49404147",
"0.49375948",
"0.4937299",
"0.4930999",
"0.4925229",
"0.49205884",
"0.49115804",
"0.49055564",
"0.4902431",
"0.48884916",
"0.48855338",
"0.48845705",
"0.48817846",
"0.48737592",
"0.48708034",
"0.4861266",
"0.48594043",
"0.48570287",
"0.48549223",
"0.48524937",
"0.48442388",
"0.48400006",
"0.48326722"
] | 0.6891576 | 0 |
Create a new API object. This is useful to create multiple APIs and use them with the `uses_api` method. If your application uses only one API, you should use Her::API.setup to configure the default API | def initialize(*args, &blk)
setup(*args, &blk)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.113'\n }\n )\n end\n $api\n end",
"def set_api\n @api = Api.find(params[:id])\n rescue\n @api = Api.new\n end",
"def initialize(api)\n @api = api\n end",
"def create_adwords_api\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')\n @api = AdwordsApi::Api.new(config_filename)\n end",
"def new(host:, port:, ssl: false, username:, password:, api_version:)\n api = nil\n\n # check that the API version is implemented\n api_version_file = File.join(File.dirname(__FILE__), \"v#{api_version}\", \"api.rb\")\n if File.exist?(api_version_file)\n require api_version_file.sub('.rb', '')\n\n api = Object.const_get(\"PaloAlto::V#{api_version}::Api\").new(host: host,\n port: port,\n ssl: ssl,\n username: username,\n password: password)\n else\n raise \"API version '#{api_version}' is not implemented\"\n end\n\n api\n end",
"def api\n @http ||= Http.new(config)\n end",
"def create\n @api = Api.new(api_params)\n\n respond_to do |format|\n if @api.save\n format.html { redirect_to @api, notice: 'Api was successfully created.' }\n format.json { render :show, status: :created, location: @api }\n else\n format.html { render :new }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api = Api.new(params[:api])\n\n respond_to do |format|\n if @api.save\n format.html { redirect_to apis_url, notice: 'Api was successfully created.' }\n format.json { render json: @api, status: :created, location: @api }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(api_obj)\n @api_obj = api_obj\n end",
"def setup_apigateway_create_rest_api(api_name, api_description)\r\n puts 'Creating API with name ' + api_name\r\n api = @client.create_rest_api(name: api_name, description: api_description)\r\n api.id\r\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def create_by_api(params = {})\n create_by_translator params_to_translator(params)\n end",
"def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApi\n Facturama::FacturamaApiWeb.new(facturama_user,facturama_password,is_development)\n end",
"def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end",
"def api(options = {})\n @api ||= case url.host\n when String then RestClient::Resource.new(url.host, options)\n else RestClient::Resource.new(API_ENDPOINT.host, options)\n end\n end",
"def create\n @api = Api.new(api_params)\n\n respond_to do |format|\n if @api.save\n format.html { redirect_to @api, notice: 'Api criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @api }\n else\n format.html { render action: 'new' }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def create\n @api = Api.new(params[:api])\n\n respond_to do |format|\n if @api.save\n format.html { redirect_to(@api, :notice => 'Api was successfully created.') }\n format.xml { render :xml => @api, :status => :created, :location => @api }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @api.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def api\n return Runtime.instance.set_if(self, :api) do\n LapisLazuli::API.new\n end\n end",
"def parse_api api_yaml\n api = ::Google::Protobuf::Api.new\n api.name = api_yaml[NAME_KEY] if api_yaml.key? NAME_KEY\n api.version = api_yaml[VERSION_KEY] if api_yaml.key? VERSION_KEY\n api\n end",
"def set_api_stub\n return @_api_stub if @_api_stub\n @_api_stub = Her::API.new\n allow(MnoEnterprise::BaseResource).to receive(:her_api).and_return(@_api_stub = Her::API.new)\n @_api_stub\n end",
"def restful_api\n @restful_api ||= AlephApi::RestfulApiClient.new(url: @restful_api_url)\n end",
"def [](api_name)\n request.api = api_name\n self\n end",
"def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApiMultiemisor\n Facturama::FacturamaApiMulti.new(facturama_user,facturama_password,is_development)\n end",
"def load_api_service\n @api_service = ApiService.new\n end",
"def set_api\r\n api = EVEAPI::API.new\r\n api.api_id = api_key.api_id\r\n api.v_code = api_key.v_code\r\n api.character_id = id\r\n api\r\n end",
"def create_adwords_api()\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml.erb')\n template = ERB.new File.new(config_filename).read\n processed = YAML.load template.result(binding)\n @api = AdwordsApi::Api.new(processed)\n token = session[:token]\n # If we have an OAuth2 token in session we use the credentials from it.\n if token\n credentials = @api.credential_handler()\n credentials.set_credential(:oauth2_token, token)\n credentials.set_credential(:client_customer_id, selected_account)\n end\n return @api\n end",
"def create_api_token\n begin\n ApiToken.create(api_consumer: self)\n end\n end",
"def api\n # Only instantiate the API if needed. validate_update doesn't require it, so we shouldn't\n # make an unnecessary request to get the app_access_token.\n @api ||= API.new(app_access_token)\n end",
"def create_adwords_api()\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')\n @api = AdwordsApi::Api.new(config_filename)\n token = session[:token]\n # If we have an OAuth2 token in session we use the credentials from it.\n if token\n credentials = @api.credential_handler()\n credentials.set_credential(:oauth2_token, token)\n credentials.set_credential(:client_customer_id, selected_account)\n end\n return @api\n end",
"def setup_api\n if white_listed?(path)\n @api = Api.new\n return\n end\n\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.find_by_email(email)\n if user.password == password\n @api = Api.new(user)\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n begin\n if current_user\n @api = Api.new(current_user)\n else\n render(:nothing => true, :status => :unauthorized)\n end\n rescue NameError\n @api = Api.new\n end\n end\n end",
"def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end",
"def api\n @api ||= Ncio::Api::V1.new(opts)\n end",
"def setup_api\n #\n @api = Api.new(current_user)\n\n #\n if white_listed?(path)\n return\n end\n\n #\n token = params[:token] || request.headers['X-Api-Token'] || request.headers['X-API-TOKEN']\n\n unless token.blank?\n user = nil\n token = Token.where(:kind => 'api', :uuid => token.to_s).first\n\n if token and token.context.is_a?(User)\n user = token.context\n end\n\n if user\n @api.user = user\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.where(:email => email).first\n\n if user and user.password == password\n @api.user = user\n else\n headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n if defined?(current_user) and current_user\n @api.user = current_user\n else\n @api.user = nil\n #headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n #render(:nothing => true, :status => :unauthorized)\n #return\n end\n end\n end\n\n #\n unless @api.route?(@path) or @path == 'index'\n render :nothing => true, :status => 404\n end\n end",
"def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end",
"def assign_api_key!\n self.api_key = ApiKey.create!\n end",
"def api_class(options={})\n @api_class ||= {}\n return @api_class[options[:api] || self.api] if @api_class[options[:api] || self.api]\n\n @api_class[options[:api] || self.api] = ExternalAPI.const_get((options[:api] || self.api).to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n end",
"def set_api(*args); end",
"def set_api(*args); end",
"def set_api_key\n\t\tself.api_key = ApiKey.create()\n\tend",
"def api\n @api ||= WeatherApiCalls.new\n end",
"def api(method_name)\n clazz = ApiRegistry.find(method_name.to_sym)\n return unless clazz < RestMethod\n api_method = clazz.new\n api_method.session = self if api_method.kind_of? RestMethod\n api_method\n end",
"def api=(value)\n @api = value\n end",
"def initialize(api_url, app_name = DEFAULT_APP_NAME)\n @app_name = app_name\n @key = Digest::MD5.hexdigest(@app_name)\n @api_endpoint = \"http://#{api_url}/api\"\n end",
"def api\n @api ||= PrismicService.init_api\n end",
"def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"def api\n @api ||= Battlenet.new(:eu)\n end",
"def initialize(api_id)\n @api_id = api_id\n @app_info = nil\n @channels = {}\n initialize_stats\n logger.debug \"Created application\"\n end",
"def initialize(api_key, options = {})\n @api_key = api_key\n @api_endpoint = DEFAULT_API_ENDPOINT\n end",
"def create\n backend_api = current_account.backend_apis.create(create_params)\n respond_with(backend_api)\n end",
"def app\n API.new(ledger: ledger)\n end",
"def initialize(params)\n\n fail 'missing API Base URL' if params[:api_base_url].nil?\n fail 'missing API Key' if params[:api_key].nil?\n fail 'missing API Secret' if params[:api_secret].nil?\n\n params[:api_base_url] = params[:api_base_url].gsub(/\\/$/, '') # remove trailing slash\n params[:api_spec] = false if params[:api_spec].nil?\n\n set_manifest(params)\n\n end",
"def api\n @api\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key, secret, api_uri)\n @api_key = api_key\n @secret = secret\n @api_uri = api_uri\n end",
"def create\n @api = Api.new(api_params)\n current_user.apis << @api\n respond_to do |format|\n\n if @api.save\n format.html { redirect_to user_path(current_user), notice: 'Api-nyckeln har skapats' }\n format.json { render :show, status: :created, location: @api }\n else\n format.html { render :new }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_api_module\n @module_name = @project_name.split('_').map(&:capitalize).join('')\n create_api_module\n config_server\n end",
"def app\n APIServer::Application\nend",
"def create\n @api_v1_resource = Api::V1::Resource.new(api_v1_resource_params)\n\n respond_to do |format|\n if @api_v1_resource.save\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_resource }\n else\n format.html { render :new }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare\n @api = BigBlueButton::BigBlueButtonApi.new(URL, SECRET, VERSION.to_s, true)\n end",
"def initialize( api_key )\n @api_key = api_key\n end",
"def new\n @api = Api.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api }\n end\n end",
"def get_adwords_api\n @api ||= create_adwords_api\n end",
"def initialize(api_key)\n @api_key = api_key \n end",
"def api\n @config = ZipMoney::Configuration\n configure_api if @_api.nil?\n \t @_api\n end",
"def api(params = {})\n Celluloid::Logger.info \"Registering api...\"\n self.use_api = true\n self.api_host = params[:host] || '127.0.0.1'\n self.api_port = params[:port] || '4321'\n end",
"def api\n @api ||= Octokit::Client.new(:login => login, :oauth_token => token)\n end",
"def api_stub_configure(api)\n # This block should match the her.rb initializer\n api.setup MnoEnterprise.send(:api_options).merge(url: \"http://localhost:65000\") do |c|\n # Request\n c.use Faraday::Request::BasicAuthentication, MnoEnterprise.tenant_id, MnoEnterprise.tenant_key\n c.use Faraday::Request::UrlEncoded\n\n # Response\n c.use Her::Middleware::MnoeApiV1ParseJson\n c.use Her::Middleware::MnoeRaiseError\n\n # Add stubs on the test adapter\n c.use MnoeFaradayTestAdapter do |receiver|\n @_stub_list.each do |key,stub|\n params = stub[:params] && stub[:params].any? ? \"?#{stub[:params].to_param}\" : \"\"\n path = \"#{stub[:path]}#{params}\"\n \n receiver.send(stub[:method] || :get,path) { |env|\n body = Rack::Utils.parse_nested_query(env.body)\n \n # respond_with takes a model in argument and automatically responds with\n # a json representation of the model\n # If the action is an update, it attempts to update the model\n if model = stub[:respond_with]\n model.assign_attributes(body['data']) if stub[:method] == :put && model.respond_to?(:assign_attributes) && body['data']\n resp = from_api(model)\n else\n if stub[:response].is_a?(Proc)\n args = stub[:response].arity > 0 ? [body] : []\n resp = stub[:response].call(*args)\n else\n resp = stub[:response] || {}\n end\n end\n \n # Response code\n if stub[:code].is_a?(Proc)\n args = stub[:code].arity > 0 ? [body] : []\n resp_code = stub[:code].call(*args)\n else\n resp_code = stub[:code] || 200\n end\n\n\n [resp_code, {}, resp.to_json]\n }\n end\n end\n end\n end",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def api(api_key = nil)\n # For whatever reason, unless we provide a truthy API key, Turbot::API's\n # initializer immediately attempts to `#get_api_key_for_credentials`.\n api_key ||= email_address_and_api_key[1] || ''\n turbot_api.new(turbot_api_parameters.merge(:api_key => api_key))\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key, api_secret)\n @api_key = api_key\n @api_secret = api_secret\n @api_base_url = 'https://pepocampaigns.com'\n end",
"def initialize(options = {})\n @api_key = options[:api_key]\n @language = options[:language] || Fotolia::Language.new(DEFAULT_LANGUAGE)\n @api_uri = options[:api_uri] || DEFAULT_API_URI\n @xmlrpc_client = XMLRPC::Client.new2(@api_uri)\n\n raise ApiKeyRequiredError unless(@api_key)\n end",
"def initialize(api_key:)\n @api_key = api_key\n end",
"def new\n @api_user = ApiUser.new\n end",
"def fabricate_via_api!\n validate_reuse_preconditions\n\n resource_web_url(api_get)\n rescue Errors::ResourceNotFoundError\n super\n ensure\n self.class.resources[reuse_as] ||= {\n tests: Set.new,\n resource: self\n }\n\n self.class.resources[reuse_as][:attributes] ||= all_attributes.each_with_object({}) do |attribute_name, attributes|\n attributes[attribute_name] = instance_variable_get(\"@#{attribute_name}\")\n end\n self.class.resources[reuse_as][:tests] << Runtime::Example.location\n end",
"def initialize_api_endpoint\n if PrMigrator.configuration.github_enterprise_endpoint\n Octokit.configure do |c|\n c.api_endpoint = PrMigrator.configuration.github_enterprise_endpoint\n end\n end\n end",
"def api_server\n @api_server ||= NewRelic::Control::Server.new(Agent.config[:api_host], Agent.config[:api_port])\n end",
"def initialize(api_url:, api_key:, verbose: false)\n self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)\n self.api_key = api_key\n self.verbose = verbose\n end",
"def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @api = Api.new(self)\n @api_revision = ApiRevision.new(self)\n @api_release = ApiRelease.new(self)\n @api_operation = ApiOperation.new(self)\n @api_operation_policy = ApiOperationPolicy.new(self)\n @tag = Tag.new(self)\n @api_product = ApiProduct.new(self)\n @api_policy = ApiPolicy.new(self)\n @api_schema = ApiSchema.new(self)\n @api_diagnostic = ApiDiagnostic.new(self)\n @api_issue = ApiIssue.new(self)\n @api_issue_comment = ApiIssueComment.new(self)\n @api_issue_attachment = ApiIssueAttachment.new(self)\n @api_tag_description = ApiTagDescription.new(self)\n @operation_operations = OperationOperations.new(self)\n @api_version_set = ApiVersionSet.new(self)\n @authorization_server = AuthorizationServer.new(self)\n @backend = Backend.new(self)\n @cache = Cache.new(self)\n @certificate = Certificate.new(self)\n @api_management_operations = ApiManagementOperations.new(self)\n @api_management_service_skus = ApiManagementServiceSkus.new(self)\n @api_management_service = ApiManagementService.new(self)\n @diagnostic = Diagnostic.new(self)\n @email_template = EmailTemplate.new(self)\n @group = Group.new(self)\n @group_user = GroupUser.new(self)\n @identity_provider = IdentityProvider.new(self)\n @issue = Issue.new(self)\n @logger = Logger.new(self)\n @network_status = NetworkStatus.new(self)\n @notification = Notification.new(self)\n @notification_recipient_user = NotificationRecipientUser.new(self)\n @notification_recipient_email = NotificationRecipientEmail.new(self)\n @open_id_connect_provider = OpenIdConnectProvider.new(self)\n @policy = Policy.new(self)\n @policy_snippet = PolicySnippet.new(self)\n @sign_in_settings = SignInSettings.new(self)\n @sign_up_settings = SignUpSettings.new(self)\n @delegation_settings = DelegationSettings.new(self)\n @product = Product.new(self)\n @product_api = ProductApi.new(self)\n @product_group = ProductGroup.new(self)\n @product_subscriptions = ProductSubscriptions.new(self)\n @product_policy = ProductPolicy.new(self)\n @property = Property.new(self)\n @quota_by_counter_keys = QuotaByCounterKeys.new(self)\n @quota_by_period_keys = QuotaByPeriodKeys.new(self)\n @region = Region.new(self)\n @reports = Reports.new(self)\n @subscription = Subscription.new(self)\n @tag_resource = TagResource.new(self)\n @tenant_access = TenantAccess.new(self)\n @tenant_access_git = TenantAccessGit.new(self)\n @tenant_configuration = TenantConfiguration.new(self)\n @user = User.new(self)\n @user_group = UserGroup.new(self)\n @user_subscription = UserSubscription.new(self)\n @user_identities = UserIdentities.new(self)\n @user_confirmation_password = UserConfirmationPassword.new(self)\n @api_export = ApiExport.new(self)\n @api_version = '2019-01-01'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def initialize(api_key, source, config = {})\n raise ArgumentError.new('Your need to specify your api key') unless api_key\n raise ArgumentError.new('You need to specify a source website') unless source\n\n\n defaults = {\n :api_version => API_VERSION\n }\n\n @config = defaults.merge(config).freeze\n @api_key = api_key\n @source = source\n @litmosURL = \"https://api.litmos.com/v#{@config[:api_version]}.svc/\"\n @devURL = \"http://apidev.litmos.com/v#{@config[:api_version]}.svc/\"\n end",
"def create_api_token(params = {})\n ApiToken.create(self, params)\n end",
"def api_client(request_id = new_req_id)\n configure_blueprint\n\n api_client = BlueprintClient::ApiClient.new\n api_client.default_headers = {\n 'X-Request-Id' => request_id,\n 'User-Agent' => \"talis-ruby-client/#{Talis::VERSION} \"\\\n \"ruby/#{RUBY_VERSION}\"\n }\n\n BlueprintClient::HierarchyApi.new(api_client)\n end",
"def set_rest_api\n @rest_api = RestApi.find(params[:id])\n end",
"def initialize(apikey)\n @apikey = apikey\n end",
"def set_api_hello\n @api_hello = Api::Hello.find(params[:id])\n end",
"def create\n @api_hello = Api::Hello.new(api_hello_params)\n\n respond_to do |format|\n if @api_hello.save\n format.html { redirect_to @api_hello, notice: 'Hello was successfully created.' }\n format.json { render :show, status: :created, location: @api_hello }\n else\n format.html { render :new }\n format.json { render json: @api_hello.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def with_api(api, options = {}, &blk)\n server(GrapeApe::Server.new(api: api), options.delete(:port) || 9900, options, &blk)\n end",
"def initialize\n @api_user = \"\"\n @api_key = \"\"\n end",
"def api(command, options = {})\n client.api(command, options)\n end",
"def api(command, options = {})\n client.api(command, options)\n end",
"def setup_apigateway(api_name, env, swagger_file, api_description = 'Deployed with LambdaWrap',\r\n stage_variables = {}, region = ENV['AWS_REGION'])\r\n # ensure API is created\r\n api_id = get_existing_rest_api(api_name)\r\n api_id = setup_apigateway_create_rest_api(api_name, api_description) unless api_id\r\n\r\n # create resources\r\n setup_apigateway_create_resources(api_id, swagger_file, region)\r\n\r\n # create stages\r\n stage_variables.store('environment', env)\r\n create_stages(api_id, env, stage_variables)\r\n\r\n # return URI of created stage\r\n \"https://#{api_id}.execute-api.#{region}.amazonaws.com/#{env}/\"\r\n end",
"def initialize\n begin\n @api_methods = Api_methods\n @api_version = Api_version\n rescue StandardError => e\n $log.error(sprintf(\"%s: %s\", __method__, e.message))\n raise\n end\n end",
"def create_api_module\n File.open(\"#{@project_name}/app/apis/#{@project_name}/base.rb\", \"w\") do |f|\n f.write('module ') \n f.puts(@module_name)\n f.write(\"\\tclass Base < Grape::API\\n\\tend\\nend\")\n end\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\tapp/apis/#{@project_name}/base.rb\"\n end",
"def new(options = {}, &block)\n #@api_client = Github::Client.new(options, &block)\n end",
"def create_buckets_api\n InfluxDB2::API::BucketsApi.new(@api_client)\n end"
] | [
"0.7162728",
"0.69256765",
"0.68460214",
"0.6824223",
"0.6786411",
"0.67235625",
"0.67153436",
"0.66804457",
"0.663272",
"0.66325116",
"0.66214204",
"0.66214204",
"0.6605221",
"0.6590835",
"0.6527874",
"0.65183944",
"0.6503497",
"0.64959615",
"0.6447837",
"0.64315754",
"0.64309967",
"0.6412731",
"0.63587064",
"0.6329334",
"0.63237566",
"0.6315815",
"0.6311949",
"0.6283394",
"0.6232606",
"0.62271833",
"0.6211247",
"0.62046957",
"0.6193478",
"0.6161354",
"0.61159056",
"0.6103355",
"0.60485464",
"0.60485107",
"0.60235035",
"0.60235035",
"0.5990393",
"0.59656036",
"0.5944069",
"0.59419197",
"0.5940051",
"0.5938286",
"0.5934475",
"0.59327096",
"0.5931369",
"0.592538",
"0.5880286",
"0.5873743",
"0.58638316",
"0.58578414",
"0.5841997",
"0.58175325",
"0.581515",
"0.5812347",
"0.58030415",
"0.57982785",
"0.57892495",
"0.57724625",
"0.57709277",
"0.5770311",
"0.576799",
"0.5761626",
"0.5759099",
"0.57571393",
"0.57526046",
"0.5752023",
"0.5751957",
"0.5749968",
"0.5749968",
"0.5749968",
"0.5745148",
"0.57334584",
"0.57251513",
"0.57215786",
"0.57168233",
"0.57162505",
"0.57014835",
"0.5684417",
"0.5678885",
"0.5675875",
"0.5663051",
"0.56590116",
"0.56585985",
"0.56521547",
"0.564804",
"0.56412005",
"0.56331474",
"0.56323326",
"0.5612006",
"0.5609296",
"0.56064564",
"0.56064564",
"0.5600807",
"0.5593397",
"0.5590654",
"0.559034",
"0.5587201"
] | 0.0 | -1 |
Define a custom parsing procedure. The procedure is passed the response object and is expected to return a hash with three keys: a main data Hash, an errors Hash and a metadata Hash. | def request(opts = {})
method = opts.delete(:_method)
path = opts.delete(:_path)
headers = opts.delete(:_headers)
options = opts.delete(:_options) || {}
opts.delete_if { |key, _| key.to_s =~ /^_/ } # Remove all internal parameters
if method == :options
# Faraday doesn't support the OPTIONS verb because of a name collision with an internal options method
# so we need to call run_request directly.
request.headers.merge!(headers) if headers
response = @connection.run_request method, path, opts, headers
else
response = @connection.send method do |request|
request.headers.merge!(headers) if headers
timeout = options.delete(:timeout)
raise "options not implemented: #{options.keys.join(', ')}" unless options.empty?
request.options[:timeout] = timeout if timeout
if method == :get
# For GET requests, treat additional parameters as querystring data
request.url path, opts
else
# For POST, PUT and DELETE requests, treat additional parameters as request body
request.url path
request.body = opts
end
end
end
{ :parsed_data => response.env[:body], :response => response }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(response)\n\nend",
"def parse_response!; end",
"def response_parser; end",
"def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end",
"def parse_response(response)\n raise NotImplementedError, '.parse_response should be implemented in subclass'\n end",
"def parse_response(response)\n raise NotImplementedError\n end",
"def parse(response)\n XMLRPC::Marshal.load_response(response.body)\n end",
"def parse_response(response)\n split_response = response.split(/\\n/).map(&:strip)\n ((/^total/.match(split_response.first)) ? split_response[1..-1] : []).each_with_object(Hash.new { |h,k| h[k] = []}) do |e, acc|\n fields = e.split(/\\s +/)\n acc[fields.last] << { :state => fields[0], :uuid => fields[1], :pid => fields[2], :description => fields.last }\n end\n end",
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def parse\n # if body.chomp!\n if body.include?(\"\\n\")\n parse_multi_line\n else\n parse_line(response_keys, body)\n end\n end",
"def parse(uri, response, body); end",
"def parse_response(response)\n @response = response.body\n @code = response.code\n @message = response.message\n end",
"def parse_response(response)\n log(:info, \"Running parse_response...\")\n\n # return the response if it is already a hash\n if response.is_a?(Hash)\n log(:info, \"Response <#{response.inspect}> is already a hash. Returning response.\")\n return response\n else\n if @rest_return_type == 'json'\n # attempt to convert the JSON response into a hash\n log(:info, \"Response type requested is JSON. Converting JSON response to hash.\")\n response_hash = JSON.parse(response) rescue nil\n elsif @rest_return_type == 'xml'\n # attempt to convert the XML response into a hash\n log(:info, \"Response type requested is XML. Converting XML response to hash.\")\n response_hash = Hash.from_xml(response) rescue nil\n else\n # the return_type we have specified is invalid\n raise \"Invalid return_type <#{@rest_return_type}> specified\"\n end\n end\n\n # raise an exception if we fail to convert response into hash\n raise \"Unable to convert response #{response} into hash\" if response_hash.nil?\n\n # log return the hash\n log(:info, \"Inspecting response_hash: #{response_hash.inspect}\") if @debug == true\n log(:info, \"Finished running parse_response...\")\n return response_hash\n end",
"def response_parser_for api_config, operation\n raise NotImplementedError\n end",
"def process_response(response)\n if !valid_rpc_response?(response)\n fail(InvalidResponse.new(response: response))\n return\n end\n\n error_key = @symbolize_names ? :error : :error.to_s\n if response.key?(error_key)\n # process error response\n fail(ErrorResponse.parse(response, symbolize_names: @symbolize_names))\n else\n # process successful response\n succeed(Response.parse(response, symbolize_names: @symbolize_names))\n end\n end",
"def parse(response)\n case response\n when Hash\n response.each_with_object({}) do |(key, value), new_hash|\n new_hash[camel_case_to_snake_case(key).to_sym] = parse(value)\n end\n when Array\n response.map { |item| parse item }\n else\n response\n end\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n @parsed_response ||= ResponseParser.parse(response)\n end",
"def parse_result(data)\n Parser.process(data)\n end",
"def interpret_response(response)\n case response.code.to_i\n when 200\n puts 'OK'\n when 201,202,204\n puts 'OK'\n return\n when 400\n puts 'Bad request'\n return\n when 404\n puts 'Resource not found'\n return\n when 500\n puts 'Sensu encountered an error'\n return\n else\n puts \"Unexpected HTTP response code #{response.code}\"\n return\n end\n\n return JSON.parse(response.body)\n end",
"def parse_response(response)\n status = RESPONSE_STATUSES.fetch(response.code) { raise \"Response not known\" }\n raise Amfetamine::RecordNotFound if status == :notfound\n body = if response.body && !(response.body.blank?)\n response.parsed_response\n else\n self.to_json\n end\n { :status => status, :body => body }\n end",
"def parseXML()\n @transform = PoortegoTransform.new('ParsedResponse')\n result_href = XmlSimple.xml_in(@xml_response.to_s)\n \n unless (result_href.has_key?('ResponseData'))\n return\n end\n \n (result_href['ResponseData'])[0].each do |response_key, response_val|\n if (response_key == 'Entities')\n parse_entities_hash(response_val)\n elsif (response_key == 'Links')\n parse_links_hash(response_val)\n else\n puts \"Invalid ResponseData key\"\n end\n end\n \n (result_href['ResponseMessages'])[0].each do |message_key, message_val|\n if (message_key == 'Message')\n parse_message_hash(message_val)\n else\n puts \"Invalid ResponseMessages key\"\n end\n end\n \n end",
"def parse_response(body)\n json = JSON.parse body, symbolize_names: true\n @success = json[:success]\n @failed = json[:failure]\n @canonical_ids = json[:canonical_ids]\n @results = (json[:results] || []).map { |result| gcm_result_for result }\n end",
"def process_response(response)\n content_type = content_type_for(response)\n result = process_body(response.body)\n\n if response.success?\n case content_type_for(response)\n when :csv\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: CSV.parse(result))\n else\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: parse_body(result))\n end\n else\n handle_error(result, response.status, content_type)\n end\n end",
"def parse\n end",
"def parsed_response\n response\n end",
"def parse_response(response)\n\n if response[\"outcome\"]==\"success\"\n\n #Assign calorie counts and grams breakdown\n self.total_calories=response[\"fields\"][\"total_calories\"].to_i\n self.protein_grams=response[\"fields\"][\"total_calories\"].to_i\n self.fat_grams=response[\"fields\"][\"fat_grams\"].to_i\n self.carbohydrate_grams=response[\"fields\"][\"carbohydrate_grams\"].to_i\n self.fiber_grams=response[\"fields\"][\"fiber_grams\"].to_i\n\n #Number of coffees\n self.number_of_coffees=response[\"fields\"][\"number_of_coffees\"].to_i\n\n #Assign medications based on response\n if response[\"choice\"]=='only_took_morning_meds'\n self.morning_medications=true\n self.evening_medications=false\n\n elsif response[\"choice\"]=='only_took_evening_meds'\n self.morning_medications=false\n self.evening_medications=true\n\n elsif response[\"choice\"]=='took_both_morning_and_evening'\n self.morning_medications=true\n self.evening_medications=true\n\n else\n self.morning_medications=false\n self.evening_medications=false\n\n end\n\n self.save \n\n else\n raise \"Bad Scale API callback data\"\n end\n\n end",
"def parse(response)\n case response\n when /\\ANOTIFY/ then\n SSDP::Notification.parse response\n when /\\AHTTP/ then\n SSDP::Response.parse response\n when /\\AM-SEARCH/ then\n SSDP::Search.parse response\n else\n raise Error, \"Unknown response #{response[/\\A.*$/]}\"\n end\n end",
"def parse(data); 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 parse_result(_res)\r\n\t\t#form of the response: \r\n\t\t#VALID RESULTS (arbitrary value) ==> 200 result=1 (1119166301)\r\n\t\t#VALID RESULTS (integer) ==> Response: 200 result=0\r\n\t\t#BAD COMMAND ==> 510\r\n\t\t#USAGE ERROR ==> 520...520..\\n\r\n\t\t#if I get 510, then the command was not found, sorry\r\n\t\t\r\n\t\tif (_res=~/510/)==0 then # 510 = BAD COMMAND\r\n\t\t\twhile !(_res=~/510/) # asterisk may send more than one at at time. lame.\r\n\t\t\t\t#RAGI.LOGGER.info(\"Received \" + _res);\r\n\t\t\t\t_res = read_line()\r\n\t\t\t\t#RAGI.LOGGER.info(\"STUFF2: #{_res}\")\r\n\t\t\tend\r\n\t\t\r\n\t\t\tRAGI.LOGGER.info(\"Received 510 Command not found error #{_res}\")\r\n\t\t\t_cmd = /\\(.*\\)/.match(_res).to_s.gsub(/[\\(\\)]/,'')\r\n\t\t\traise CmdNotFoundError, \"Command could not be found = #{_cmd}\"\r\n\t\t\treturn nil\r\n \r\n\t\t\t#if I get 520, then the command usage was not found, sorry\r\n\t\telsif (_res=~/520/)==0 then # 520 = USAGE ERRROR\r\n\t\t\tRAGI.LOGGER.info(\"Received 520 Invalid Command Usage #{_res}\")\r\n\t\t\t_usage = ''\r\n\t\t\t_res = read_line()\r\n\t\t\t#RAGI.LOGGER.info(\"STUFF: #{_res}\")\r\n\t\t\twhile !(_res=~/520/) # asterisk may send more than one at at time. lame.\r\n\t\t\t\t#RAGI.LOGGER.info(\"Received \" + _res);\r\n\t\t\t\t_usage += _usage\r\n\t\t\t\t_res = read_line()\r\n\t\t\t\t#RAGI.LOGGER.info(\"STUFF2: #{_res}\")\r\n\t\t\tend\r\n\t\t\traise UsageError, \"Command Usage Incorrect, correct usage - #{_usage}\"\r\n\t\t\treturn nil\r\n\t\telsif ((_res=~/200/)==0) then # 200 = Results\r\n\t\t\teqindex =_res.index(\"=\") \r\n\t\t\tif (eqindex==nil)\r\n\t\t\t\tRAILS_DEFAULT_LOGGER.error(\"Error, unexpected 200 result with no value \" + _res.to_s)\r\n\t\t\t\treturn nil\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#if there is a value in parens, return it.\r\n\t\t\tlb=_res.index(\"(\")\r\n\t\t\trb=_res.rindex(\")\")\r\n\t\t\tif (lb != nil and rb != nil)\r\n value = _res[lb+1, rb-lb-1]\r\n if value == \"timeout\" then\r\n # in the case of \"200 result=<num> (timeout)\" we should return <num>\r\n value = _res[eqindex+1,lb-eqindex-1]\r\n end\r\n \r\n value.chomp!(\" \")\r\n return value\r\n\t\t\telse\r\n # there is an int result we hope.\r\n value = _res[eqindex+1, _res.length]\r\n return value.chomp!\r\n\t\t\tend\r\n\t\tend\r\n end",
"def parse_result!(h)\n @result = {}\n return unless h.is_a?(Hash)\n @code = h[CODE]\n @error = h[ERROR]\n if h[RESULTS].is_a?(Array)\n @result = h[RESULTS]\n @count = h[COUNT] || @result.count\n else\n @result = h\n @count = 1\n end\n end",
"def process(parser)\n end",
"def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end",
"def handle res, opts = {}\n @response = res\n\n parse = opts.has_key?(:parse) ? opts[:parse] : true\n\n case res.status\n when 200..299, 422 then JSON.parse res.body if parse\n when 401, 403 then raise Audiosocket::Unauthorized\n when 404 then nil\n\n else\n raise \"Unexpected response (#{res.status}) from the API:\\n#{res.body}\"\n end\n end",
"def parse_data\n [object_ref, get_symbol, parse]\n end",
"def parse(parse_info)\r\n block.call(parse_info)\r\n end",
"def parsed; end",
"def parsed; end",
"def parse_response\n if @http_response.body && @http_response.respond_to?(:headers) && @http_response.headers['Content-Type']\n if @http_response.headers['Content-Type'].include?('xml')\n parse_xml_response\n elsif @http_response.headers['Content-Type'].include?('json')\n parse_json_response\n end\n else\n parse_unknown_response\n end\n end",
"def parse_context; end",
"def parse_context; end",
"def parse(rawdata)\n end",
"def method_missing(method_name, *params, &blk)\n if parsed_result.respond_to?(method_name)\n parsed_result.method(method_name).(*params, &blk)\n else\n super\n end\n end",
"def result( response )\n response.body\n .dig(:process_request_response, :process_request_result) \n end",
"def initialize(http_response, result_format = :mashie)\n @result_format = result_format\n @headers = parse_headers(http_response.to_hash)\n @body = parse_body(http_response.body)\n end",
"def parse_response(response)\n if response.kind_of?(Net::HTTPServerError)\n raise Jamendo::Error.new(\"Jamendo Server Error: #{response} - #{response.body}\", response)\n end\n \n case @format\n when :json\n JSON.parse(response.body, symbolize_names: true)\n when :xml\n REXML::Document.new(response.body)\n else\n raise Jamendo::Error.new('You are trying to parse unparsable!')\n end\n end",
"def parse_response(response)\n response.parse\n rescue HTTP::Error\n nil\n end",
"def response_metadata=(_); end",
"def parse_json_response(response) # :nodoc:\n doc = JSON.parse(response)\n\n result_params = {\n :doctype => :html5,\n :checked_by => MARKUP_VALIDATOR_URI\n }\n\n result_params[:uri] = doc['url'] ||= nil\n if doc['source']\n result_params[:charset] = doc['source']['encoding'] ||= nil\n end\n\n result_params[:validity] = !doc['messages'].any? { |msg| msg['type'] =~ /^error$/i }\n\n results = Results.new(result_params)\n\n doc['messages'].each do |msg|\n if msg['type'] =~ /^error$/i\n msg_type = :error\n elsif msg['subType'] =~ /^warning$/\n msg_type = :warning\n else\n next\n # TODO: should throw exceptions here\n end\n\n message_params = {\n :line => msg['lastLine'],\n :col => msg['firstColumn'],\n :message => msg['message'],\n :source => msg['extract']\n }\n\n results.add_message(msg_type, message_params)\n end\n\n return results\n\n rescue Exception => e\n handle_exception e\n end",
"def parse_response(response_string)\n\n if (response_string.include? \"ERROR~\")\n return parse_errors(response_string)\n end\n\n pairs = response_string.split(@field_delim)\n pairs.each do |p|\n k,v = p.split(@value_delim)\n if @values.has_key?(k)\n @values[k] = [@values[k]] unless @values[k].is_a?(Array)\n @values[k] << v\n else\n @values[k] = v\n end\n end\n end",
"def domain_create_result(proc_id)\n result = parse_attributes(result_retrieve(proc_id)[:body].split(\"\\n\\n\", 1)[0])\n puts result\n return nil unless result.has_key? :completion_status\n case result[:completion_status]\n when 'ack' then\n result_delete proc_id\n result[:object_name]\n when 'nack' then\n raise_response result\n else\n nil\n end\n end",
"def parse_response_list(rl, submission) \n\tpairs_array = rl.split(\"~\")\n\tresponse_hash = Hash.new\n\n\tpairs_array.each do |pair|\n\t\tkey_value = pair.split(\":\")\n\t\tresponse_hash[key_value[0]] = key_value[1]\n\tend\n\n\treturn response_hash\nend",
"def do_parse(spec_info)\r\n spec_info.instance_exec(&@block)\r\n end",
"def result(parsed, logger)\n %w(classes parameters).each do |required_key|\n next if parsed[required_key]\n logger.debug parsed.keys.inspect\n raise OctocatalogDiff::Errors::PEClassificationError, \"Response missing: #{required_key}\"\n end\n\n obj = { 'classes' => parsed['classes'], 'parameters' => parsed['parameters'] }\n obj.to_yaml\n end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def call()\n json = do_request()\n parse(json)\n end",
"def parse_response(response, template_param)\n params = template_param.split('.')\n result = response\n params.each do |param|\n result = result[param] if result.class == Hash\n end\n\n result\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def FunctionCall(rest, parsed); end",
"def metadatas(response:)\n if response_ok?(response: response)\n parse_result(body: response.body)\n else\n Rails.logger.warn 'Dictionnaire-Academie failed in ' \\\n \"its seach for #{word}\"\n end\n end",
"def parse_response(xml)\n raise NotImplementedError\n end",
"def method_missing(name,*args,&block)\n self.class.send :define_method,\"parse_#{name}\" do |node,contents|\n block.call node,contents\n end\n end",
"def parse response\n JSON.parse(response, symbolize_names: true)\n end",
"def process_response(obj)\n end",
"def get_parse(s);end",
"def metadata()\n return {\n :description => \"PXP Puppet module\",\n :actions => [\n { :name => \"run\",\n :description => \"Start a Puppet run\",\n :input => {\n :type => \"object\",\n :properties => {\n :env => {\n :type => \"array\",\n },\n :flags => {\n :type => \"array\",\n :items => {\n :type => \"string\"\n }\n }\n },\n :required => [:flags]\n },\n :results => {\n :type => \"object\",\n :properties => {\n :kind => {\n :type => \"string\"\n },\n :time => {\n :type => \"string\"\n },\n :transaction_uuid => {\n :type => \"string\"\n },\n :metrics => {\n :type => \"object\"\n },\n :environment => {\n :type => \"string\"\n },\n :status => {\n :type => \"string\"\n },\n :error_type => {\n :type => \"string\"\n },\n :error => {\n :type => \"string\"\n },\n :exitcode => {\n :type => \"number\"\n },\n :version => {\n :type => \"number\"\n }\n },\n :required => [:kind, :time, :transaction_uuid, :environment, :status,\n :exitcode, :version]\n }\n }\n ],\n :configuration => {\n :type => \"object\",\n :properties => {\n :puppet_bin => {\n :type => \"string\"\n }\n }\n }\n }\nend",
"def parse_response\n @api_method = @api_response.env[:method]\n @api_url = @api_response.env[:url].to_s\n @api_status = @api_response.status\n @api_message = 'undef'\n @api_request_id = 'undef'\n\n unless @api_response.body.empty?\n begin\n parsed = JSON.parse(@api_response.body, symbolize_names: true)\n @api_message = parsed[:message]\n @api_request_id = parsed[:requestId]\n rescue JSON::ParserError\n # We fail silently as defaults have been set\n end\n end\n end",
"def parse(response_body)\n Filepreviews::Response.new(JSON.parse(response_body))\n end",
"def parse(response_body)\n Filepreviews::Response.new(JSON.parse(response_body))\n end",
"def parse_response(response)\n find_elements(name.split('::').last.downcase, response).map do |e|\n new id: e.attr('id').to_i, name: e.text\n end\n end",
"def process_response(response, opts)\n unless response.success?\n if response.status == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.status,\n :response_headers => response.headers,\n :response_body => response.body && !response.body.empty? ? response.body : response.reason_phrase)\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n\n return data, response.status, response.headers\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse\n {:indent => @indent, :command => parse_command}\n end",
"def response_message\n parsed_response['message']\nend",
"def parse_result(response)\n response_code = response.code\n query = response.request.options[:query]\n unless response_code == 200\n @logger.error(\"returned status code : #{response_code} query : #{query} response : #{response.body[(0..1000)]}\")\n raise \"returned status code : #{response_code}, query is #{query}\"\n end\n @logger.info(\"query succeeded with: #{response_code}, query is #{query}\")\n JSON.parse(response.body, symbolize_names: true)\n end",
"def parse_response(filename, response)\n # Use Nokogiri to parse the xml\n response_data = Nokogiri::XML.parse(response.body)\n # Begin building the return hash\n result = { \n :file => filename,\n :status => response['x-w3c-validator-status'].downcase.to_sym,\n :error_count => response['x-w3c-validator-errors'].to_i,\n :errors => Array.new\n }\n # Get meta elements like encoding and doctype\n response_data.css('result > meta *').each do |meta|\n next unless %w{encoding doctype}.include? meta.name\n result[meta.name.to_sym] = meta.content\n end\n # Get errors\n response_data.css('result messages msg').each do |error|\n result[:errors] << {\n :message => error.content,\n :line => error['line'].to_i,\n :col => error['col'].to_i\n }\n end\n result\n end",
"def parse(raw_file, filemeta: {})\n response = RestClient::Request.execute(post_arguments(raw_file, filemeta))\n SovrenRest::ParseResponse.new(response.body)\n rescue RestClient::Exceptions::Timeout\n raise SovrenRest::ClientException::RestClientTimeout\n rescue RestClient::ExceptionWithResponse => e\n handle_response_error(e.response)\n end",
"def parse(savon_response)\n new(savon_response)\n end",
"def parse_vapix_response(raw)\n if raw =~ /Error: Error/\n return {}\n end\n response = nested_hash\n raw_responses = raw.split(/\\n/)\n raw_responses.each do |raw_response|\n raw_key_string, raw_value = raw_response.split('=')\n raw_keys = raw_key_string.split('.')\n raw_keys.shift # get rid of root.\n last_key = nil\n semilast_hash = nil\n last_hash = response\n raw_keys.length.times do |level|\n last_key = raw_keys[level]\n semilast_hash = last_hash\n last_hash = last_hash[last_key]\n end\n semilast_hash[raw_keys.last] = raw_value\n end\n return response\n end",
"def parse_response(responses)\n @success = responses.count { |response| response[:code] == 200 }\n @failed = responses.count { |response| response[:code] != 200 }\n @results = responses.map do |response|\n mpns_result_for response[:code],\n response[:device_url],\n response[:headers]\n end\n end",
"def parse_response(response)\n check_version_and_warn(response.headers[X_KONTENA_VERSION])\n\n if response.headers[CONTENT_TYPE] =~ JSON_REGEX\n parse_json(response)\n else\n response.body\n end\n end",
"def parse(http_response)\n return { 'OK' => 'session_id' } if API.test_mode\n \n if http_response.body.scan(/ERR/).any?\n raise Clickatell::API::Error.parse(http_response.body)\n end\n results = http_response.body.split(\"\\n\").map do |line|\n # YAML.load converts integer strings that have leading zeroes into integers\n # using octal rather than decimal. This isn't what we want, so we'll strip out any\n # leading zeroes in numbers here.\n response_fields = line.scan(PARSE_REGEX)\n response_fields = response_fields.collect { |field| field.gsub(/\\b0+(\\d+)\\b/, '\\1') }\n YAML.load(response_fields.join(\"\\n\"))\n end\n results.length == 1 ? results.first : results\n end",
"def create_response_value_processor(endpoint_response)\n response_type = endpoint_response.type\n if response_type == TYPE_ARRAY\n processor_for_values = create_processor_for_type('Response', endpoint_response.items, false)\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new('Response', true, processor_for_values)\n elsif response_type == TYPE_FILE\n # Don't validate the files' content\n nil\n elsif response_type\n create_processor_for_type('Response', response_type, false)\n else\n nil\n end\n end",
"def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end",
"def parse_response(response)\n # @todo Parse the response based on the @format (\"txt\", \"json\" or \"xml\")\n JSON.parse(response)\n end",
"def parse_response(response)\n # @todo Parse the response based on the @format (\"txt\", \"json\" or \"xml\")\n JSON.parse(response)\n end",
"def parse_metadata\n meta=Hash.new\n meta['hostname']=@xdr.string\n meta['name']=@xdr.string\n meta['spoof']=@xdr.uint32\n meta['type']=@xdr.string\n meta['name2']=@xdr.string\n meta['units']=@xdr.string\n slope=@xdr.uint32\n\n case slope\n when 0\n meta['slope']= 'zero'\n when 1\n meta['slope']= 'positive'\n when 2\n meta['slope']= 'negative'\n when 3\n meta['slope']= 'both'\n when 4\n meta['slope']= 'unspecified'\n end\n\n meta['tmax']=@xdr.uint32\n meta['dmax']=@xdr.uint32\n nrelements=@xdr.uint32\n meta['nrelements']=nrelements\n unless nrelements.nil?\n extra={}\n for i in 1..nrelements\n name=@xdr.string\n extra[name]=@xdr.string\n end\n meta['extra']=extra\n end\n return meta\n end",
"def unpack_response( response )\n\t\ttable = TNetstring.parse( response ).first\n\t\tself.log.debug \"Unpacking response: %p\" % [ table ]\n\n\t\t# Success\n\t\tif table.key?( 'headers' )\n\t\t\theaders, rows = table.values_at( 'headers', 'rows' )\n\t\t\theaders.map!( &:to_sym )\n\n\t\t\treturn rows.collect do |row|\n\t\t\t\tHash[ [headers, row].transpose ]\n\t\t\tend\n\n\t\t# Error\n\t\telsif table.key?( 'code' )\n\t\t\t# {\"code\"=>\"INVALID_ARGUMENT\", \"error\"=>\"Invalid argument type.\"}\n\t\t\traise Mongrel2::ControlError.new( table['code'], table['error'] )\n\n\t\telse\n\t\t\traise ScriptError, \"Don't know how to handle response: %p\" % [ table ]\n\t\tend\n\tend",
"def process(external_request, response)\n # The response_wrapper stores the response and modifies it as a side effect.\n # The caller will use the original response\n response_wrapper = Puppet::Network::HTTP::Response.new(self, response)\n request = make_generic_request(external_request)\n\n set_puppet_version_header(response)\n\n respond_to_errors(response_wrapper) do\n with_request_profiling(request) do\n find_route_or_raise(request).process(request, response_wrapper)\n end\n end\n end",
"def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend",
"def process_ocr_data\n if successful?\n begin\n self.json_parser = Ocr::Parser.new(response_body['data'].dup, response_required_fields.dup, attachment.merging_required)\n json_parser.add_status_keys\n rescue => e\n attachment.parsing_failed!\n report_exception(e, self)\n end\n else\n begin\n raise ResponseErrorAtOcr, \"Ocr Response is - #{response_body['response_code']} not 100\"\n rescue ResponseErrorAtOcr => e\n report_exception(e, self)\n end\n end\n end",
"def parse_response(response)\n response = sanitize_response_keys(response.parsed_response)\n end",
"def parse_command(raw_code)\n code, subcode = raw_code.split\n @expected = structure_with_code(code)\n @response = response_with_code(code, subcode)\n end",
"def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n return response unless response\n @parsed_response ||= case response.content_type\n when 'application/json'; response.body.empty? ? '' : JSON.parse(response.body)\n when 'text/html'; { } #HTMLResponseParser.parse(response.body)\n else; response.respond_to?(:to_hash) ? response.to_hash : response.to_s\n end\n @parsed_response\n end",
"def parse(string = nil)\n if self.file =~ /\\.rb$/\n main = parse_ruby_file\n else\n self.string = string if string\n begin\n @yydebug = false\n main = yyparse(@lexer,:scan)\n rescue Racc::ParseError => except\n error = Puppet::ParseError.new(except)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n rescue Puppet::ParseError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::Error => except\n # and this is a framework error\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::DevError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue => except\n error = Puppet::DevError.new(except.message)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n end\n end\n # Store the results as the top-level class.\n return Puppet::Parser::AST::Hostclass.new('', :code => main)\n ensure\n @lexer.clear\n end",
"def parser; end",
"def parser; end"
] | [
"0.66142166",
"0.64953107",
"0.6379111",
"0.6361654",
"0.6241713",
"0.6183187",
"0.60923916",
"0.6056907",
"0.6025048",
"0.594682",
"0.5932052",
"0.59165937",
"0.5916343",
"0.5891151",
"0.5869819",
"0.58680457",
"0.58312273",
"0.58312273",
"0.58312273",
"0.5820034",
"0.58084273",
"0.57904625",
"0.5788102",
"0.5755408",
"0.5752667",
"0.5750276",
"0.57265717",
"0.5719216",
"0.5713973",
"0.5701387",
"0.56920445",
"0.56756645",
"0.5669512",
"0.56670713",
"0.5618118",
"0.56180257",
"0.56131244",
"0.56053305",
"0.5565837",
"0.5562174",
"0.5562174",
"0.55584925",
"0.5547968",
"0.5547968",
"0.55462646",
"0.55332565",
"0.55305487",
"0.55223143",
"0.55156326",
"0.5511748",
"0.55091053",
"0.5508949",
"0.5507303",
"0.5472564",
"0.5470185",
"0.546968",
"0.54678005",
"0.5463276",
"0.54574156",
"0.54559135",
"0.5447434",
"0.5447434",
"0.5443681",
"0.54410154",
"0.5437046",
"0.54360074",
"0.54317534",
"0.5425384",
"0.54223514",
"0.54186916",
"0.5411168",
"0.54027194",
"0.54027194",
"0.53937376",
"0.53839743",
"0.53822976",
"0.538167",
"0.5379757",
"0.5369312",
"0.53673553",
"0.5365465",
"0.5363379",
"0.53615516",
"0.5350777",
"0.53481275",
"0.53419596",
"0.5320982",
"0.5317057",
"0.5314541",
"0.5314541",
"0.5313075",
"0.5311051",
"0.5308504",
"0.530442",
"0.52926075",
"0.529149",
"0.5290045",
"0.5288418",
"0.52742696",
"0.52679807",
"0.52679807"
] | 0.0 | -1 |
TODO: What does this do? This should be moved to the RoutesController anyway | def surrounding_journeys
@route = Route.find(params[:route_id])
@previous_journeys = @route.journeys.where('start_time < ?', params[:datetime]).order('start_time DESC').limit(2)
@next_journeys = @route.journeys.where('start_time > ?', params[:datetime]).order('start_time ASC').limit(2)
render layout: false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def route_index; end",
"def anchored_routes; end",
"def route\n #TODO\n end",
"def routes_map; end",
"def custom_routes; end",
"def route_name; end",
"def route_name; end",
"def routes\r\n RoutesController.instance\r\n end",
"def route_sets; end",
"def routes\n raise NotImplementedError\n end",
"def named_route; end",
"def external_routes; end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def controller_path; end",
"def controller_path; end",
"def route\n @route\n end",
"def named_routes; end",
"def route() request.route end",
"def routes(&block); end",
"def routes(&block); end",
"def route\n @base_controller.route if @base_controller\n end",
"def routing_number; end",
"def router; end",
"def _roda_main_route(_)\n end",
"def route14\n end",
"def routes_normal\n return Array.new\n end",
"def routes(context={})\n \n routes = [ \n ]\n \n end",
"def routes(context={})\n \n routes = [ \n ]\n \n end",
"def named_routes=(_arg0); end",
"def routes\n [@name.downcase]\n end",
"def routes\n ['Agriculture, environmental and animal care', 'Business administration', 'Catering and hospitality' \\\n 'Construction',\n 'Creative and design', 'Digital', 'Engineering and manufacturing', 'Hair and beauty', 'Health and science',\n 'Legal, finance and accounting', 'Protective services', 'Sales, marketing and procurement', 'Transport']\n end",
"def live_route_ar\n route_descriptor_ar(ActionController::Routing::Routes)\n end",
"def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end",
"def routes\n routes_method.call\n end",
"def routes\n @routes || self.class.routes\n end",
"def index\n @rails_routes = RailsRoute.all\n end",
"def routes\n request :get, '/routes'\n end",
"def route_index\n route via: :get, path: '', member: false\n end",
"def came_from_route\n @came_from_route\n end",
"def routes\n context[:routes]\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller_name; end",
"def controller_name; end",
"def routing_keys\n []\n end",
"def get_routes\n raise \"Method not implemented\"\n end",
"def body_route\n \"#{controller_name}_#{action_name}\"\n end",
"def route_for(name, *args); end",
"def index\n @routes = Route.get_active\n end",
"def routes\n app_obj.routes\n end",
"def all_routes\n matching_routes\n end",
"def routes_normal\n return @routes[:inside_region]\n end",
"def index\n @routes = Route.hottest\n end",
"def controller\n @controller\n end",
"def normalize_controller!; end",
"def route_path(path)\n AutoRouter::Router.map_controller(self, path: path)\n end",
"def controller(controller); end",
"def undefined_route\n routing_error!\n end",
"def reload_routes!; end",
"def reload_routes!; end",
"def initialize\n @routes = {}\n end",
"def no_routes\n end",
"def request_path; end",
"def index\n @routes = Route.all\n end",
"def index\n @routes = Route.all\n end",
"def index\n @routes = Route.all\n end",
"def index\n @routes = Route.all\n end",
"def setup_router(scope); 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",
"def route_eval\n super\n rescue ActiveRecord::RecordNotFound\n not_found\n end",
"def routes\n cached_routes\n end",
"def route(index_or_name)\n case index_or_name\n when Integer\n Rails.application.routes.routes[index_or_name]\n when Symbol # named route\n Rails.application.routes.named_routes.get index_or_name\n end\nend",
"def routes\n # /home is temporary\n ['login', 'logout', 'home', 'newuser', 'edituser']\n end",
"def params_from(path)\r\n ensure_that_routes_are_loaded\r\n ActionController::Routing::Routes.recognize_path(path)\r\nend",
"def url_for_index; end",
"def url_for_index; end",
"def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend",
"def route_user(action)\n case action\n when 1 then @patients_controller.list\n end\n end",
"def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE, path: '/', action: :delete }\n\t\t\t\t\t]\n\t\t\t\tend"
] | [
"0.750399",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7349786",
"0.7163136",
"0.71519077",
"0.70389384",
"0.6942796",
"0.6928146",
"0.69260496",
"0.69260496",
"0.6831481",
"0.6814708",
"0.67849976",
"0.6613865",
"0.6569914",
"0.65637225",
"0.65637225",
"0.65637225",
"0.65592366",
"0.65592366",
"0.65483177",
"0.6505677",
"0.6496604",
"0.6462631",
"0.6462631",
"0.6450204",
"0.64371777",
"0.6376173",
"0.63559824",
"0.6283348",
"0.6210721",
"0.6205716",
"0.6205716",
"0.6194745",
"0.61944604",
"0.6134452",
"0.60993016",
"0.6075536",
"0.6021424",
"0.6011728",
"0.5980577",
"0.596804",
"0.5922633",
"0.59043133",
"0.5886972",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58833665",
"0.58662766",
"0.58662766",
"0.58528167",
"0.58473885",
"0.5832253",
"0.57997125",
"0.5786493",
"0.5778726",
"0.5767924",
"0.57566375",
"0.57511824",
"0.5750909",
"0.57453275",
"0.57447433",
"0.5742407",
"0.57397085",
"0.5733705",
"0.5733705",
"0.5699718",
"0.5695486",
"0.5691265",
"0.5669402",
"0.5669402",
"0.5669402",
"0.5669402",
"0.5669035",
"0.5661411",
"0.56602097",
"0.56557983",
"0.5651186",
"0.5647575",
"0.5641745",
"0.5641623",
"0.5641623",
"0.5633801",
"0.5633166",
"0.56293297"
] | 0.0 | -1 |
TODO: Add more tests later (need nc_inq) Datasetdefine_mode | def test_redef_closed
nc = Dataset.new('test/data/simple.nc')
nc.close()
assert_raise NetCDFError do
nc.define_mode()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ndata; end",
"def test_on_open\n nc = Dataset.new('test/data/simple.nc')\n assert_equal(false, nc.define_mode?)\n nc.close()\n end",
"def dataset?\n true\n end",
"def type\n 'dataset'\n end",
"def data_complextest(db); end",
"def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end",
"def unlimited_dimension?\n @netcdf_elmt.hasUnlimitedDimension() \n end",
"def dataset\n @dataset ||= data_maker.dataset\n end",
"def test_enddef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.data_mode()\n end\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset?(name)\n self[name] ? true : false\n end",
"def select(*args); dataset.select(*args); end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end",
"def get_data_mode()\n return(get_cmd('DT;',0.1,0.5,3).gsub(/^DT/,'').gsub(/;$/,'').to_i)\nend",
"def on_has_external_subset\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def subset_content\n self.class.subsets[subset.to_sym] if valid_subset? \n end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def prepare_dataset\n @working_dataset.dataset.each { |tuple| @clustered_dataset[tuple] = -1 }\n end",
"def subset conditions\n rows = self.select do |row|\n conditions.reduce(true) do |memo, (var, val)|\n memo and row[var] == val\n end\n end\n Dataset.new rows\n end",
"def make_query data_set\n if data_set.has_key?(:new_old)\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type], :new_old=>data_set[:new_old]}\n elsif data_set.has_key?(:tile)\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type], :tile=>data_set[:tile]}\n else\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type]}\n end\n query\nend",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def dim; 1; end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def read_CNF(filename)\n raw_data = IO.read(DIR + filename).split(\"\\n\")\n\n dataset = []\n\n raw_data.each do |subset|\n dataset << subset.split(\" \")\n end\n # Return values:\n # 0 Number of clauses\n # 1 Number of variables\n # 2 Array of clauses, formula\n [dataset[0][2].to_i, dataset[0][3].to_i, dataset[1..-1]]\nend",
"def _check_constraints_ds\n @_check_constraints_ds ||= metadata_dataset.\n from{pg_constraint.as(:co)}.\n left_join(Sequel[:pg_attribute].as(:att), :attrelid=>:conrelid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:conkey])).\n where(:contype=>'c').\n select{[co[:conname].as(:constraint), att[:attname].as(:column), pg_get_constraintdef(co[:oid]).as(:definition)]}\n end",
"def on_has_internal_subset\n end",
"def mode() end",
"def set_data_mode(data)\n puts \"Setting Data Mode to #{data}\" if $verbose\n d='DT'+(('000'+data.to_s)[-3..-1])+';'\n puts d if $verbose\n ret=send_cmd(d,'DT;',d,0.25,1.0,3)\n if(ret)\n return(ret.gsub(/^DT/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def association_dataset_proc\n ASSOCIATION_DATASET_PROC\n end",
"def selection_data\n dataset ||= DB[:selections]\n end",
"def prepare_data(num_rows)\n app_train = read_dataset_from_csv('./input/application_train', num_rows)\n data = app_train[\"data\"]\n set_categorical_labels(data)\n numeric_features, _categorical_features = get_numeric_cateforical_features_from_the_raw_dataset(app_train[\"data\"])\n categorical_features_one_hot_encode = get_one_hot_feature_map_from_the_origin_dataset(data)\n one_hot_encoding_using_feature_map(data, categorical_features_one_hot_encode)\n\n # NaN values for DAYS_EMPLOYED: 365243 -> nan\n data.each do |r|\n r_features = r[\"features\"]\n if r_features[\"days_empoyed\"] == 365243\n r_features[\"days_employed\"] = \"\"\n r_features[\"days_employed_anom\"] = 1\n else\n r_features[\"days_employed_anom\"] = 0 \n end \n \n add_ratio_feature(\"payment_rate\", \"amt_annuity\", \"amt_credit\", r)\n add_ratio_feature(\"annuity_income_ratio\", \"amt_annuity\", \"amt_income_total\", r)\n add_ratio_feature(\"credit_goods_ratio\", \"amt_credit\", \"amt_goods_price\", r)\n # add_ratio_feature(\"income_person_ratio\", \"amt_income_total\", \"cnt_fam_members\", r)\n add_ratio_feature(\"employed_birth_ratio\", \"days_employed\", \"days_birth\", r)\n end\n # categorical_features << \"days_employed_anom\"\n\n bureau = read_dataset_from_csv('./input/bureau', 1000, $bureau_numeric_features)\n # bureau[\"data\"].each do |r|\n # puts r[\"features\"][\"days_enddate_fact\"]\n # end\n # return\n grouped = group_data(bureau[\"data\"])\n agged = agg_group_data(grouped, $bureau_numeric_features, \"bureau\")\n merge_to_dataset(app_train, agged, $bureau_numeric_features)\n\n app_train[\"features\"] = app_train[\"data\"][0][\"features\"].keys\n\n puts \"begin to normalize the dataset......\"\n nomalizer = Normalizer.new\n nomalizer.normalize(app_train, numeric_features)\n\n puts \"begin to impute missing value......\"\n imputer = SimpleImputer.new\n imputer.fit(app_train)\n \n puts \"finish preparing the dataset!\"\n return app_train\nend",
"def dataset\n DB[SQL, from: from_truncated, to: to_truncated, tick: tick]\n end",
"def _indexes_ds\n @_indexes_ds ||= begin\n if server_version >= 90500\n order = [Sequel[:indc][:relname], Sequel.function(:array_position, Sequel[:ind][:indkey], Sequel[:att][:attnum])]\n # :nocov:\n else\n range = 0...32\n order = [Sequel[:indc][:relname], SQL::CaseExpression.new(range.map{|x| [SQL::Subscript.new(Sequel[:ind][:indkey], [x]), x]}, 32, Sequel[:att][:attnum])]\n # :nocov:\n end\n\n attnums = SQL::Function.new(:ANY, Sequel[:ind][:indkey])\n\n ds = metadata_dataset.\n from{pg_class.as(:tab)}.\n join(Sequel[:pg_index].as(:ind), :indrelid=>:oid).\n join(Sequel[:pg_class].as(:indc), :oid=>:indexrelid).\n join(Sequel[:pg_attribute].as(:att), :attrelid=>Sequel[:tab][:oid], :attnum=>attnums).\n left_join(Sequel[:pg_constraint].as(:con), :conname=>Sequel[:indc][:relname]).\n where{{\n indc[:relkind]=>%w'i I',\n ind[:indisprimary]=>false,\n :indexprs=>nil,\n :indisvalid=>true}}.\n order(*order).\n select{[indc[:relname].as(:name), ind[:indisunique].as(:unique), att[:attname].as(:column), con[:condeferrable].as(:deferrable)]}\n\n # :nocov:\n ds = ds.where(:indisready=>true) if server_version >= 80300\n ds = ds.where(:indislive=>true) if server_version >= 90300\n # :nocov:\n\n ds\n end\n end",
"def dataset\n @dataset ||= generate_dataset\n end",
"def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end",
"def ismn; end",
"def data_righttest_label_bad(db); end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end",
"def initialize(dataset)\n opts = dataset.opts\n eager_graph = opts[:eager_graph]\n @master = eager_graph[:master]\n requirements = eager_graph[:requirements]\n reflection_map = @reflection_map = eager_graph[:reflections]\n reciprocal_map = @reciprocal_map = eager_graph[:reciprocals]\n limit_map = @limit_map = eager_graph[:limits]\n @unique = eager_graph[:cartesian_product_number] > 1\n \n alias_map = @alias_map = {}\n type_map = @type_map = {}\n after_load_map = @after_load_map = {}\n reflection_map.each do |k, v|\n alias_map[k] = v[:name]\n after_load_map[k] = v[:after_load] unless v[:after_load].empty?\n type_map[k] = if v.returns_array?\n true\n elsif (limit_and_offset = limit_map[k]) && !limit_and_offset.last.nil?\n :offset\n end\n end\n\n # Make dependency map hash out of requirements array for each association.\n # This builds a tree of dependencies that will be used for recursion\n # to ensure that all parts of the object graph are loaded into the\n # appropriate subordinate association.\n @dependency_map = {}\n # Sort the associations by requirements length, so that\n # requirements are added to the dependency hash before their\n # dependencies.\n requirements.sort_by{|a| a[1].length}.each do |ta, deps|\n if deps.empty?\n dependency_map[ta] = {}\n else\n deps = deps.dup\n hash = dependency_map[deps.shift]\n deps.each do |dep|\n hash = hash[dep]\n end\n hash[ta] = {}\n end\n end\n \n # This mapping is used to make sure that duplicate entries in the\n # result set are mapped to a single record. For example, using a\n # single one_to_many association with 10 associated records,\n # the main object column values appear in the object graph 10 times.\n # We map by primary key, if available, or by the object's entire values,\n # if not. The mapping must be per table, so create sub maps for each table\n # alias.\n records_map = {@master=>{}}\n alias_map.keys.each{|ta| records_map[ta] = {}}\n @records_map = records_map\n\n datasets = opts[:graph][:table_aliases].to_a.reject{|ta,ds| ds.nil?}\n column_aliases = opts[:graph_aliases] || opts[:graph][:column_aliases] # SEQUEL5: Remove :graph_aliases support\n primary_keys = {}\n column_maps = {}\n models = {}\n row_procs = {}\n datasets.each do |ta, ds|\n models[ta] = ds.model\n primary_keys[ta] = []\n column_maps[ta] = {}\n row_procs[ta] = ds.row_proc\n end\n column_aliases.each do |col_alias, tc|\n ta, column = tc\n column_maps[ta][col_alias] = column\n end\n column_maps.each do |ta, h|\n pk = models[ta].primary_key\n if pk.is_a?(Array)\n primary_keys[ta] = []\n h.select{|ca, c| primary_keys[ta] << ca if pk.include?(c)}\n else\n h.select{|ca, c| primary_keys[ta] = ca if pk == c}\n end\n end\n @column_maps = column_maps\n @primary_keys = primary_keys\n @row_procs = row_procs\n\n # For performance, create two special maps for the master table,\n # so you can skip a hash lookup.\n @master_column_map = column_maps[master]\n @master_primary_keys = primary_keys[master]\n\n # Add a special hash mapping table alias symbols to 5 element arrays that just\n # contain the data in other data structures for that table alias. This is\n # used for performance, to get all values in one hash lookup instead of\n # separate hash lookups for each data structure.\n ta_map = {}\n alias_map.keys.each do |ta|\n ta_map[ta] = [records_map[ta], row_procs[ta], alias_map[ta], type_map[ta], reciprocal_map[ta]]\n end\n @ta_map = ta_map\n end",
"def run_subset?(type)\n ENV[type] == \"true\" || ENV['ALL'] == \"true\" ? true : false\n end",
"def dense?; return stype == :dense; end",
"def summarize_per_subset\n @having = ANY_ROWS\n end",
"def dataset\n database[table_name]\n end",
"def supplementaryCase records #generate the supplementary set for selected records \n num=@records.recordsArr[0].valuesArr.length\n \n recordset = Records.new\n tagset = []\n # add the @records and selected records (just the inputparameter 'records' into the recordset ) \n for i in 0...@records.recordsArr.length do #add the @records to recordset and set tagset=1\n recordset.recordsArr << @records.recordsArr[i]\n tagset << 1\n end\n for j in 0...records.recordsArr.length do #add the records to recordset and set tagset=0\n recordset.recordsArr << records.recordsArr[j]\n tagset << 0\n end\n\n sum = @parameters.paramsArr.length*(@parameters.paramsArr.length-1)/2\n print 'sum='\n puts sum\n\n\n\n for i in 0...recordset.recordsArr.length do\n isexist=0\n for h in 0...@parameters.paramsArr.length do\n for k in h+1 ...@parameters.paramsArr.length do\n for j in i+1 ...recordset.recordsArr.length do\n if recordset.recordsArr[i].valuesArr[h]== recordset.recordsArr[j].valuesArr[h] and recordset.recordsArr[i].valuesArr[k] == recordset.recordsArr[j].valuesArr[k]\n isexist+=1 \n end\n end\n end\n end\n if isexist >=sum\n tagset[i]=0\n end \n end\n result = Records.new\n for m in 0...tagset.length do\n if tagset[m]==1\n result.recordsArr << recordset.recordsArr[m]\n end\n end\n return result\n end",
"def _metadata_dataset\n super.with_convert_smallint_to_bool(false)\n end",
"def preview\n get_filtered_dataset false, 10\n end",
"def count\n dataset.count\n end",
"def dataset_statistical?\n marc_leader_06_m_match = record.leader.byteslice(6) == 'm'\n marc_008_26_match = record.fields('008').find do |field|\n field.value.byteslice(26) == 'a'\n end\n\n marc_006_match = record.fields('006').find do |field|\n (field.value.byteslice(0) == 'm' && field.value.byteslice(9) == 'a')\n end\n\n return true if (marc_leader_06_m_match && marc_008_26_match) ||\n marc_006_match\n end",
"def find_type(data)\n start = data if self.rank == 0\n start = data.flatten[0] if self.rank != 0 \n self.type_num = Tensorflow::TF_INT64\n if start.is_a? Integer\n type = Integer\n self.data_size = 8\n elsif start.is_a? Float\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n elsif start.is_a? String\n type = String\n self.type_num = Tensorflow::TF_STRING\n self.data_size = 8\n elsif start.is_a? Complex\n type = Complex\n self.type_num = Tensorflow::TF_COMPLEX128\n self.data_size = 16\n else \n raise \"Data type not supported.\"\n end\n return type if self.rank == 0 \n if type == Integer || type == Float\n float_flag = 0\n float_flag = 1 if type == Float\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (Float) or i.is_a? (Integer))\n float_flag = 1 if i.is_a? (Float)\n end\n if float_flag == 1\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n end\n else\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (type))\n end\n end\n type\n end",
"def n_plus_one_query_enable=(_arg0); end",
"def filtered_dataset\n dataset\n end",
"def intensifier; end",
"def apply_dataset_options(type, request, ds)\n ds = apply_filter(type, request, ds)\n if order = order_for(type, request)\n ds = ds.order(*order)\n end\n if eager = eager_for(type, request)\n ds = ds.eager(eager)\n end\n if eager_graph = eager_graph_for(type, request)\n ds = ds.eager_graph(eager_graph)\n end\n ds\n end",
"def train(dataset)\n raise 'Override me!'\n end",
"def on_external_subset(name, external_id, system_id)\n end",
"def dataset\n @@dataset\n end",
"def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end",
"def eager_graph_lazy_dataset?\n true\n end",
"def data(dc, target)\n []\n end",
"def sampling_data(fun, v1=vv1, v2=vv2, repeat1=30, plan=NULL)\n len = v1.length\n data1 = Array.new(len, 0)\n len.times {|factor1|\n data1[factor1] = make_data_set(fun, v1, v2, factor1, repeat1, plan)\n }\n\n print \"sampling_data data is \\n\"\n p data1\n\n data1\nend",
"def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end",
"def dataset_key\n :id\n end",
"def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end",
"def onColumn_dnase(num_ops)\n dnase = (num_ops) * 10#ul\n rdd = (num_ops) * 70#ul\n tot_vol = dnase + rdd\n arr = ['DNase', 'RDD']\n headers = arr.map{|x| \"#{x} (µl)\"}\n tab = [ headers, [dnase, rdd].map {|i| {content: \"#{i}\", check: true}} ]\n check_dnase = show do\n title \"Preparing DNase I\"\n separator\n check \"Gather <b>1</b> clean #{(tot_vol > 1501) ? ('15mL Falcon tube') : ('1.5 mL eppie tube')} and label: <b>DNase + RDD</b>\"\n check \"Gather Qiagen RDD Buffer in #{DNASE_LOC[arr[1].downcase]}, you will need: <b>#{rdd}ul</b>\"\n check \"Gather <b>#{num_ops}</b> DNase I 10ul Aliquot(s) in #{DNASE_LOC[arr[0].downcase]} and thaw on ice.\"\n select [ \"Yes\", \"No\"], var: \"dnase\", label: \"Are there enough DNase aliquots? If not, select 'No' and proceed to the next step.\"\n separator\n note 'In an eppendorf tube mix by pipetting:'\n table tab\n note \"<b>Once finished set on ice until needed & proceed to the next step.</b>\"\n end\n \n # if user selected no then a new DNase I must be openned and prepared \n # Also, gives instructions to make dnase for current experiment\n if check_dnase[:dnase] == \"No\"\n show do\n title \"Prepare DNase I\"\n separator\n \n check \"Prepare DNase I stock solution by injecting/dispensing <b>550µl</b> of RNase-free water in to the DNase I vial.\"\n note \"Mix gently by inverting.\"\n check \"Next, aliquot <b>#{num_ops * 10}µl</b> of DNase into a clean 1.5 mL eppie tube.\"\n check \"To the same tube, add <b>#{num_ops * 70}µl</b> of Buffer RDD.\"\n note \"Mix by inverting and centrifuge briefly to collect at the bottom.\"\n note \"<b>Place on ice until ready to use.</b>\"\n note \"Finally, aliquot the rest of the DNase into a new clean stripwell(s) - <b>10µl</b> in each well.\"\n check \"When finished, store DNase I aliquots at -20C\"\n end\n end\n end",
"def binmode()\n #This is a stub, used for indexing\n end",
"def data_type\n\tend",
"def readDataset\n entries = Array.new\n Dir.entries(DATASET_DIR).sort.each do |x|\n if x != \".\" and x != \"..\"\n entries << DatasetEntry.new(File.join(DATASET_DIR, x))\n end\n end\n entries\nend",
"def initialize(_layout, _data=[], _queries=[])\n @layout = _layout\n @queries = _queries\n #puts \"DATASET NEW queries:#{@queries}\"\n super(_data)\n end",
"def source_data_set\n get :data_set, PublicEarth::Db::DataSet.for_anonymous(@ip_address, get(:tracking_id, UUIDTools::UUID.random_create.to_s))\n end",
"def df_r\n @n_predictors\n end",
"def on_internal_subset(name, external_id, system_id)\n end",
"def dataset_length\n return 0 if self.length == 0\n return 1 unless @data[0].respond_to? \"length\"\n\n @data[0].length\n end",
"def sql_literal(*)\n @dataset.sql\n end",
"def create_empty_data_set\n BasicInterfaceRegister[@data_lib][@data_set_name] = true\n end",
"def convert_input_dataset(ds)\n case ds\n when Symbol, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, LiteralString\n self.simple_table = db.literal(ds).freeze\n ds = db.from(ds)\n when Dataset\n if ds.joined_dataset?\n # raise Error, \"Using a joined dataset as a model dataset is not support, use from_self on the dataset to wrap it in a subquery\" # SEQUEL5\n Sequel::Deprecation.deprecate(\"Using a joined dataset as a Sequel::Model dataset\", respond_to?(:cti_base_model) ? \"Use the class_table_inheritance plugin :alias option in #{cti_base_model.inspect}\" : \"Call from_self on the dataset to wrap it in a subquery\")\n end\n\n self.simple_table = if ds.send(:simple_select_all?)\n ds.literal(ds.first_source_table).freeze\n end\n @db = ds.db\n else\n raise(Error, \"Model.set_dataset takes one of the following classes as an argument: Symbol, LiteralString, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, Dataset\")\n end\n\n set_dataset_row_proc(ds.clone(:model=>self))\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end",
"def createTotalCustomerValueDataSet\n\t\t\n\tend",
"def read_ddi_metadata\n dataset = Dataset.find(dataset_id)\n ddi_parser = DDI::Parser.new\n all_variables = Variable.all(:conditions=> {:dataset_id => dataset_id})\n all_variable_ids = all_variables.collect{|var| var.id}\n parsed_variable_ids = []\n new_variables = []\n study = ddi_parser.parse filename\n #create variables for the dataset\n study.ddi_variables.each do |variable|\n #TODO find the variable from the dataset and if nil then add new var since this is from nesstar and we don't use the dataset to find the vars\n existing_variable = Variable.all(:conditions=>{:name=>variable.name, :dataset_id => dataset_id}).first\n #if the variable does not exist then go on to the next one, only load metadata for vars in the db\n if existing_variable != nil\n\t existing_variable.update_attributes(:value=>variable.label) if variable.label != nil\n if variable.group == nil\n variable_category = 'N/A'\n end\n parsed_variable_ids << existing_variable.id \n variable.categories.each do |category|\n valDom = ValueDomain.all(:conditions=>{:variable_id => existing_variable.id, :value => category.value, :label => category.label}).first \n if valDom == nil \n valDom = ValueDomain.new(:variable_id => existing_variable.id, :value => category.value, :label => category.label)\n valDom.save\n end \n category.category_statistics.each do |statistic|\n #the frequency statistics for the value domain\n #guessing that 'freq' is consistent, however......\n if statistic.type == 'freq'\n val_dom_stat = ValueDomainStatistic.all(:conditions=>{:frequency => statistic.value, :value_domain_id => valDom.id}).first\n if val_dom_stat == nil\n val_dom_stat = ValueDomainStatistic.new(:frequency => statistic.value, :value_domain_id => valDom.id)\n val_dom_stat.save\n else\n val_dom_stat.update_attributes(:frequency => statistic.value) if val_dom_stat.frequency != statistic.value\n end\n break\n end\n end\n end\n variable.summary_stats.each do |summary_stat|\n begin\n if summary_stat.type == 'mean'\n existing_variable.update_attributes(:mean => summary_stat.value) if var.mean != summary_stat.value\n elsif summary_stat.type == 'stdev'\n existing_variable.update_attributes(:standard_deviation => summary_stat.value) if existing_variable.standard_deviation != summary_stat.value\n elsif summary_stat.type == 'invd'\n existing_variable.update_attributes(:invalid_entries => summary_stat.value) if existing_variable.invalid_entries != summary_stat.value\n elsif summary_stat.type == 'vald'\n existing_variable.update_attributes(:valid_entries => summary_stat.value) if existing_variable.valid_entries != summary_stat.value\n end\n rescue\n logger.warn Time.now.to_s + 'One of the summary stats failed for variable ' + existing_variable.id.to_s\n end\n end\n question = variable.question != nil ? variable.question : \"\"\n interview = variable.interview_instruction != nil ? variable.interview_instruction : \"\"\n derivation = question + interview\n if variable.question != nil && variable.interview_instruction != nil\n existing_variable.update_attributes(:dermethod => derivation) if existing_variable.dermethod != derivation\n end\n end\n end\n end",
"def checkModes(data)\n mode = data['mode']\n call_features=Array.new(1) { Hash.new }\n if mode==\"labels\"\n call_features<<{\n type:\"LABEL_DETECTION\",\n maxResults:1\n }\n end\n return apiRequest(data['image'],call_features)\nend",
"def hoist_cte?(ds)\n ds.is_a?(Dataset) && ds.opts[:with] && !supports_cte_in_subqueries?\n end",
"def aggreate_dataset_use_from_self?\n super || @opts[:values]\n end",
"def dtypes_set_function dtype_i, dtype_j\n str = <<SETFN\nstatic void #{dtypes_function_name(:set, dtype_i, dtype_j)}(size_t n, char* p1, size_t i1, char* p2, size_t i2) {\n for (; n > 0; --n) {\n #{dtypes_assign(dtype_i, dtype_j)}\n p1 += i1; p2 += i2;\n }\n}\n\nSETFN\n end",
"def data_type\n\t\tend",
"def create_likely_qda_data\n ActiveRecord::Base.connection.execute likely_qda_sql\n end",
"def readDataSingleSource(nameout)\n\t\t\tif nameout.include?(\".source\") == false\n\t\t\t\tnameout = nameout + \".source\"\n\t\t\tend\n\t\t\tdatautils = DataUtils.new\n\t\t\t#puts \"nameout: \" + nameout;\n\t\t\t@l = -1;\n\t\t\t@b = -1;\n\t\t\t@r = -1;\n\t\t\t@ell_a = -1;\n\t\t\t@ell_b = -1;\n\t\t\t@ell_phi = -1;\n\t\t\t\n\t\t\t@sicalc = 0\n\t\t\t@sicalc_error = 0\n\n\t\t\t#read upper limit\n\t\t\tindex2 = 0;\n\t\t\t@r = -1;\n\t\t\t@galcoeff = \"-1\"\n\t\t\t@galcoeff_err = \"-1\"\n\t\t\t@galcoeffzero = \"-1\"\n\t\t\t@galcoeffzero_err = \"-1\"\t\n\t\t\t@isocoeff = \"-1\"\n\t\t\t@isocoeff_err = \"-1\"\n\t\t\t@isocoeffzero = \"-1\"\n\t\t\t@isocoeffzero_err = \"-1\"\t\n\t\t\t@fitdata = \"-1, -1, -1, -1, -1, -1, -1\"\n\t\t\tFile.open(nameout).each_line do | line |\n\t\t\t\tindex2 = index2 + 1;\n\t\t\t\tlll = line.split(\" \")\n\t\t\t\tif index2.to_i == 15\n\t\t\t\t\t@label =lll[0];\n\t\t\t\t\t@fix =lll[1];\n\t\t\t\t\t@si_start = lll[2];\n\t\t\t\t\t@ulconflevel = lll[3];\n\t\t\t\t\t@srcconflevel = lll[4];\n\t\t\t\t\t@startL = lll[5];\n\t\t\t\t\t@startB = lll[6];\n\t\t\t\t\t@startFlux = lll[7];\n\t\t\t\t\t@lmin = lll[9];\n\t\t\t\t\t@lmax = lll[11];\n\t\t\t\t\t@bmin = lll[14];\n\t\t\t\t\t@bmax = lll[16];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 16\n\t\t\t\t\t@sqrtTS =lll[0];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 17\n\t\t\t\t\t@l_peak = lll[0];\n\t\t\t\t\t@b_peak = lll[1];\n\t\t\t\t\t@dist = lll[2];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 18\n\t\t\t\t\t@l = lll[0]\n\t\t\t\t\t@b = lll[1]\n\t\t\t\t\t@distellipse = lll[2];\n\t\t\t\t\t@r = lll[3];\n\t\t\t\t\t@ell_a = lll[4];\n\t\t\t\t\t@ell_b = lll[5];\n\t\t\t\t\t@ell_phi = lll[6];\n\t\t\t\t\t@fullellipseline = format(\"%.2f %.2f %.2f %.2f %.2f %.2f %.2f\", @l, @b, @distellipse, @r, @ell_a, @ell_b, @ell_phi)\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 19\n\t\t\t\t\t@counts = lll[0]\n\t\t\t\t\t@counts_error = lll[1]\n\t\t\t\t\t@counts_error_p = lll[2]\n\t\t\t\t\t@counts_error_m = lll[3]\n\t\t\t\t\t@counts_ul = lll[4];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 20\n\t\t\t\t\t@flux = lll[0]\n\t\t\t\t\t@flux_error = lll[1]\n\t\t\t\t\t@flux_error_p = lll[2]\n\t\t\t\t\t@flux_error_m = lll[3]\n\t\t\t\t\t@flux_ul = lll[4];\n\t\t\t\t\t@exposure = lll[5]\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 21\n\t\t\t\t\t@sicalc = lll[0]\n\t\t\t\t\t@sicalc_error = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 22\n\t\t\t\t\t@fit_cts = lll[0]\n\t\t\t\t\t@fit_fcn0 = lll[1]\n\t\t\t\t\t@fit_fcn1 = lll[2]\n\t\t\t\t\t@fit_edm0 = lll[3]\n\t\t\t\t\t@fit_edm1 = lll[4]\n\t\t\t\t\t@fit_iter0 = lll[5]\n\t\t\t\t\t@fit_iter1 = lll[6]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 23\n\t\t\t\t\t@galcoeff = lll[0]\n\t\t\t\t\t@galcoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 24\n\t\t\t\t\t@galcoeffzero = lll[0]\n\t\t\t\t\t@galcoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 25\n\t\t\t\t\t@isocoeff = lll[0]\n\t\t\t\t\t@isocoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 26\n\t\t\t\t\t@isocoeffzero = lll[0]\n\t\t\t\t\t@isocoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 27\n\t\t\t\t\t@tstart = lll[0]\n\t\t\t\t\t@tstop = lll[1]\n\t\t\t\t\t\n\t\t\t\t\t@timestart_utc = @tstart\n\t\t\t\t\t@timestop_utc = @tstop\n\t\t\t\t\t@timestart_tt = datautils.time_utc_to_tt(@tstart);\n\t\t\t\t\t@timestop_tt = datautils.time_utc_to_tt(@tstop);\n\t\t\t\t\t@timestart_mjd = datautils.time_tt_to_mjd(@timestart_tt);\n\t\t\t\t\t@timestop_mjd = datautils.time_tt_to_mjd(@timestop_tt);\n\t\t\t\t\t\n\t\t\t\t\t#calcolo fase orbitale\n\t\t\t\t\t@orbitalphase = -1;\n\t\t\t\t\tif(@calcorbitalphase_period.to_f != 0)\n\t\t\t\t\t\ttimemjd = @timestart_mjd.to_f + (@timestop_mjd.to_f-@timestart_mjd.to_f)\n\t\t\t\t\t\t@orbitalphase = (timemjd.to_f - @calcorbitalphase_t0.to_f) / @calcorbitalphase_period.to_f;\n\t\t\t\t\t\t@orbitalphase = @orbitalphase.to_f - @orbitalphase.to_i;\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 28\n\t\t\t\t\t@energyrange = lll[0]\n\t\t\t\t\t@fovrange = lll[1]\n\t\t\t\t\t@albedo = lll[2]\n\t\t\t\t\t@binsize = lll[3] \n\t\t\t\t\t@expstep = lll[4] \n\t\t\t\t\t@phasecode = lll[5] \n\t\t\t\tend\n\t\t\tend\n\n\tend",
"def convert_input_dataset(ds)\n case ds\n when Symbol, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, LiteralString\n self.simple_table = db.literal(ds).freeze\n ds = db.from(ds)\n when Dataset\n ds = ds.from_self(:alias=>ds.first_source) if ds.joined_dataset?\n\n self.simple_table = if ds.send(:simple_select_all?)\n ds.literal(ds.first_source_table).freeze\n end\n @db = ds.db\n else\n raise(Error, \"Model.set_dataset takes one of the following classes as an argument: Symbol, LiteralString, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, Dataset\")\n end\n\n set_dataset_row_proc(ds.clone(:model=>self))\n end",
"def unlimited\n cached_dataset(:_unlimited_ds){clone(:limit=>nil, :offset=>nil)}\n end",
"def type\n\t\tCOND_NUM_ATTENDING\n\tend",
"def uses(*datasets)\n @used_datasets = datasets\n end",
"def _metadata_dataset\n super.\n with_identifier_input_method(identifier_input_method_default).\n with_identifier_output_method(identifier_output_method_default)\n end"
] | [
"0.5804363",
"0.56015635",
"0.5573443",
"0.55125856",
"0.5413015",
"0.5396254",
"0.5368623",
"0.52762866",
"0.52413285",
"0.52280605",
"0.5182511",
"0.51585704",
"0.51541036",
"0.51330984",
"0.5105037",
"0.51018524",
"0.5090016",
"0.5090016",
"0.50616026",
"0.5038587",
"0.5038587",
"0.5038587",
"0.5038587",
"0.499608",
"0.4995513",
"0.49716562",
"0.49662605",
"0.49662605",
"0.49662605",
"0.4964144",
"0.49613866",
"0.49613866",
"0.49613866",
"0.49311766",
"0.49226916",
"0.49134883",
"0.4910634",
"0.4884144",
"0.4873575",
"0.48680985",
"0.48541418",
"0.48404458",
"0.4838849",
"0.48379603",
"0.48342112",
"0.48153427",
"0.4800383",
"0.4798109",
"0.47809517",
"0.4776287",
"0.47762373",
"0.47749865",
"0.4766285",
"0.4756603",
"0.4752004",
"0.4749591",
"0.4744967",
"0.4734587",
"0.47286144",
"0.47271648",
"0.47228128",
"0.47116694",
"0.47116077",
"0.46992263",
"0.46908113",
"0.46902698",
"0.46837273",
"0.46733585",
"0.46716726",
"0.46713766",
"0.46701005",
"0.4668058",
"0.46561298",
"0.46504778",
"0.4638328",
"0.46355453",
"0.46322235",
"0.46310416",
"0.46309316",
"0.46294668",
"0.46282497",
"0.46097705",
"0.46094128",
"0.4604889",
"0.4603834",
"0.46021727",
"0.46019062",
"0.45977324",
"0.4594213",
"0.45909688",
"0.45902222",
"0.4581556",
"0.45753497",
"0.4573397",
"0.45683396",
"0.45668298",
"0.45651123",
"0.4564458",
"0.456328",
"0.45542052"
] | 0.49082994 | 37 |
TODO: Add more tests later (need functions to add dim & var) Datasetdata_mode | def test_enddef_closed
nc = Dataset.new('test/data/simple.nc')
nc.close()
assert_raise NetCDFError do
nc.data_mode()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n 'dataset'\n end",
"def dataset?\n true\n end",
"def dataset\n @dataset ||= data_maker.dataset\n end",
"def set_data_mode(data)\n puts \"Setting Data Mode to #{data}\" if $verbose\n d='DT'+(('000'+data.to_s)[-3..-1])+';'\n puts d if $verbose\n ret=send_cmd(d,'DT;',d,0.25,1.0,3)\n if(ret)\n return(ret.gsub(/^DT/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset?(name)\n self[name] ? true : false\n end",
"def test_on_open\n nc = Dataset.new('test/data/simple.nc')\n assert_equal(false, nc.define_mode?)\n nc.close()\n end",
"def dataset\n @dataset ||= generate_dataset\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def get_data_mode()\n return(get_cmd('DT;',0.1,0.5,3).gsub(/^DT/,'').gsub(/;$/,'').to_i)\nend",
"def dataset\n @@dataset\n end",
"def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def ndata; end",
"def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end",
"def dataset\n database[table_name]\n end",
"def dataset_length\n return 0 if self.length == 0\n return 1 unless @data[0].respond_to? \"length\"\n\n @data[0].length\n end",
"def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end",
"def find_type(data)\n start = data if self.rank == 0\n start = data.flatten[0] if self.rank != 0 \n self.type_num = Tensorflow::TF_INT64\n if start.is_a? Integer\n type = Integer\n self.data_size = 8\n elsif start.is_a? Float\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n elsif start.is_a? String\n type = String\n self.type_num = Tensorflow::TF_STRING\n self.data_size = 8\n elsif start.is_a? Complex\n type = Complex\n self.type_num = Tensorflow::TF_COMPLEX128\n self.data_size = 16\n else \n raise \"Data type not supported.\"\n end\n return type if self.rank == 0 \n if type == Integer || type == Float\n float_flag = 0\n float_flag = 1 if type == Float\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (Float) or i.is_a? (Integer))\n float_flag = 1 if i.is_a? (Float)\n end\n if float_flag == 1\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n end\n else\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (type))\n end\n end\n type\n end",
"def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end",
"def dataset\n graph && graph.dataset\n end",
"def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end",
"def data_type\n\tend",
"def schema_ds_dataset\n schema_utility_dataset\n end",
"def data_type\n\t\tend",
"def dataset\n @dataset_class.new(self)\n end",
"def dataset_path\n @dataset_path ||= filename\n end",
"def get_dataset(wi)\n if wi.options && wi.options['dataType']\n wi.options['dataType']\n else\n EternosBackup::SiteData.defaultDataSet\n end\n end",
"def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end",
"def schema_utility_dataset\n @default_dataset\n end",
"def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end",
"def orig_dataset\n @opts[:orig_dataset]\n end",
"def represent_dataset(dataset, mode, opts: nil, context: nil)\n dataset = modify_with(dataset, mode) if @modes[mode][:modifier]\n repr_proc = representer_proc(dataset.model, mode)\n rds = RepresentableDataset.new(dataset)\n\n # Paginate the dataset if pagination was passed.\n paginate(rds, opts) if opts\n\n # Map the dataset items into represented objects.\n rds.map! do |item|\n represented_object = RepresentedObject.new\n repr_proc.call(item, represented_object, context)\n end\n\n rds\n end",
"def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end",
"def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end",
"def _metadata_dataset\n super.with_convert_smallint_to_bool(false)\n end",
"def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end",
"def data_type\n @options[:data_type].presence\n end",
"def dataset_key\n :id\n end",
"def prepare_dataset\n @working_dataset.dataset.each { |tuple| @clustered_dataset[tuple] = -1 }\n end",
"def dataset_datum_params\n params.require(:dataset_datum).permit(:dataset_field_id_id, :dataset_row_id_id, :dataset_field_data)\n end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def dataset(name)\n self[name] || connection.create_dataset(name)\n end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end",
"def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end",
"def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end",
"def data_complextest(db); end",
"def variables\n Variable.where(dataset_id: self.datasets.map(&:id))\n end",
"def prepare_data(num_rows)\n app_train = read_dataset_from_csv('./input/application_train', num_rows)\n data = app_train[\"data\"]\n set_categorical_labels(data)\n numeric_features, _categorical_features = get_numeric_cateforical_features_from_the_raw_dataset(app_train[\"data\"])\n categorical_features_one_hot_encode = get_one_hot_feature_map_from_the_origin_dataset(data)\n one_hot_encoding_using_feature_map(data, categorical_features_one_hot_encode)\n\n # NaN values for DAYS_EMPLOYED: 365243 -> nan\n data.each do |r|\n r_features = r[\"features\"]\n if r_features[\"days_empoyed\"] == 365243\n r_features[\"days_employed\"] = \"\"\n r_features[\"days_employed_anom\"] = 1\n else\n r_features[\"days_employed_anom\"] = 0 \n end \n \n add_ratio_feature(\"payment_rate\", \"amt_annuity\", \"amt_credit\", r)\n add_ratio_feature(\"annuity_income_ratio\", \"amt_annuity\", \"amt_income_total\", r)\n add_ratio_feature(\"credit_goods_ratio\", \"amt_credit\", \"amt_goods_price\", r)\n # add_ratio_feature(\"income_person_ratio\", \"amt_income_total\", \"cnt_fam_members\", r)\n add_ratio_feature(\"employed_birth_ratio\", \"days_employed\", \"days_birth\", r)\n end\n # categorical_features << \"days_employed_anom\"\n\n bureau = read_dataset_from_csv('./input/bureau', 1000, $bureau_numeric_features)\n # bureau[\"data\"].each do |r|\n # puts r[\"features\"][\"days_enddate_fact\"]\n # end\n # return\n grouped = group_data(bureau[\"data\"])\n agged = agg_group_data(grouped, $bureau_numeric_features, \"bureau\")\n merge_to_dataset(app_train, agged, $bureau_numeric_features)\n\n app_train[\"features\"] = app_train[\"data\"][0][\"features\"].keys\n\n puts \"begin to normalize the dataset......\"\n nomalizer = Normalizer.new\n nomalizer.normalize(app_train, numeric_features)\n\n puts \"begin to impute missing value......\"\n imputer = SimpleImputer.new\n imputer.fit(app_train)\n \n puts \"finish preparing the dataset!\"\n return app_train\nend",
"def dataset_params\n filtered = params.require(:dataset).permit(:name, :description, :url, :year, :number_subjects, :pipeline,\n :quotation, :data, :attachment, :study_id, data_type_ids: [])\n filtered[:data_type_ids].reject!(&:blank?)\n filtered\n end",
"def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end",
"def count\n dataset.count\n end",
"def dataset_params\n params.require(:dataset).permit(:name, :index_name, :document_type, :data)\n end",
"def each_dataset(&blk)\n if block_given?\n metadata[:datasets].each { |name| blk.call(dataset(name)) }\n else\n to_enum(:each_dataset)\n end\n end",
"def association_dataset_proc\n ASSOCIATION_DATASET_PROC\n end",
"def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end",
"def load_dataset_structure(pid,dataset)\r\n @pid = pid\r\n GoodData.use @pid\r\n choosen_dataset = find_dataset(dataset)\r\n @dataset = GoodData::MdObject.new((GoodData.get choosen_dataset.uri)['dataSet'])\r\n\r\n #Load all atrribute info\r\n @dataset.content['attributes'].map do |e|\r\n att_id = e.match(\"[0-9]*$\").to_s\r\n @att[att_id] = Attribute.new((GoodData.get e)['attribute'])\r\n end\r\n\r\n #Load all fact info\r\n @dataset.content['facts'].map do |e|\r\n fact_id = e.match(\"[0-9]*$\").to_s\r\n @fact[fact_id] = Fact.new((GoodData.get e)['fact'])\r\n end\r\n end",
"def dataset_helper_method\n :\"_#{self[:name]}_dataset_helper\"\n end",
"def get_dataset(quandl_dataset_code)\n Quandl::Dataset.get(quandl_dataset_code)\n end",
"def dataset\n DB[SQL, from: from_truncated, to: to_truncated, tick: tick]\n end",
"def data?\n self.runner.parameters[:data] || false\n end",
"def set_data_set_type\n @data_set_type = DataSetType.find(params[:id])\n end",
"def filtered_dataset\n dataset\n end",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def selection_data\n dataset ||= DB[:selections]\n end",
"def DataType=(arg0)",
"def apply_dataset_options(type, request, ds)\n ds = apply_filter(type, request, ds)\n if order = order_for(type, request)\n ds = ds.order(*order)\n end\n if eager = eager_for(type, request)\n ds = ds.eager(eager)\n end\n if eager_graph = eager_graph_for(type, request)\n ds = ds.eager_graph(eager_graph)\n end\n ds\n end",
"def validate_data(function_name,data)\n data_summary = {}\n\n data.each do |v|\n v.each do |key,val|\n if (data_summary[key].nil?)\n data_summary[key] = 1\n else\n data_summary[key] = data_summary[key]+1\n end\n end\n end\n if ( data_summary.max == 0 ) #TODO Check method\n puts \"No data set.\"\n data_summary.each do |k,v|\n if v < data_summary.max\n puts \"#{function_name} Missing Data in serie #{key}\"\n end\n end\n #return data-summary\n end\n #Wrapper to the drawScale() function allowing a second scale to be drawn */\n def draw_right_scale(data,data_description,scale_mode,r,g,b,draw_ticks=true,angle=0,decimals=1,with_margin=false,skip_labels=1)\n\n self.draw_scale(data,data_description,scale_mode,r,g,b,draw_ticks,angle,decimals,with_margin,skip_labels,true)\n end\n end",
"def preview\n get_filtered_dataset false, 10\n end",
"def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end",
"def dataset(branch = nil, options = {})\n return super() if @in_dataset or (!Branch::Context.current! and !branch)\n @in_dataset = true\n context = Branch::Context.get(branch)\n ds = dataset_from_context(context, options)\n @in_dataset = nil\n ds\n end",
"def dataset_params\n params.require(:dataset).permit(:title, :description, :blob, :user_file_path, :file_size, :dimensions, :size)\n end",
"def dataset\n ds = Sequel::Dataset.new(self)\n end",
"def dataset\n ds = Sequel::Dataset.new(self)\n end",
"def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"def train(dataset)\n raise 'Override me!'\n end",
"def mode() end",
"def datasets\n @datasets || []\n end",
"def datasets\n @datasets || []\n end",
"def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end",
"def data_type\n return @data_type\n end",
"def dataset\n @dataset ||= begin\n create_table!\n database[:data_stores]\n end\n end",
"def dataset_class_default\n if self.class == Sequel::Database\n Sequel::Dataset\n else\n Sequel::Deprecation.deprecate(\"Using self.class.const_get(:DatasetClass) to get the default dataset class\", \"Modify the database adapter to implement Database#dataset_class_default\")\n self.class.const_get(:DatasetClass)\n end\n end",
"def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\"}] \n\n puts\n puts \"Scenario: Successfully creating and reading a public dataset\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"I make the dataset public\"\n dataset = @api.update_dataset(dataset, {'private'=> false})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"When I get the dataset status using the dataset's public url\";\n dataset = @api.get_dataset(\"public/#{dataset['resource']}\")\n\n puts \"Then the dataset's status is FINISHED\";\n assert_equal(BigML::FINISHED, dataset[\"object\"][\"status\"][\"code\"])\n\n puts \"And I make the dataset private again\"\n dataset = @api.update_dataset(dataset, {'private'=> true})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n\n end\n\n end",
"def dataset_params\n params.require(:dataset).permit(:name, :description, :contents)\n end"
] | [
"0.65119725",
"0.6405592",
"0.61668164",
"0.60886604",
"0.60258186",
"0.6011424",
"0.6011424",
"0.5997819",
"0.5964836",
"0.5941636",
"0.5868466",
"0.5861052",
"0.5764775",
"0.5764775",
"0.5764775",
"0.57502174",
"0.5717676",
"0.55442756",
"0.55337465",
"0.55337465",
"0.55337465",
"0.55337465",
"0.55286485",
"0.55182266",
"0.55059624",
"0.5485695",
"0.5481899",
"0.5461185",
"0.54556113",
"0.54297954",
"0.5424707",
"0.53843755",
"0.5380667",
"0.5359384",
"0.53499585",
"0.5348919",
"0.53257805",
"0.53218484",
"0.531165",
"0.5305116",
"0.53018653",
"0.5291478",
"0.525823",
"0.5255666",
"0.524939",
"0.52431834",
"0.52396417",
"0.52241224",
"0.52196807",
"0.52121896",
"0.5209579",
"0.5209579",
"0.5209579",
"0.5209579",
"0.52089655",
"0.51940167",
"0.51886845",
"0.51886845",
"0.51801735",
"0.51686424",
"0.51664144",
"0.5164565",
"0.5159889",
"0.5154001",
"0.5145585",
"0.51407427",
"0.513999",
"0.51385057",
"0.5134038",
"0.51323444",
"0.5126305",
"0.5120576",
"0.5110526",
"0.5109304",
"0.510852",
"0.51048374",
"0.51048374",
"0.51048374",
"0.50963736",
"0.5091815",
"0.507348",
"0.50728",
"0.507198",
"0.50527066",
"0.5050087",
"0.5035522",
"0.50347054",
"0.50347054",
"0.5031712",
"0.5031712",
"0.5028583",
"0.5019927",
"0.50188327",
"0.50188327",
"0.50153136",
"0.5013296",
"0.50074327",
"0.5005368",
"0.5002629",
"0.49871334"
] | 0.5294939 | 41 |
TODO: Add more tests later (need functions to add dim & var) Datasetclose | def test_close_twice
nc = Dataset.new('test/data/simple.nc')
nc.close()
assert_raise NetCDFError do
nc.close()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_enddef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.data_mode()\n end\n end",
"def dataset\n @dataset ||= data_maker.dataset\n end",
"def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end",
"def test_redef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.define_mode()\n end\n end",
"def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end",
"def dataset\n @dataset ||= generate_dataset\n end",
"def _delete_dataset\n this\n end",
"def _delete_dataset\n this\n end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end",
"def clear\n @dataset.clear\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def dataset\n ds = Sequel::Dataset.new(self)\n end",
"def dataset\n ds = Sequel::Dataset.new(self)\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end",
"def dataset\n @@dataset\n end",
"def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end",
"def prepare_dataset\n @working_dataset.dataset.each { |tuple| @clustered_dataset[tuple] = -1 }\n end",
"def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end",
"def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end",
"def test_on_open\n nc = Dataset.new('test/data/simple.nc')\n assert_equal(false, nc.define_mode?)\n nc.close()\n end",
"def method_missing(method, *args, &block)\n @dataset = @dataset.send(method, *args, &block)\n raise(Sequel::Error, \"method #{method.inspect} did not return a dataset\") unless @dataset.is_a?(Dataset)\n self\n end",
"def delete\n dataset.delete\n end",
"def create_dataset(filename, x_size, y_size, bands: 1, type: :GDT_Byte, **options)\n log \"creating dataset with size #{x_size},#{y_size}\"\n\n dataset_pointer = GDALCreate(@gdal_driver_handle,\n filename,\n x_size,\n y_size,\n bands,\n type,\n nil\n )\n\n raise CreateFail if dataset_pointer.null?\n\n dataset = Dataset.new(dataset_pointer)\n yield(dataset) if block_given?\n dataset.close\n\n dataset\n end",
"def fresh_dataset\n @dataset.clone\n end",
"def dataset\n DB[SQL, from: from_truncated, to: to_truncated, tick: tick]\n end",
"def dataset\n @dataset_class.new(self)\n end",
"def type\n 'dataset'\n end",
"def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end",
"def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end",
"def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end",
"def dataset_length\n return 0 if self.length == 0\n return 1 unless @data[0].respond_to? \"length\"\n\n @data[0].length\n end",
"def each_dataset(&blk)\n if block_given?\n metadata[:datasets].each { |name| blk.call(dataset(name)) }\n else\n to_enum(:each_dataset)\n end\n end",
"def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\"}] \n\n puts\n puts \"Scenario: Successfully creating and reading a public dataset\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"I make the dataset public\"\n dataset = @api.update_dataset(dataset, {'private'=> false})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"When I get the dataset status using the dataset's public url\";\n dataset = @api.get_dataset(\"public/#{dataset['resource']}\")\n\n puts \"Then the dataset's status is FINISHED\";\n assert_equal(BigML::FINISHED, dataset[\"object\"][\"status\"][\"code\"])\n\n puts \"And I make the dataset private again\"\n dataset = @api.update_dataset(dataset, {'private'=> true})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n\n end\n\n end",
"def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end",
"def read_ddi_metadata\n dataset = Dataset.find(dataset_id)\n ddi_parser = DDI::Parser.new\n all_variables = Variable.all(:conditions=> {:dataset_id => dataset_id})\n all_variable_ids = all_variables.collect{|var| var.id}\n parsed_variable_ids = []\n new_variables = []\n study = ddi_parser.parse filename\n #create variables for the dataset\n study.ddi_variables.each do |variable|\n #TODO find the variable from the dataset and if nil then add new var since this is from nesstar and we don't use the dataset to find the vars\n existing_variable = Variable.all(:conditions=>{:name=>variable.name, :dataset_id => dataset_id}).first\n #if the variable does not exist then go on to the next one, only load metadata for vars in the db\n if existing_variable != nil\n\t existing_variable.update_attributes(:value=>variable.label) if variable.label != nil\n if variable.group == nil\n variable_category = 'N/A'\n end\n parsed_variable_ids << existing_variable.id \n variable.categories.each do |category|\n valDom = ValueDomain.all(:conditions=>{:variable_id => existing_variable.id, :value => category.value, :label => category.label}).first \n if valDom == nil \n valDom = ValueDomain.new(:variable_id => existing_variable.id, :value => category.value, :label => category.label)\n valDom.save\n end \n category.category_statistics.each do |statistic|\n #the frequency statistics for the value domain\n #guessing that 'freq' is consistent, however......\n if statistic.type == 'freq'\n val_dom_stat = ValueDomainStatistic.all(:conditions=>{:frequency => statistic.value, :value_domain_id => valDom.id}).first\n if val_dom_stat == nil\n val_dom_stat = ValueDomainStatistic.new(:frequency => statistic.value, :value_domain_id => valDom.id)\n val_dom_stat.save\n else\n val_dom_stat.update_attributes(:frequency => statistic.value) if val_dom_stat.frequency != statistic.value\n end\n break\n end\n end\n end\n variable.summary_stats.each do |summary_stat|\n begin\n if summary_stat.type == 'mean'\n existing_variable.update_attributes(:mean => summary_stat.value) if var.mean != summary_stat.value\n elsif summary_stat.type == 'stdev'\n existing_variable.update_attributes(:standard_deviation => summary_stat.value) if existing_variable.standard_deviation != summary_stat.value\n elsif summary_stat.type == 'invd'\n existing_variable.update_attributes(:invalid_entries => summary_stat.value) if existing_variable.invalid_entries != summary_stat.value\n elsif summary_stat.type == 'vald'\n existing_variable.update_attributes(:valid_entries => summary_stat.value) if existing_variable.valid_entries != summary_stat.value\n end\n rescue\n logger.warn Time.now.to_s + 'One of the summary stats failed for variable ' + existing_variable.id.to_s\n end\n end\n question = variable.question != nil ? variable.question : \"\"\n interview = variable.interview_instruction != nil ? variable.interview_instruction : \"\"\n derivation = question + interview\n if variable.question != nil && variable.interview_instruction != nil\n existing_variable.update_attributes(:dermethod => derivation) if existing_variable.dermethod != derivation\n end\n end\n end\n end",
"def each_dataset(builder, &block)\n block.call(builder.ct.dataset)\n\n @datasets ||= metadata['datasets'].map do |name|\n OsCtl::Lib::Zfs::Dataset.new(\n File.join(builder.ct.dataset.name, name),\n base: builder.ct.dataset.name\n )\n end\n\n @datasets.each(&block)\n end",
"def initialize(dataset)\n @dataset = dataset\n end",
"def each_dataset(&block)\n datasets.each(&block)\n end",
"def set_data_set\n @data_set = DataSet.find(params[:id])\n end",
"def orig_dataset\n @opts[:orig_dataset]\n end",
"def data_complextest(db); end",
"def _update_dataset\n this\n end",
"def _update_dataset\n this\n end",
"def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end",
"def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end",
"def close\n close_data_file\n end",
"def set_data_set\n @data_set = DataSet.find(params[:id])\n end",
"def set_data_set\n @data_set = DataSet.find(params[:id])\n end",
"def count\n dataset.count\n end",
"def readDataset\n entries = Array.new\n Dir.entries(DATASET_DIR).sort.each do |x|\n if x != \".\" and x != \"..\"\n entries << DatasetEntry.new(File.join(DATASET_DIR, x))\n end\n end\n entries\nend",
"def ndata; end",
"def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end",
"def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end",
"def dataset_path\n @dataset_path ||= filename\n end",
"def call\n # Add batches until we run out (FIXME: a more ruby way to do this?)\n while add_batch do\n end\n\n # Clear the disabled attribute\n @dataset.disabled = false\n @dataset.save\n rescue StandardError\n # FIXME: This should probably be a finally block?\n # Don't leave an empty dataset around under any circumstances\n @dataset.destroy\n raise\n end",
"def datasets\n @datasets || []\n end",
"def datasets\n @datasets || []\n end",
"def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end",
"def dataset\n database[table_name]\n end",
"def export_dataset(domo_client, dataset_id)\n # Sometimes there's lag on the Domo API so we'll retry a couple of times instead of failing tests for no reason.\n attempts = 0\n data = nil\n data_stream = nil\n loop do\n begin\n # @type [IO]\n data_stream = domo_client.dataSetClient.exportData(dataset_id, true).to_io\n data = data_stream.read\n data_stream.close\n\n return CSV.parse(data, {:headers => true}).map(&:to_h)\n rescue Java::ComDomoSdkRequest::RequestException => e\n raw_code = Domo::Client.request_error_status_code(e)\n status_code = e.getStatusCode\n if status_code < 400 or status_code == 404 or status_code == 406 or status_code >= 500\n if attempts > 3\n puts \"Ran out of retries on API errors for DatasetID #{dataset_id}. Status code is #{status_code}. Reason is #{raw_code}\"\n raise e\n end\n sleep(2.0*attempts)\n else\n raise e\n end\n ensure\n attempts += 1\n data_stream.close unless data_stream.nil? or data_stream.closed?\n end\n end\n\n data\n end",
"def load_dataset_structure(pid,dataset)\r\n @pid = pid\r\n GoodData.use @pid\r\n choosen_dataset = find_dataset(dataset)\r\n @dataset = GoodData::MdObject.new((GoodData.get choosen_dataset.uri)['dataSet'])\r\n\r\n #Load all atrribute info\r\n @dataset.content['attributes'].map do |e|\r\n att_id = e.match(\"[0-9]*$\").to_s\r\n @att[att_id] = Attribute.new((GoodData.get e)['attribute'])\r\n end\r\n\r\n #Load all fact info\r\n @dataset.content['facts'].map do |e|\r\n fact_id = e.match(\"[0-9]*$\").to_s\r\n @fact[fact_id] = Fact.new((GoodData.get e)['fact'])\r\n end\r\n end",
"def dataset\n graph && graph.dataset\n end",
"def dataset?\n true\n end",
"def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"def close\n @data.close\n @index.close\n end",
"def select(*args); dataset.select(*args); end",
"def deleteData\n\t\t@dataArray = @dataArray.drop(@dataArray.length)\n\tend",
"def dataset(name)\n self[name] || connection.create_dataset(name)\n end",
"def delete(*args)\n dataset.delete(*args)\n self\n end",
"def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end",
"def load_data(*args)\n init_data_arrays # wipes all preexisting data in @data_collections and @data_objects\n \n args[0].each.with_index do |array_or_variable, i|\n if i < data_collection_names.count\n @data_collections[i] += array_or_variable \n else\n j = i - data_collection_names.count\n @data_objects[j] = array_or_variable # if array_or_variable.class != Array\n end\n end\n self\n end",
"def dataset(opts=nil)\n Sequel::JDBC::AS400::Dataset.new(self, opts)\n end",
"def dataset(opts=nil)\n Sequel::JDBC::AS400::Dataset.new(self, opts)\n end",
"def get_dataset(quandl_dataset_code)\n Quandl::Dataset.get(quandl_dataset_code)\n end",
"def data_set(data, &block)\n Gnuplot::DataSet.new(data) do |ds|\n ds.with = config.linetype\n ds.linewidth = config.linewidth\n block.call(ds) if block_given?\n end\nend",
"def unlimited\n cached_dataset(:_unlimited_ds){clone(:limit=>nil, :offset=>nil)}\n end",
"def dataset(name)\n fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) }\n end",
"def delete_dataset(file_name)\n cpl_err = GDALDeleteDataset(@gdal_driver_handle, file_name)\n\n cpl_err.to_bool\n end",
"def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\",\n \"local_file\" => File.dirname(__FILE__)+\"/tmp/exported_iris.csv\"}] \n\n puts\n puts \"Scenario: Successfully exporting a dataset:\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I download the dataset file to #{item['local_file']} \"\n filename = @api.download_dataset(dataset, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the download dataset file is like #{item['filename']}\"\n assert_equal(FileUtils.compare_file(item[\"filename\"], item[\"local_file\"]), true)\n\n end\n\n end",
"def filtered_dataset\n dataset\n end",
"def delete\n BasicInterfaceRegister[@data_lib].delete(@data_set_name)\n end",
"def dataset(ds_id)\n data_service.dataset(service_name(ds_id))\n end",
"def dataset(branch = nil, options = {})\n return super() if @in_dataset or (!Branch::Context.current! and !branch)\n @in_dataset = true\n context = Branch::Context.get(branch)\n ds = dataset_from_context(context, options)\n @in_dataset = nil\n ds\n end",
"def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end",
"def assign_dataset_attributes\n if dataset\n reset_dataset_attributes\n @dataset_attributes = (dataset.data[dataset_group][dataset_key] ||= {})\n end\n rescue => e\n raise \"Qernel::Dataset: missing dataset item for #{dataset_group.inspect} #{dataset_key}. #{e.inspect}\"\n end",
"def write_data(data_p)\n if data_p.size > @size\n raise Moon::OverflowError, 'given dataset is larger than internal'\n elsif data_p.size < @size\n raise Moon::UnderflowError, 'given dataset is smaller than internal'\n end\n @data.replace(data_p)\n end",
"def create_empty_data_set\n open_for_write\n close\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def set_qdataset\n @qdataset = Qdataset.find(params[:id])\n end"
] | [
"0.64910495",
"0.6181731",
"0.61679673",
"0.59678406",
"0.59112984",
"0.58940333",
"0.58856744",
"0.58856744",
"0.58386785",
"0.58217895",
"0.5771086",
"0.5771086",
"0.5771086",
"0.5771086",
"0.5763396",
"0.5763396",
"0.57238877",
"0.57230777",
"0.56829464",
"0.5674945",
"0.5648823",
"0.5641364",
"0.5641364",
"0.5641364",
"0.5639563",
"0.5598889",
"0.5579672",
"0.55748314",
"0.5536888",
"0.5517078",
"0.54838645",
"0.5464548",
"0.54617584",
"0.5424927",
"0.54182965",
"0.5409553",
"0.54063153",
"0.54000294",
"0.539406",
"0.53777677",
"0.53625757",
"0.53151244",
"0.5308671",
"0.53069407",
"0.53067195",
"0.5299212",
"0.52963585",
"0.5293412",
"0.5288788",
"0.5286706",
"0.52628785",
"0.52628785",
"0.52496195",
"0.524852",
"0.52475166",
"0.5246661",
"0.5246661",
"0.52307576",
"0.5221951",
"0.5218678",
"0.52175415",
"0.5210144",
"0.5207679",
"0.520648",
"0.5200138",
"0.5200138",
"0.51872057",
"0.51504076",
"0.5149928",
"0.51358366",
"0.5124243",
"0.51157874",
"0.51140565",
"0.51140565",
"0.51116645",
"0.51045215",
"0.5100907",
"0.5100225",
"0.5098889",
"0.5093378",
"0.50846606",
"0.50733566",
"0.50733566",
"0.50718135",
"0.5051292",
"0.5049231",
"0.5044804",
"0.5037985",
"0.50251645",
"0.5022321",
"0.5017663",
"0.5013649",
"0.50117403",
"0.5001722",
"0.50000364",
"0.49918514",
"0.49895245",
"0.4972078",
"0.4972078",
"0.4957743"
] | 0.6141955 | 3 |
TODO: Add more tests later (need functions to add dim & var) Datasetdefine_mode? | def test_on_open
nc = Dataset.new('test/data/simple.nc')
assert_equal(false, nc.define_mode?)
nc.close()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n 'dataset'\n end",
"def dataset?\n true\n end",
"def dim; 1; end",
"def dataset\n @dataset ||= data_maker.dataset\n end",
"def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n self[name] ? true : false\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def dataset_method\n :\"#{self[:name]}_dataset\"\n end",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def mode=(_arg0); end",
"def dataset\n @dataset ||= generate_dataset\n end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def unlimited_dimension?\n @netcdf_elmt.hasUnlimitedDimension() \n end",
"def variables\n Variable.where(dataset_id: self.datasets.map(&:id))\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def dataset\n self\n end",
"def ndata; end",
"def set_data_mode(data)\n puts \"Setting Data Mode to #{data}\" if $verbose\n d='DT'+(('000'+data.to_s)[-3..-1])+';'\n puts d if $verbose\n ret=send_cmd(d,'DT;',d,0.25,1.0,3)\n if(ret)\n return(ret.gsub(/^DT/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def get_data_mode()\n return(get_cmd('DT;',0.1,0.5,3).gsub(/^DT/,'').gsub(/;$/,'').to_i)\nend",
"def mode() end",
"def size=(dimension); end",
"def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end",
"def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end",
"def dataset\n @@dataset\n end",
"def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end",
"def schema_ds_dataset\n schema_utility_dataset\n end",
"def schema_utility_dataset\n @default_dataset\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id])\n end",
"def set_vars(path, suffix)\r\n\t\t\t#binding.pry\r\n\t\t\tset = MovieDataSet.new(@path+suffix)\r\n\t\t\tset.load_data\r\n\t\t\treturn set\r\n\tend",
"def data_complextest(db); end",
"def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end",
"def dataset\n graph && graph.dataset\n end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end",
"def train(dataset)\n raise 'Override me!'\n end",
"def test_defined_modes\n modes = Malody::Mode.constants\n defined_modes = modes & Malody::Chart.constants\n defined_ids = defined_modes.map do |mode| Malody::Mode.const_get(mode) end\n refute_empty defined_modes, \"No modes defined yet.\"\n chart_processed = 0\n obtain_chart_files.each do |file|\n json = JSON.parse(File.read(file), symbolize_names: true)\n next unless defined_ids.include?(json.dig(:meta, :mode))\n chart_processed += 1\n chart = Malody::Chart.parse(json)\n if Malody::Chart::CommandColumnSupport === chart then\n assert_respond_to chart, :column, \"Column Supporting Mode should able to respond column.\"\n end\n case chart.mode\n when Malody::Mode::Key\n when Malody::Mode::Catch\n when Malody::Mode::Pad\n when Malody::Mode::Taiko\n when Malody::Mode::Ring\n when Malody::Mode::Slide\n end\n end\n refute_predicate chart_processed, :zero?, \"No unsupported charts available to process.\"\n end",
"def test_enddef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.data_mode()\n end\n end",
"def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end",
"def dataset_path\n @dataset_path ||= filename\n end",
"def setVariable(name, var)\n\n # Since this code was already written for three separate values,\n # I'm just splitting it back up for now.\n\n arg_names = var.old_args\n cells = Array.new\n var.cells.each do |cell|\n c = Array.new\n c << cell.onset\n c << cell.offset\n c << Array.new\n var.arglist.each do |arg|\n t = eval \"cell.#{arg}\"\n c[2] << t.to_s()\n end\n cells << c\n end\n print \"creating column\"\n # If the column already exists, delete it and build a new one.\n # If it doesn't, just add a new one.\n if not $db.col_name_in_use(name)\n col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n else\n oldcol = $db.get_column(name)\n numcells = oldcol.get_num_cells\n numcells.downto(1) do |i|\n $db.remove_cell($db.get_cell(oldcol.get_id, i).get_id)\n end\n #$db.remove_column(oldcol.get_id)\n\n #col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n #$db.add_column(col)\n end\n # Check if matrix already defined\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n\n mve0.delete_formal_arg(0)\n arg_names.each do |arg|\n farg = NominalFormalArg.new($db, arg)\n mve0.append_formal_arg(farg)\n end\n\n $db.replace_matrix_ve(mve0)\n end\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n matID0 = mve0.get_id()\n cells.each do |cell|\n #print \"writing cell\"\n c = DataCell.new($db, col.get_id, matID0)\n mat = Matrix.new($db, matID0)\n\n if cell[0].to_i > 0\n c.onset = TimeStamp.new(1000, cell[0].to_i)\n end\n if cell[1].to_i > 0\n c.offset = TimeStamp.new(1000, cell[1].to_i)\n end\n\n narg = 0\n cell[2].each do |dv|\n argid = mve0.get_formal_arg(narg).get_id()\n if dv == \"\" or dv == nil\n a = arg_names[narg]\n fdv = NominalDataValue.new($db, argid)\n fdv.clearValue()\n else\n fdv = NominalDataValue.new($db, argid, dv)\n end\n\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n c.set_val(mat)\n $db.append_cell(c)\n end\nend",
"def load_dataset_structure(pid,dataset)\r\n @pid = pid\r\n GoodData.use @pid\r\n choosen_dataset = find_dataset(dataset)\r\n @dataset = GoodData::MdObject.new((GoodData.get choosen_dataset.uri)['dataSet'])\r\n\r\n #Load all atrribute info\r\n @dataset.content['attributes'].map do |e|\r\n att_id = e.match(\"[0-9]*$\").to_s\r\n @att[att_id] = Attribute.new((GoodData.get e)['attribute'])\r\n end\r\n\r\n #Load all fact info\r\n @dataset.content['facts'].map do |e|\r\n fact_id = e.match(\"[0-9]*$\").to_s\r\n @fact[fact_id] = Fact.new((GoodData.get e)['fact'])\r\n end\r\n end",
"def association_dataset_proc\n ASSOCIATION_DATASET_PROC\n end",
"def dataset\n database[table_name]\n end",
"def find_type(data)\n start = data if self.rank == 0\n start = data.flatten[0] if self.rank != 0 \n self.type_num = Tensorflow::TF_INT64\n if start.is_a? Integer\n type = Integer\n self.data_size = 8\n elsif start.is_a? Float\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n elsif start.is_a? String\n type = String\n self.type_num = Tensorflow::TF_STRING\n self.data_size = 8\n elsif start.is_a? Complex\n type = Complex\n self.type_num = Tensorflow::TF_COMPLEX128\n self.data_size = 16\n else \n raise \"Data type not supported.\"\n end\n return type if self.rank == 0 \n if type == Integer || type == Float\n float_flag = 0\n float_flag = 1 if type == Float\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (Float) or i.is_a? (Integer))\n float_flag = 1 if i.is_a? (Float)\n end\n if float_flag == 1\n type = Float\n self.type_num = Tensorflow::TF_DOUBLE\n self.data_size = 8\n end\n else\n data.flatten.each do |i|\n raise \"Different data types in array.\" if !(i.is_a? (type))\n end\n end\n type\n end",
"def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end",
"def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end",
"def test_redef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.define_mode()\n end\n end",
"def represent_dataset(dataset, mode, opts: nil, context: nil)\n dataset = modify_with(dataset, mode) if @modes[mode][:modifier]\n repr_proc = representer_proc(dataset.model, mode)\n rds = RepresentableDataset.new(dataset)\n\n # Paginate the dataset if pagination was passed.\n paginate(rds, opts) if opts\n\n # Map the dataset items into represented objects.\n rds.map! do |item|\n represented_object = RepresentedObject.new\n repr_proc.call(item, represented_object, context)\n end\n\n rds\n end",
"def dataset_names\n metadata[:datasets]\n end",
"def orig_dataset\n @opts[:orig_dataset]\n end",
"def _metadata_dataset\n super.with_convert_smallint_to_bool(false)\n end",
"def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end",
"def dimensions(val); @dimensions = val; self; end",
"def each_dataset(&blk)\n if block_given?\n metadata[:datasets].each { |name| blk.call(dataset(name)) }\n else\n to_enum(:each_dataset)\n end\n end",
"def dataset_length\n return 0 if self.length == 0\n return 1 unless @data[0].respond_to? \"length\"\n\n @data[0].length\n end",
"def discover_variance\r\n end",
"def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end",
"def [](name)\n datasets[name.to_sym]\n end",
"def preview\n get_filtered_dataset false, 10\n end",
"def data_type\n\tend",
"def one_dimension?(x)\n shape1d?(x) || x.range1d? || x.int? || x.union1d?\nend",
"def dataset_helper_method\n :\"_#{self[:name]}_dataset_helper\"\n end",
"def prepare_dataset\n @working_dataset.dataset.each { |tuple| @clustered_dataset[tuple] = -1 }\n end",
"def dataset_key\n :id\n end",
"def canDim(type)\n DIMMED_TYPES.member?(type) || OPT_DIMMABLE.member?(type)\n end",
"def set_dimension(in_dim, out_dim)\n # On modifie les deux dimensions\n self.input_dimension = in_dim\n self.output_dimension = out_dim\n end",
"def dataset\n @dataset_class.new(self)\n end",
"def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end",
"def dense?; return stype == :dense; end",
"def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end",
"def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end",
"def dim\n @structure.dim\n end",
"def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end",
"def dtypes_set_function dtype_i, dtype_j\n str = <<SETFN\nstatic void #{dtypes_function_name(:set, dtype_i, dtype_j)}(size_t n, char* p1, size_t i1, char* p2, size_t i2) {\n for (; n > 0; --n) {\n #{dtypes_assign(dtype_i, dtype_j)}\n p1 += i1; p2 += i2;\n }\n}\n\nSETFN\n end",
"def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end",
"def sql_literal(*)\n @dataset.sql\n end",
"def def_model_dataset_method(meth)\n return if respond_to?(meth, true)\n\n if meth.to_s =~ /\\A[A-Za-z_][A-Za-z0-9_]*\\z/\n instance_eval(\"def #{meth}(*args, &block); dataset.#{meth}(*args, &block) end\", __FILE__, __LINE__)\n else\n (class << self; self; end).send(:define_method, meth){|*args, &block| dataset.send(meth, *args, &block)}\n end\n end",
"def input_dimension=(in_dim)\n # On transforme la nouvelle dimension en un entier positif\n in_dim = [0, in_dim.to_i].max\n \n # On modifie la dimension de chaque exemple\n @exaples.each { |example| example.input_dimension = in_dim } if in_dim != self.input_dimension\n\n # On modifie le tableau des fonctions de dénormalisation\n # Dans le cas où la nouvelle dimension est plus petite\n if in_dim < self.input_dimension then\n # On supprime les dimensions à enlever\n for i in in_dim..(self.input_dim - 1) do\n @denormalize_functions.delete_at((self.input_dim - 1) - i + in_dim)\n end\n\n # Dans le cas où la nouvelle dimension est plus grande\n elsif in_dim > self.input_dimension then\n # On ajoute le bon nombre de dimensions\n for i in (self.input_dim)..(in_dim - 1) do\n @denormalize_functions.insert(i, IDENTITY)\n end\n end\n\n # On modifie la dimension sauvegardée\n @input_dimension = in_dim\n end",
"def dataset(name)\n self[name] || connection.create_dataset(name)\n end",
"def add_dim *args, opt: false, shapes: nil, typ: nil, use_var: false\n if use_var\n offsets = [0] + accumulate(shapes)\n return \"#{opt ? '?' : ''}var(offsets=#{offsets}) * #{typ}\"\n else\n n = shapes.uniq.size\n shape = (n == 0 ? 0 : shapes[0])\n return \"#{shape} * #{typ}\"\n end\n end",
"def data_type\n\t\tend",
"def subset_content\n self.class.subsets[subset.to_sym] if valid_subset? \n end",
"def run_subset?(type)\n ENV[type] == \"true\" || ENV['ALL'] == \"true\" ? true : false\n end",
"def mode\n raise \"Not implemented\"\n end",
"def count\n dataset.count\n end",
"def DataType=(arg0)",
"def uses(*datasets)\n @used_datasets = datasets\n end",
"def get_preview\n get_filtered_dataset false, 10\n end",
"def get_dataset(wi)\n if wi.options && wi.options['dataType']\n wi.options['dataType']\n else\n EternosBackup::SiteData.defaultDataSet\n end\n end",
"def dim\n composition_string\n end",
"def dim\n composition_string\n end"
] | [
"0.6245153",
"0.5984558",
"0.5787449",
"0.5780542",
"0.56572837",
"0.56534874",
"0.56534874",
"0.5643628",
"0.5568998",
"0.55264807",
"0.5388349",
"0.5388349",
"0.5388349",
"0.5386754",
"0.53662676",
"0.53662676",
"0.53662676",
"0.53662676",
"0.5358804",
"0.5274702",
"0.52327675",
"0.52327675",
"0.52327675",
"0.52268213",
"0.52107",
"0.52010393",
"0.51802844",
"0.51759344",
"0.51492393",
"0.51429826",
"0.51245093",
"0.5124459",
"0.5097028",
"0.50931656",
"0.5087959",
"0.5087959",
"0.5087959",
"0.5087959",
"0.5085027",
"0.5070324",
"0.50492334",
"0.5048656",
"0.50459015",
"0.50442755",
"0.50359964",
"0.49896452",
"0.4986413",
"0.49830765",
"0.4981932",
"0.49706247",
"0.49695274",
"0.49661",
"0.49512127",
"0.49347484",
"0.49347484",
"0.49299365",
"0.49292627",
"0.4928029",
"0.49216348",
"0.49168518",
"0.49084806",
"0.48946437",
"0.48932558",
"0.48931867",
"0.4889639",
"0.4873707",
"0.48705676",
"0.48684865",
"0.48655218",
"0.48618865",
"0.48416287",
"0.48405936",
"0.4813716",
"0.4813146",
"0.47959515",
"0.47921774",
"0.47868043",
"0.47842178",
"0.47736186",
"0.4761026",
"0.47589293",
"0.47526756",
"0.4752384",
"0.47485638",
"0.47473106",
"0.47356516",
"0.47348702",
"0.4728281",
"0.4726698",
"0.47239733",
"0.47222346",
"0.47221464",
"0.4720068",
"0.47170103",
"0.47151345",
"0.4704758",
"0.4703471",
"0.47006294",
"0.46952927",
"0.46952927"
] | 0.57034177 | 4 |
GET /tweets GET /tweets.json | def userfilter
@tweets = Tweet.where("user_vote < 0 or user_vote > 0").includes(:company).page params[:page]
@count = Tweet.where("user_vote < 0 or user_vote > 0").count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def list\r\n #page = params[:page].nil? ? 0 : params[:page]\r\n tweets = Tweet.all\r\n render json: tweets\r\n end",
"def index\n @tweets = Tweet.all\n\n render json: @tweets\n end",
"def list_tweets\n tweets\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end",
"def index\n chain = Tweet\n chain = chain.since_id(params[:since_id]) if params[:since_id]\n @tweets = chain.all(:order => 'msg_twid ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end",
"def index\n if params[:page] && current_user\n render json: current_user, scope: {page: params[:page]}, serializer: UserWithTweetsSerializer, meta: {total_pages: current_user.timeline_tweets.count/25}\n elsif current_user\n render json: current_user, serializer: UserWithTweetsSerializer\n elsif params[:page]\n @tweets = Tweet.all.page(params[:page])\n render json: @tweets\n else\n @tweets = Tweet.all\n render json: @tweets\n end\n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end",
"def getThreeTweets\n\t\trender json: TwitterAPI.get_top_3_tweets(params[:twitter_id])\n\tend",
"def index\n\t\t@tweets = current_user.tweets\n\tend",
"def tweets\n @tweets = @user.tweets.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5) # order OWN tweets according to when they were created, with the most recent tweet at the top.\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n #Array of all tweets. Used for index html page\n @tweets = Tweet.all\n end",
"def index\n\t\tuser = User.find_by(id: params[:user_id])\n\t\tif user.present?\n\t\t\tfollower_ids = user.followers.pluck(:id)\n\t\t\ttweets = Tweet.where(\"user_id IN (?)\", follower_ids).order(\"updated_at DESC\")\n\t\t\trender json: {:status=>\"success\", :code=>200, :message=>\"List of tweets from the users you follow.\", data: tweets}\n\t\telse\n\t\t\trender json: {:status=>\"failure\", :message=>\"User is not present.\", data: tweets}\n\t\tend\n\tend",
"def index\n @tweets = Tweetaro.all\n end",
"def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end",
"def index\n @tweets = Tweet.all\n end",
"def print_tweet(tweets)\ngets tweets.each do |tweet| puts tweet[\"text\"]\nend\nend",
"def show_tweets\n @user = get_user_or_current_user(params[:id])\n @tweets = Tweet.where(:user_id => @user.id).order(created_at: :desc)\n end",
"def tweet(postids)\n handle_response(get(\"/content/tweet.json\", :query => {:postids => postids}))\n end",
"def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { @tweets_url = query ? \"/tweets.json?q=#{query}\" : '/tweets.json' }\n format.json do\n tweets, has_more =\n if query\n search_result =\n Tweet.search(\n query,\n page: params[:page] || 1,\n per_page: 20,\n includes: [\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n ],\n )\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets =\n pagy Tweet\n .includes(\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n )\n .order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: { has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n end\n end\n end",
"def user_tweet\n get_tweets params[:Enter_what_you_want_to_search]\n respond_to do |format|\n format.html \n format.json \n end\n \nend",
"def show\r\n tweet = Tweet.find(params[:id])\r\n render json: tweet\r\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def show\n render json: @tweet\n end",
"def print_twitter_search(tweets)\n #puts JSON.pretty_generate(tweet)\n tweets.each do |tweet|\n puts tweet[\"text\"] \n end \n end",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def show\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n end\n\n begin\n timelines = client.user_timeline(@club.twitter_id)\n @tweets = []\n rescue\n end\n\n if timelines.present?\n timelines.each do |timeline_tweet|\n tweet = client.status(timeline_tweet.id)\n @tweets << tweet.text\n end\n end\n end",
"def print_timeline(tweets)\n \n puts tweets [0][\"user\"][\"screen_name\"]\n puts tweets [0][\"text\"]\n\n \n\nend",
"def index\n puts(\"Total tweets: #{Tweet.count}\")\n @tweets = Tweet.all\n @tweets.each do |tweet|\n puts( \"#{tweet.zombie}: #{tweet.status}\")\n end\n\n @tweets\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def index\n @actor_tweets = ActorTweet.all\n end",
"def index\n respond_with RawTweet.all\n end",
"def index\n reader = inject( Java::pl.goldmann.confitura.beans.TweetReader )\n \n @tweets = reader.read\n @total = reader.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tweets }\n end\n end",
"def index\n authenticate\n @tweets = Tweet.where(\n user_id: current_user.id,\n stat: nil\n ).order(:id)\n end",
"def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def show\r\n @tweets = Tweet.all\r\n @tweet = Tweet.find(params[:id])\r\n end",
"def twubbles\n @sad_tweets = WordTweet.recent_sad_tweets\n respond_to do |f|\n f.json { render :json => twubbles_json(@sad_tweets) }\n f.html\n end\n end",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { \n if query\n @tweets_url = \"/tweets.json?q=#{query}\"\n else\n @tweets_url = \"/tweets.json\" \n end\n }\n format.json { \n tweets, has_more = if query\n search_result = Tweet.search(query, \n page: params[:page] || 1, \n per_page: 20, \n includes: [\n {user: {avatar_attachment: [:blob]}},\n :likes, {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}\n ])\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets = pagy Tweet.includes({user: {avatar_attachment: [:blob]}},\n :likes, \n {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}).order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: {has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n }\n end\n end",
"def all_tweets\n Tweet.all\n end",
"def get_latest_tweets(num_of_tweets)\n client = configure_authentication\n latest = client.home_timeline({:count => num_of_tweets})\n client.end_session\n info = latest.to_json\n end",
"def show\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:get, params[:id])\n format.html # show.rhtml\n format.json { render :json => @tweet.to_json }\n format.xml { render :xml => @tweet.to_xml }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format)\n end\n end\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend",
"def show\n @tweets = @usuario.tweets\n end",
"def by_user\r\n tweets = Tweet.where(user_id: params[:user_id])\r\n render json: tweets\r\n end",
"def index\n @following_user_ids = @user.following.pluck(:id)\n\n @tweets = Tweet.where(user_id: @following_user_ids).order(created_at: :desc).includes(:user)\n json_response(@tweets)\n end",
"def show\n @all_tweets = set_tweet_collection.tweets\n end",
"def index\n @tweets = Tweet.all.reverse\n respond_with(@tweets)\n end",
"def index\n # binding.pry\n @tweet = Tweet.new\n if current_user\n friend_ids = Friend.where(user_id: current_user).pluck(:friends_id) \n @tweets = Tweet.where(user_id: friend_ids)\n else\n @tweets = Tweet.includes([:user]).all\n end\n\n @tweets = @tweets.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def news\n #creamos el hash para mostrar los datos en la api\n @tweet = Tweet.includes(:likes)\n\n #User.includes(:posts)\n api = []\n @tweet.each do |tweet|\n api << Hash[:id => tweet.id, :content => tweet.content, :user_id => tweet.user_id, :likes_count => tweet.likes.count,:retweets_count => tweet.count_tweet,:rewtitted_from => tweet.tweet_id]\n end\n @tweets = api.last(50)#ultimos50 tweets\n render json: @tweets \n end",
"def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render json: @tweet_api\n end",
"def print_timeline(response)\n \n tweets = response[\"statuses\"]\n \n for tweet in tweets\n puts tweet[\"user\"][\"screen_name\"]\n puts tweet[\"text\"]\n end\n \nend",
"def index\n @new_tweets = NewTweet.all\n end",
"def index\n @tweets = Tweet.all.order(created_at: :desc).page(params[:page]).per(25)\n @tweet = Tweet.new\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def index\r\n @tweets = Tweet.all\r\n @tweet = Tweet.new\r\n end",
"def tweets(options={})\n\n @tweets=(@tweets.empty? || (@last_tweets_options!=options)) ? @tweets=read_tweets(self.id, options) : @tweets\n @last_tweets_options=options\n @tweets\n end",
"def fetch_user_timeline(n=200)\n tweets.destroy_all if n == 200\n statuses = Twitter.user_timeline(screen_name, count: n)\n Tweet.many_from_twitter(statuses)\n end",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def show\n @tweetsandwich = Tweetsandwich.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweetsandwich }\n end\n end",
"def default\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"0EOMlVsBuU0VNShIxBpoobxhk\"\n config.consumer_secret = \"e2JDYCId5uucBtgsCV5epvu5GO7vjSVrnFI1Lj0Z3SkWK0KJrV\"\n config.access_token = \"429379668-BgRseD5d6XHjZ3cZIE8KP21QCO3aqBp5sTsysXtr\"\n config.access_token_secret = \"SAJXh81CWxHM6N8WmYo6OgVdKjAoJSdBkFq7zGEjUlIM3\"\n end\n\n timeline = client.user_timeline(twitter_id)\n tweets = timeline.map { |tweet| tweet.text }\n content = { title: 'Tweets del Diario Hoy', body: strip_urls(tweets) }\n\n respond content, { type: 'list' }\n end",
"def index\n @tweeters = Tweeter.all\n end",
"def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end",
"def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end",
"def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end",
"def index\n\n @tweets = Tweet.limit(50)\n @no_authorized = false\n\n\n if params[:code]\n session[:code] = params[:code]\n end\n \n #Get access_token\n if session[:access_token].nil? || params[:code]\n if authorize_redbooth == ERROR\n @no_authorized = true\n end\n end\n\n begin\n args = {:access_token => session[:access_token]}\n response = get_redbooth_projects (args)\n @projects = response.map{|x| [x[\"name\"],x[\"id\"]]} if response\n response = get_redbooth_task_lists (args) \n @task_lists = response.map{|x| [x[\"name\"],x[\"id\"]]} if response\n rescue RestClient::Unauthorized => exception\n if authorize_redbooth == ERROR \n @no_authorized = true\n end\n end\n\n\n if @no_authorized\n redirect_to :controller => 'oauth', :action => 'index' and return\n else\n redishelper = RedisHandlerQueue.new\n @handlers = redishelper.get_handlers\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end\n \n end",
"def tweet_objects\n tweet_json = JSON.parse(File.read(tweet_filepath))['tweets']\n tweet_json.map { |tweet| Twitter::Tweet.new(tweet.deep_symbolize_keys) }\n end",
"def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end",
"def print_timeline(tweets)\n # ADD CODE TO ITERATE THROUGH EACH TWEET AND PRINT ITS TEXT\n tweets.each do |tweet| puts tweet['text'] end\n \n\nend",
"def get_tweets(list)\n unless list.authorized(@user)\n raise AuthorizationException.new\n end\n list.tweets\nend",
"def fetch_tweets(criteria)\n @client.filter(track: criteria.theme) do |object|\n puts object.text if object.is_a?(Twitter::Tweet)\n end\n end",
"def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end",
"def index\n @tweets = current_user.feed_tweets.order(id: :desc).page(params[:page])\n @tweet = current_user.tweets.build\n end",
"def show\n @user = User.find_by!(username: params[:username])\n #This saves user tweets in desc order.\n @tweets = @user.tweets.order(created_at: :desc)\n end",
"def index\r\n @users = User.where.not(id: current_user&.id)\r\n @tweet = Tweet.new\r\n @tweets = Tweet.all.page(params[:page])\r\n\r\n \r\n if params[:q]\r\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").page(params[:page])\r\n if @tweets.nil?\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n else\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n \r\n #SCOPE comentado para evitar conflicto con buscador\r\n if signed_in?\r\n @tweets = Tweet.tweets_for_me(current_user).page(params[:page])\r\n else\r\n @tweets = Tweet.all.order(\"created_at DESC\").page(params[:page])\r\n end\r\n\r\n if params[:tweetsearch].present?\r\n @tweets = Tweet.search_my_tweets(params[:tweetsearch]).page(params[:page]).order(\"created_at DESC\")\r\n elsif params[:hashtag].present?\r\n @tweets = Tweet.search_my_tweets(\"##{params[:hashtag]}\").page(params[:page]).order(\"created_at DESC\")\r\n end\r\n\r\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n format.xml { render xml: @tweet }\n end\n end",
"def index\n @tweets = Tweet.all\n @user = current_user\n @recent_tweets = Tweet.order(created_at: :desc).limit(10)\n @pop_tweets = Tweet.order(likes_count: :desc).limit(10)\n @tweet = Tweet.new\n #@users # 基於測試規格,必須講定變數名稱,請用此變數中存放關注人數 Top 10 的使用者資料\n end",
"def show\n\t\treferenced = @topic.tweets.count(:distinct)\n\t\tusers = @topic.tweets.user.count(:distinct)\n\t\trender json: show_json(@topic, referenced, users)\n\tend",
"def get_tweet(id)\n\n\t\t# tweet = Tweet.where({:tweet_id => id})\n\n\n\tend",
"def search_hashtag tag\r\n response = RestClient.get 'https://api.twitter.com/1.1/search/tweets.json', params: {q: tag, count: 100}, Authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAAJr1YQAAAAAAHA%2FAKcuAEPhPSJgFqwcwKMU0wPk%3DwHtz3CIM3eluP3XQDNfXobhvApEBTpyYeWrJ31ZxUukMm1idUj'\r\n \r\n tweets = Array.new\r\n JSON.parse(response)['statuses'].each do |t|\r\n hashtags = Array.new\r\n t[\"entities\"][\"hashtags\"].each do |h|\r\n hashtags << (\"#\" + h[\"text\"].downcase)\r\n end\r\n tweet={\r\n \"id\" => t[\"id\"],\r\n \"text\" => t['text'],\r\n \"hashtags\" => hashtags\r\n }\r\n tweets << tweet\r\n end\r\n tweets\r\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def show\n @tweeter = Tweeter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweeter }\n end\n end"
] | [
"0.8115453",
"0.7980129",
"0.786006",
"0.77100396",
"0.76598233",
"0.75170803",
"0.74347824",
"0.74107563",
"0.7409217",
"0.73619074",
"0.73584616",
"0.7300687",
"0.7241951",
"0.7181157",
"0.7123983",
"0.7104852",
"0.7096105",
"0.70944136",
"0.70827305",
"0.70827305",
"0.70827305",
"0.70827305",
"0.70827305",
"0.70827305",
"0.70700157",
"0.70602727",
"0.6981525",
"0.6964376",
"0.6926136",
"0.6904197",
"0.6902687",
"0.69024765",
"0.688664",
"0.6870475",
"0.68562615",
"0.68521976",
"0.68521494",
"0.68516785",
"0.6850033",
"0.6849986",
"0.68449783",
"0.68184245",
"0.6814804",
"0.679908",
"0.6797474",
"0.67972803",
"0.67972803",
"0.6787905",
"0.6784057",
"0.6781914",
"0.67737395",
"0.6763872",
"0.6742174",
"0.67290145",
"0.66889364",
"0.6685023",
"0.6673214",
"0.6661647",
"0.6647426",
"0.66435707",
"0.6640702",
"0.66394895",
"0.66364115",
"0.6627717",
"0.6612645",
"0.65978616",
"0.659774",
"0.6590624",
"0.6566825",
"0.6555585",
"0.65391505",
"0.653645",
"0.65196955",
"0.6519074",
"0.651563",
"0.6512989",
"0.6512955",
"0.6507059",
"0.6502097",
"0.6476971",
"0.6469942",
"0.6468636",
"0.6464479",
"0.6462287",
"0.64556855",
"0.64259326",
"0.6419452",
"0.64118403",
"0.64093876",
"0.6401983",
"0.63648576",
"0.6362687",
"0.6361683",
"0.63597447",
"0.6354588",
"0.634441",
"0.63441074",
"0.6338734",
"0.63368803",
"0.6336437",
"0.6328056"
] | 0.0 | -1 |
GET /tweets/1 GET /tweets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def index\n chain = Tweet\n chain = chain.since_id(params[:since_id]) if params[:since_id]\n @tweets = chain.all(:order => 'msg_twid ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def list\r\n #page = params[:page].nil? ? 0 : params[:page]\r\n tweets = Tweet.all\r\n render json: tweets\r\n end",
"def index\n @tweets = Tweet.all\n\n render json: @tweets\n end",
"def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end",
"def show\r\n tweet = Tweet.find(params[:id])\r\n render json: tweet\r\n end",
"def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end",
"def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end",
"def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"def list_tweets\n tweets\n end",
"def getThreeTweets\n\t\trender json: TwitterAPI.get_top_3_tweets(params[:twitter_id])\n\tend",
"def index\n if params[:page] && current_user\n render json: current_user, scope: {page: params[:page]}, serializer: UserWithTweetsSerializer, meta: {total_pages: current_user.timeline_tweets.count/25}\n elsif current_user\n render json: current_user, serializer: UserWithTweetsSerializer\n elsif params[:page]\n @tweets = Tweet.all.page(params[:page])\n render json: @tweets\n else\n @tweets = Tweet.all\n render json: @tweets\n end\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def index\n #Array of all tweets. Used for index html page\n @tweets = Tweet.all\n end",
"def show\r\n @tweets = Tweet.all\r\n @tweet = Tweet.find(params[:id])\r\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n\t\tuser = User.find_by(id: params[:user_id])\n\t\tif user.present?\n\t\t\tfollower_ids = user.followers.pluck(:id)\n\t\t\ttweets = Tweet.where(\"user_id IN (?)\", follower_ids).order(\"updated_at DESC\")\n\t\t\trender json: {:status=>\"success\", :code=>200, :message=>\"List of tweets from the users you follow.\", data: tweets}\n\t\telse\n\t\t\trender json: {:status=>\"failure\", :message=>\"User is not present.\", data: tweets}\n\t\tend\n\tend",
"def show\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:get, params[:id])\n format.html # show.rhtml\n format.json { render :json => @tweet.to_json }\n format.xml { render :xml => @tweet.to_xml }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format)\n end\n end\n end",
"def index\n\t\t@tweets = current_user.tweets\n\tend",
"def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end",
"def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweetaro.all\n end",
"def print_timeline(tweets)\n \n puts tweets [0][\"user\"][\"screen_name\"]\n puts tweets [0][\"text\"]\n\n \n\nend",
"def show\n render json: @tweet\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def index\n puts(\"Total tweets: #{Tweet.count}\")\n @tweets = Tweet.all\n @tweets.each do |tweet|\n puts( \"#{tweet.zombie}: #{tweet.status}\")\n end\n\n @tweets\n end",
"def tweets\n @tweets = @user.tweets.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5) # order OWN tweets according to when they were created, with the most recent tweet at the top.\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show_tweets\n @user = get_user_or_current_user(params[:id])\n @tweets = Tweet.where(:user_id => @user.id).order(created_at: :desc)\n end",
"def show\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n end\n\n begin\n timelines = client.user_timeline(@club.twitter_id)\n @tweets = []\n rescue\n end\n\n if timelines.present?\n timelines.each do |timeline_tweet|\n tweet = client.status(timeline_tweet.id)\n @tweets << tweet.text\n end\n end\n end",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def print_tweet(tweets)\ngets tweets.each do |tweet| puts tweet[\"text\"]\nend\nend",
"def index\n @actor_tweets = ActorTweet.all\n end",
"def index\n reader = inject( Java::pl.goldmann.confitura.beans.TweetReader )\n \n @tweets = reader.read\n @total = reader.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tweets }\n end\n end",
"def show\n @tweetsandwich = Tweetsandwich.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweetsandwich }\n end\n end",
"def get_tweet(id)\n\n\t\t# tweet = Tweet.where({:tweet_id => id})\n\n\n\tend",
"def index\n authenticate\n @tweets = Tweet.where(\n user_id: current_user.id,\n stat: nil\n ).order(:id)\n end",
"def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end",
"def get_latest_tweets(num_of_tweets)\n client = configure_authentication\n latest = client.home_timeline({:count => num_of_tweets})\n client.end_session\n info = latest.to_json\n end",
"def by_user\r\n tweets = Tweet.where(user_id: params[:user_id])\r\n render json: tweets\r\n end",
"def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @following_user_ids = @user.following.pluck(:id)\n\n @tweets = Tweet.where(user_id: @following_user_ids).order(created_at: :desc).includes(:user)\n json_response(@tweets)\n end",
"def default\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"0EOMlVsBuU0VNShIxBpoobxhk\"\n config.consumer_secret = \"e2JDYCId5uucBtgsCV5epvu5GO7vjSVrnFI1Lj0Z3SkWK0KJrV\"\n config.access_token = \"429379668-BgRseD5d6XHjZ3cZIE8KP21QCO3aqBp5sTsysXtr\"\n config.access_token_secret = \"SAJXh81CWxHM6N8WmYo6OgVdKjAoJSdBkFq7zGEjUlIM3\"\n end\n\n timeline = client.user_timeline(twitter_id)\n tweets = timeline.map { |tweet| tweet.text }\n content = { title: 'Tweets del Diario Hoy', body: strip_urls(tweets) }\n\n respond content, { type: 'list' }\n end",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { @tweets_url = query ? \"/tweets.json?q=#{query}\" : '/tweets.json' }\n format.json do\n tweets, has_more =\n if query\n search_result =\n Tweet.search(\n query,\n page: params[:page] || 1,\n per_page: 20,\n includes: [\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n ],\n )\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets =\n pagy Tweet\n .includes(\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n )\n .order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: { has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n end\n end\n end",
"def index\n respond_with RawTweet.all\n end",
"def show\n @tweet = Tweet.find(params[:id])\n end",
"def show\n @tweet = Tweet.find(params[:id])\n end",
"def user_tweet\n get_tweets params[:Enter_what_you_want_to_search]\n respond_to do |format|\n format.html \n format.json \n end\n \nend",
"def show\n @tweeter = Tweeter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweeter }\n end\n end",
"def index\r\n @tweets = Tweet.all\r\n @tweet = Tweet.new\r\n end",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def index\n # binding.pry\n @tweet = Tweet.new\n if current_user\n friend_ids = Friend.where(user_id: current_user).pluck(:friends_id) \n @tweets = Tweet.where(user_id: friend_ids)\n else\n @tweets = Tweet.includes([:user]).all\n end\n\n @tweets = @tweets.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n format.xml { render xml: @tweet }\n end\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def news\n #creamos el hash para mostrar los datos en la api\n @tweet = Tweet.includes(:likes)\n\n #User.includes(:posts)\n api = []\n @tweet.each do |tweet|\n api << Hash[:id => tweet.id, :content => tweet.content, :user_id => tweet.user_id, :likes_count => tweet.likes.count,:retweets_count => tweet.count_tweet,:rewtitted_from => tweet.tweet_id]\n end\n @tweets = api.last(50)#ultimos50 tweets\n render json: @tweets \n end",
"def index\n @tweets = Tweet.all.reverse\n respond_with(@tweets)\n end",
"def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end",
"def tweet(postids)\n handle_response(get(\"/content/tweet.json\", :query => {:postids => postids}))\n end",
"def index\n @new_tweets = NewTweet.all\n end",
"def show\n @twitter_id = TwitterId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_id }\n end\n end",
"def get_tweet_by_id(id)\n tweet = Twitter.status(id)\n {:message => tweet.text, :author => tweet.user.screen_name, :date => tweet.created_at} \n end",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { \n if query\n @tweets_url = \"/tweets.json?q=#{query}\"\n else\n @tweets_url = \"/tweets.json\" \n end\n }\n format.json { \n tweets, has_more = if query\n search_result = Tweet.search(query, \n page: params[:page] || 1, \n per_page: 20, \n includes: [\n {user: {avatar_attachment: [:blob]}},\n :likes, {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}\n ])\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets = pagy Tweet.includes({user: {avatar_attachment: [:blob]}},\n :likes, \n {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}).order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: {has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n }\n end\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def index\n @tweets = Tweet.all.order(created_at: :desc).page(params[:page]).per(25)\n @tweet = Tweet.new\n end",
"def show\n @tweets = @usuario.tweets\n end",
"def index\n @tweeters = Tweeter.all\n end",
"def print_twitter_search(tweets)\n #puts JSON.pretty_generate(tweet)\n tweets.each do |tweet|\n puts tweet[\"text\"] \n end \n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def print_timeline(response)\n \n tweets = response[\"statuses\"]\n \n for tweet in tweets\n puts tweet[\"user\"][\"screen_name\"]\n puts tweet[\"text\"]\n end\n \nend",
"def twubbles\n @sad_tweets = WordTweet.recent_sad_tweets\n respond_to do |f|\n f.json { render :json => twubbles_json(@sad_tweets) }\n f.html\n end\n end",
"def fetch_user_timeline(n=200)\n tweets.destroy_all if n == 200\n statuses = Twitter.user_timeline(screen_name, count: n)\n Tweet.many_from_twitter(statuses)\n end",
"def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render json: @tweet_api\n end",
"def show\n @all_tweets = set_tweet_collection.tweets\n end",
"def find_tweet\n\t\t@tweet = Tweet.find(params[:id])\n\tend",
"def show\n @retweet = Retweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retweet }\n end\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def index\n\n #client = Twitter::REST::Client.new do |config|\n # config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n # config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n # config.access_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n # config.access_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n #end\n\n require \"rubygems\"\n\n # Certain methods require authentication. To get your Twitter OAuth credentials,\n # register an app at http://dev.twitter.com/apps\n Twitter.configure do |config|\n config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n config.oauth_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n config.oauth_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n end\n\n # Initialize your Twitter client\n client = Twitter::Client.new\n\n # Post a status update\n client.update(\"I just posted a status update via the Twitter Ruby Gem !\")\n redirect_to request.referer, :notice => 'Tweet successfully posted'\n\n end",
"def show\n\t\treferenced = @topic.tweets.count(:distinct)\n\t\tusers = @topic.tweets.user.count(:distinct)\n\t\trender json: show_json(@topic, referenced, users)\n\tend",
"def show\n @user = User.find_by!(username: params[:username])\n #This saves user tweets in desc order.\n @tweets = @user.tweets.order(created_at: :desc)\n end",
"def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end",
"def index\n @q = Tweet.order('created_at DESC').page(params[:page]).ransack(params[:q])\n @tweets = @q.result(distinct: true)\n # render json: @tweets.each {|tweet| tweet.id}\n end",
"def index\n respond_to do |format|\n # Shows all the tweets in the HTML version.\n format.html { @tweets = Tweet.all }\n \n if this_one_should_fail_randomly?\n format.json { render json: json_error_message, :status => :error }\n format.xml { render xml: xml_error_message, :status => :error }\n else\n format.json { render json: Tweet.random_sample }\n format.xml { render xml: Tweet.random_sample }\n end\n end\n end",
"def show\n @watcher = Watcher.includes(:tweets).friendly.find(params[:id])\n @statuses = Status.all\n respond_to do |format|\n format.html { render :show, offset: params[:offset]}\n format.json { render json: @watcher.tweets }\n end\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend",
"def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end",
"def retweets_of_me(options = {})\n @req.get(\"/1.1/statuses/retweets_of_me.json\", options)\n end",
"def index\n @likes = Like.where(tweet_id: params[:tweet_id])\n @tweets = Tweet.paginate(page: params[:page], per_page: 10)\n end",
"def index\n @tweets = Tweet.select { |tweet| tweet.user_id == current_user.id }\n end"
] | [
"0.7778256",
"0.773942",
"0.7596882",
"0.7484137",
"0.7464283",
"0.7458894",
"0.74329543",
"0.7223404",
"0.712232",
"0.7078807",
"0.70529026",
"0.70419616",
"0.70405924",
"0.703979",
"0.70386153",
"0.6974553",
"0.6974553",
"0.6966099",
"0.6952536",
"0.6951105",
"0.6950016",
"0.6950016",
"0.6950016",
"0.6950016",
"0.6950016",
"0.6950016",
"0.68964213",
"0.6888864",
"0.68756133",
"0.684413",
"0.6829178",
"0.6809046",
"0.6783352",
"0.6782822",
"0.6779304",
"0.67719275",
"0.67409706",
"0.67184156",
"0.6709474",
"0.6705484",
"0.66991967",
"0.6641888",
"0.6628871",
"0.66252947",
"0.6617802",
"0.6617369",
"0.6615806",
"0.66152054",
"0.66127336",
"0.6610755",
"0.6609904",
"0.6606445",
"0.66059035",
"0.6599706",
"0.65954274",
"0.6591865",
"0.65911424",
"0.65900517",
"0.65900517",
"0.65804076",
"0.6559448",
"0.6549496",
"0.65422016",
"0.6532135",
"0.6530945",
"0.6529083",
"0.65289974",
"0.6528192",
"0.65264547",
"0.65214396",
"0.65053695",
"0.64932925",
"0.64899826",
"0.647994",
"0.64732844",
"0.64658266",
"0.64591235",
"0.6456624",
"0.6450247",
"0.64462084",
"0.6446115",
"0.6445465",
"0.64420927",
"0.6435768",
"0.6422068",
"0.64059246",
"0.64032817",
"0.64012355",
"0.63957804",
"0.6356888",
"0.6347317",
"0.63425606",
"0.6341896",
"0.63151234",
"0.6296908",
"0.6273654",
"0.6271509",
"0.6269117",
"0.62653744",
"0.62582624",
"0.6254277"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.